$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r59854 - in trunk/boost/proto: . transform
From: eric_at_[hidden]
Date: 2010-02-23 03:42:26
Author: eric_niebler
Date: 2010-02-23 03:42:25 EST (Tue, 23 Feb 2010)
New Revision: 59854
URL: http://svn.boost.org/trac/boost/changeset/59854
Log:
fix const correctness issues, work around fusion bug #3954
Text files modified: 
   trunk/boost/proto/fusion.hpp              |    20 ++++++++++++--------                    
   trunk/boost/proto/transform/fold_tree.hpp |    33 +++++++++++++++++++++------------       
   2 files changed, 33 insertions(+), 20 deletions(-)
Modified: trunk/boost/proto/fusion.hpp
==============================================================================
--- trunk/boost/proto/fusion.hpp	(original)
+++ trunk/boost/proto/fusion.hpp	2010-02-23 03:42:25 EST (Tue, 23 Feb 2010)
@@ -53,11 +53,11 @@
             typedef fusion::random_access_traversal_tag category;
             typedef tag::proto_expr_iterator fusion_tag;
 
-            expr_iterator(Expr const &e)
+            expr_iterator(Expr &e)
               : expr(e)
             {}
 
-            Expr const &expr;
+            Expr &expr;
         };
 
         template<typename Expr>
@@ -203,7 +203,9 @@
             typename fusion::result_of::pop_front<Expr>::type
             operator ()(Expr &e) const
             {
-                return fusion::pop_front(e);
+                // Work around a const-correctness issue in Fusion
+                typedef typename fusion::result_of::pop_front<Expr>::type result_type;
+                return result_type(fusion::next(fusion::begin(e)), fusion::end(e));
             }
 
             template<typename Expr>
@@ -243,7 +245,9 @@
             typename fusion::result_of::reverse<Expr>::type
             operator ()(Expr &e) const
             {
-                return fusion::reverse(e);
+                // Work around a const-correctness issue in Fusion
+                typedef typename fusion::result_of::reverse<Expr>::type result_type;
+                return result_type(e);
             }
 
             template<typename Expr>
@@ -415,7 +419,7 @@
             {
                 typedef
                     typename proto::result_of::child_c<
-                        typename Iterator::expr_type const &
+                        typename Iterator::expr_type &
                       , Iterator::index
                     >::type
                 type;
@@ -431,7 +435,7 @@
             {
                 typedef
                     typename proto::result_of::value<
-                        typename Iterator::expr_type const &
+                        typename Iterator::expr_type &
                     >::type
                 type;
 
@@ -537,7 +541,7 @@
             {
                 typedef proto::detail::expr_iterator<Sequence, 0> type;
 
-                static type call(Sequence const &seq)
+                static type call(Sequence &seq)
                 {
                     return type(seq);
                 }
@@ -560,7 +564,7 @@
                     >
                 type;
 
-                static type call(Sequence const &seq)
+                static type call(Sequence &seq)
                 {
                     return type(seq);
                 }
Modified: trunk/boost/proto/transform/fold_tree.hpp
==============================================================================
--- trunk/boost/proto/transform/fold_tree.hpp	(original)
+++ trunk/boost/proto/transform/fold_tree.hpp	2010-02-23 03:42:25 EST (Tue, 23 Feb 2010)
@@ -21,25 +21,22 @@
     namespace detail
     {
         template<typename Tag>
-        struct has_tag : transform<has_tag<Tag> >
+        struct has_tag
         {
             template<typename Expr, typename State, typename Data, typename EnableIf = Tag>
             struct impl
-              : transform_impl<Expr, State, Data>
             {
                 typedef mpl::false_ result_type;
             };
 
             template<typename Expr, typename State, typename Data>
             struct impl<Expr, State, Data, typename Expr::proto_tag>
-              : transform_impl<Expr, State, Data>
             {
                 typedef mpl::true_ result_type;
             };
 
             template<typename Expr, typename State, typename Data>
             struct impl<Expr &, State, Data, typename Expr::proto_tag>
-              : transform_impl<Expr &, State, Data>
             {
                 typedef mpl::true_ result_type;
             };
@@ -97,12 +94,18 @@
           : fold<
                 Sequence
               , State0
-              , detail::fold_tree_<
-                    typename remove_reference<Expr>::type::proto_tag
-                  , Fun
-                >
+              , detail::fold_tree_<typename Expr::proto_tag, Fun>
             >::template impl<Expr, State, Data>
         {};
+
+        template<typename Expr, typename State, typename Data>
+        struct impl<Expr &, State, Data>
+          : fold<
+                Sequence
+              , State0
+              , detail::fold_tree_<typename Expr::proto_tag, Fun>
+            >::template impl<Expr &, State, Data>
+        {};
     };
 
     /// \brief A PrimitiveTransform that recursively applies the
@@ -146,12 +149,18 @@
           : reverse_fold<
                 Sequence
               , State0
-              , detail::reverse_fold_tree_<
-                    typename remove_reference<Expr>::type::proto_tag
-                  , Fun
-                >
+              , detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
             >::template impl<Expr, State, Data>
         {};
+
+        template<typename Expr, typename State, typename Data>
+        struct impl<Expr &, State, Data>
+          : reverse_fold<
+                Sequence
+              , State0
+              , detail::reverse_fold_tree_<typename Expr::proto_tag, Fun>
+            >::template impl<Expr &, State, Data>
+        {};
     };
 
     /// INTERNAL ONLY