Update of /cvsroot/boost/boost/boost/xpressive/detail/core/matcher
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10081/detail/core/matcher

Modified Files:
        action_matcher.hpp 
Log Message:
bug fixing wrt const and temporaries in action_context

Index: action_matcher.hpp
===================================================================
RCS file: 
/cvsroot/boost/boost/boost/xpressive/detail/core/matcher/action_matcher.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- action_matcher.hpp  31 Mar 2007 00:55:48 -0000      1.15
+++ action_matcher.hpp  31 Mar 2007 07:40:19 -0000      1.16
@@ -13,7 +13,11 @@
 # pragma once
 #endif
 
+#include <boost/ref.hpp>
 #include <boost/assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
 #include <boost/xpressive/detail/detail_fwd.hpp>
 #include <boost/xpressive/detail/core/quant_style.hpp>
 #include <boost/xpressive/detail/core/action.hpp>
@@ -88,7 +92,17 @@
         template<typename Expr>
         struct eval<Expr, proto::tag::mem_ptr>
         {
-            typedef typename proto::result_of::right<Expr>::type right_type;
+            typedef typename remove_reference<typename mpl::if_<
+                is_const<Expr>
+              , typename proto::result_of::right<Expr>::const_reference
+              , typename proto::result_of::right<Expr>::reference
+            >::type>::type right_type;
+            
+            typedef typename remove_reference<typename mpl::if_<
+                is_const<Expr>
+              , typename proto::result_of::left<Expr>::const_reference
+              , typename proto::result_of::left<Expr>::reference
+            >::type>::type left_type;
             
             typedef
                 typename proto::result_of::arg<
@@ -99,8 +113,8 @@
             typedef 
                 fusion::transform_view<
                     typename fusion::result_of::push_front<
-                        typename 
fusion::result_of::pop_front<proto::children<right_type const> >::type const
-                      , typename proto::result_of::left<Expr>::type
+                        typename 
fusion::result_of::pop_front<proto::children<right_type> >::type const
+                      , reference_wrapper<left_type>
                     >::type const
                   , proto::eval_fun<action_context const>
                 >
@@ -115,7 +129,7 @@
                 return fusion::invoke<function_type>(
                     proto::arg(proto::arg_c<0>(proto::right(expr)))
                   , evaluated_args(
-                        
fusion::push_front(fusion::pop_front(proto::children_of(proto::right(expr))), 
proto::left(expr))
+                        
fusion::push_front(fusion::pop_front(proto::children_of(proto::right(expr))), 
boost::ref(proto::left(expr)))
                       , proto::eval_fun<action_context const>(ctx)
                     )
                 );


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to