Update of /cvsroot/boost/boost/boost/xpressive/proto
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11998/proto

Modified Files:
        deep_copy.hpp expr.hpp extends.hpp operators.hpp proto.hpp 
        proto_fwd.hpp ref.hpp traits.hpp 
Log Message:
remove eager expression id calculation

Index: deep_copy.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/deep_copy.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- deep_copy.hpp       21 Nov 2006 17:33:47 -0000      1.2
+++ deep_copy.hpp       1 Dec 2006 02:58:48 -0000       1.3
@@ -27,8 +27,9 @@
             template<typename Expr>
             struct deep_copy_impl<Expr, terminal_tag, 1>
             {
-                static typename Expr::expr_type const &
-                call(Expr const &expr)
+                typedef typename Expr::expr_type type;
+
+                static type const &call(Expr const &expr)
                 {
                     return expr.cast();
                 }
@@ -39,28 +40,48 @@
         {
             template<typename Expr>
             struct deep_copy
-            {
-                typedef typename Expr::id_type type;
-            };
+              : detail::deep_copy_impl<Expr>
+            {};
         }
 
-        template<typename Expr>
-        typename Expr::id_type deep_copy(Expr const &expr)
+        namespace op
         {
-            return detail::deep_copy_impl<Expr>::call(expr);
+            struct deep_copy
+            {
+                template<typename Sig>
+                struct result;
+
+                template<typename This, typename Expr>
+                struct result<This(Expr)>
+                  : meta::deep_copy<typename meta::value_type<Expr>::type>
+                {};
+
+                template<typename Expr>
+                typename meta::deep_copy<Expr>::type
+                operator()(Expr const &expr) const
+                {
+                    return meta::deep_copy<Expr>::call(expr);
+                }
+            };
         }
 
+        op::deep_copy const deep_copy = {};
+
         namespace detail
         {
-        #define BOOST_PROTO_DEFINE_DEEP_COPY(z, n, data)\
-            proto::deep_copy(BOOST_PP_CAT(expr.cast().arg, n).cast())
+        #define BOOST_PROTO_DEFINE_DEEP_COPY_TYPE(z, n, data)\
+            typename deep_copy_impl<typename Expr:: 
BOOST_PP_CAT(BOOST_PP_CAT(arg, n), _type) ::expr_type>::type
+
+        #define BOOST_PROTO_DEFINE_DEEP_COPY_FUN(z, n, data)\
+            proto::deep_copy(expr.cast(). BOOST_PP_CAT(arg, n) .cast())
 
         #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, 
<boost/xpressive/proto/deep_copy.hpp>))
 
         #include BOOST_PP_ITERATE()
 
         #undef BOOST_PP_ITERATION_PARAMS_1
-        #undef BOOST_PROTO_DEFINE_DEEP_COPY
+        #undef BOOST_PROTO_DEFINE_DEEP_COPY_FUN
+        #undef BOOST_PROTO_DEFINE_DEEP_COPY_TYPE
         }
 
     }}
@@ -74,10 +95,14 @@
             template<typename Expr, typename Tag>
             struct deep_copy_impl<Expr, Tag, N>
             {
-                static typename Expr::id_type call(Expr const &expr)
+                typedef expr<Tag, BOOST_PP_CAT(args, N)<
+                    BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_TYPE, ~)
+                > > type;
+
+                static type call(Expr const &expr)
                 {
-                    typename Expr::id_type that = {
-                        BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY, ~)
+                    type that = {
+                        BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_FUN, ~)
                     };
                     return that;
                 }

Index: expr.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/expr.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- expr.hpp    21 Nov 2006 17:33:47 -0000      1.3
+++ expr.hpp    1 Dec 2006 02:58:48 -0000       1.4
@@ -45,10 +45,6 @@
         proto::as_expr_ref(BOOST_PP_CAT(a,n))\
         /**/
 
-    #define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 1, 
<boost/xpressive/proto/expr.hpp>, 0))
-    #include BOOST_PP_ITERATE()
-    #undef BOOST_PP_ITERATION_PARAMS_1
-
     #define BOOST_PP_ITERATION_PARAMS_1 (4, (1, BOOST_PROTO_MAX_ARITY, 
<boost/xpressive/proto/expr.hpp>, 1))
     #include BOOST_PP_ITERATE()
     #undef BOOST_PP_ITERATION_PARAMS_1
@@ -75,17 +71,10 @@
 
 #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() < 2
 
-    #if BOOST_PP_ITERATION_FLAGS() == 0
-        template<typename Args>
-        struct expr<terminal_tag, Args, 1>
-        {
-            typedef terminal_tag tag_type;
-    #else
         template<typename Tag, typename Args>
         struct expr<Tag, Args, BOOST_PP_ITERATION() >
         {
             typedef Tag tag_type;
-    #endif
             typedef expr expr_type;
             typedef Args args_type;
             typedef mpl::long_<BOOST_PP_ITERATION()> arity;
@@ -95,14 +84,6 @@
             BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_PROTO_ARG, _)
             BOOST_PP_REPEAT_FROM_TO(BOOST_PP_ITERATION(), 
BOOST_PROTO_MAX_ARITY, BOOST_PROTO_VOID, _)
 
-            typedef expr
-    #if BOOST_PP_ITERATION_FLAGS() == 1
-                <tag_type, BOOST_PP_CAT(args, BOOST_PP_ITERATION()) <
-                    BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), typename 
Args::arg, ::expr_type::id_type BOOST_PP_INTERCEPT)
-                > >
-    #endif
-            id_type;
-
             expr const &cast() const
             {
                 return *this;

Index: extends.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/extends.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- extends.hpp 20 Nov 2006 03:41:06 -0000      1.5
+++ extends.hpp 1 Dec 2006 02:58:48 -0000       1.6
@@ -9,17 +9,11 @@
 #ifndef BOOST_PROTO_EXTENDS_HPP_EAN_11_1_2006
 #define BOOST_PROTO_EXTENDS_HPP_EAN_11_1_2006
 
-#include <boost/mpl/and.hpp>
 #include <boost/mpl/bool.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_base_and_derived.hpp>
 #include <boost/xpressive/proto/ref.hpp>
-#include <boost/xpressive/proto/traits.hpp>
+#include <boost/xpressive/proto/args.hpp>
 #include <boost/xpressive/proto/expr.hpp>
 #include <boost/preprocessor/punctuation/comma.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
 
 namespace boost { namespace proto { namespace extends_private_
 {
@@ -28,6 +22,7 @@
       : Expr
     {
         typedef Expr type;
+        typedef Expr boost_proto_extends_private_extends_expr_type_;
         typedef void is_boost_proto_extends_private_extends_;
 
         extends()
@@ -44,10 +39,10 @@
 
 #define BOOST_PROTO_EXTENDS_BINARY_OP(op, tag)\
     template<typename Left, typename Right>\
-    typename enable_if<\
-        mpl::and_<meta::is_extends<Left>, meta::is_extends<Right> >\
-      , expr<tag, args2<ref<typename Left::expr_type>, ref<typename 
Left::expr_type> > > const\
-    >::type\
+    expr<tag, args2<\
+        ref<typename Left::boost_proto_extends_private_extends_expr_type_>\
+      , ref<typename Right::boost_proto_extends_private_extends_expr_type_>\
+    > > const\
     operator op(Left const &left, Right const &right)\
     {\
         return left.cast() op right.cast();\
@@ -69,9 +64,9 @@
     BOOST_PROTO_EXTENDS_BINARY_OP(!=, not_equal_tag)
     BOOST_PROTO_EXTENDS_BINARY_OP(||, logical_or_tag)
     BOOST_PROTO_EXTENDS_BINARY_OP(&&, logical_and_tag)
-    BOOST_PROTO_EXTENDS_BINARY_OP(&, bitand_tag)
-    BOOST_PROTO_EXTENDS_BINARY_OP(|, bitor_tag)
-    BOOST_PROTO_EXTENDS_BINARY_OP(^, bitxor_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(&, bitwise_and_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(|, bitwise_or_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(^, bitwise_xor_tag)
     BOOST_PROTO_EXTENDS_BINARY_OP(BOOST_PP_COMMA(), comma_tag)
     BOOST_PROTO_EXTENDS_BINARY_OP(->*, mem_ptr_tag)
 
@@ -82,9 +77,9 @@
     BOOST_PROTO_EXTENDS_BINARY_OP(%=, modulus_assign_tag)
     BOOST_PROTO_EXTENDS_BINARY_OP(+=, add_assign_tag)
     BOOST_PROTO_EXTENDS_BINARY_OP(-=, subtract_assign_tag)
-    BOOST_PROTO_EXTENDS_BINARY_OP(&=, bitand_assign_tag)
-    BOOST_PROTO_EXTENDS_BINARY_OP(|=, bitor_assign_tag)
-    BOOST_PROTO_EXTENDS_BINARY_OP(^=, bitxor_assign_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(&=, bitwise_and_assign_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(|=, bitwise_or_assign_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(^=, bitwise_xor_assign_tag)
 
 #undef BOOST_PROTO_EXTENDS_BINARY_OP
 

Index: operators.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/operators.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- operators.hpp       20 Nov 2006 03:41:07 -0000      1.12
+++ operators.hpp       1 Dec 2006 02:58:48 -0000       1.13
@@ -77,9 +77,9 @@
     BOOST_PROTO_BINARY_OP(!=, not_equal_tag)
     BOOST_PROTO_BINARY_OP(||, logical_or_tag)
     BOOST_PROTO_BINARY_OP(&&, logical_and_tag)
-    BOOST_PROTO_BINARY_OP(&, bitand_tag)
-    BOOST_PROTO_BINARY_OP(|, bitor_tag)
-    BOOST_PROTO_BINARY_OP(^, bitxor_tag)
+    BOOST_PROTO_BINARY_OP(&, bitwise_and_tag)
+    BOOST_PROTO_BINARY_OP(|, bitwise_or_tag)
+    BOOST_PROTO_BINARY_OP(^, bitwise_xor_tag)
     BOOST_PROTO_BINARY_OP(BOOST_PP_COMMA(), comma_tag)
     BOOST_PROTO_BINARY_OP(->*, mem_ptr_tag)
 
@@ -90,9 +90,9 @@
     BOOST_PROTO_BINARY_OP(%=, modulus_assign_tag)
     BOOST_PROTO_BINARY_OP(+=, add_assign_tag)
     BOOST_PROTO_BINARY_OP(-=, subtract_assign_tag)
-    BOOST_PROTO_BINARY_OP(&=, bitand_assign_tag)
-    BOOST_PROTO_BINARY_OP(|=, bitor_assign_tag)
-    BOOST_PROTO_BINARY_OP(^=, bitxor_assign_tag)
+    BOOST_PROTO_BINARY_OP(&=, bitwise_and_assign_tag)
+    BOOST_PROTO_BINARY_OP(|=, bitwise_or_assign_tag)
+    BOOST_PROTO_BINARY_OP(^=, bitwise_xor_assign_tag)
 
     template<typename Tag, typename Args, long Arity>
     inline expr<post_inc_tag, args1<ref<expr<Tag, Args, Arity> > > > const

Index: proto.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/proto.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- proto.hpp   20 Nov 2006 03:41:07 -0000      1.12
+++ proto.hpp   1 Dec 2006 02:58:48 -0000       1.13
@@ -13,11 +13,12 @@
 #include <boost/xpressive/proto/ref.hpp>
 #include <boost/xpressive/proto/args.hpp>
 #include <boost/xpressive/proto/tags.hpp>
+#include <boost/xpressive/proto/expr.hpp>
 #include <boost/xpressive/proto/traits.hpp>
 #include <boost/xpressive/proto/compile.hpp>
 #include <boost/xpressive/proto/matches.hpp>
 #include <boost/xpressive/proto/extends.hpp>
 #include <boost/xpressive/proto/operators.hpp>
-#include <boost/xpressive/proto/expr.hpp>
+#include <boost/xpressive/proto/deep_copy.hpp>
 
 #endif

Index: proto_fwd.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/proto_fwd.hpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- proto_fwd.hpp       20 Nov 2006 03:41:07 -0000      1.31
+++ proto_fwd.hpp       1 Dec 2006 02:58:48 -0000       1.32
@@ -226,6 +226,9 @@
         template<typename Expr>
         struct id;
 
+        template<typename Expr>
+        struct deep_copy;
+
         template<typename T, bool IsExpr = is_expr<T>::value>
         struct unref;
 
@@ -289,6 +292,7 @@
         struct as_expr;
         struct as_expr_ref;
         struct unref;
+        struct deep_copy;
 
         template<typename N = mpl::long_<0> >
         struct arg;

Index: ref.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/ref.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ref.hpp     21 Nov 2006 17:33:47 -0000      1.9
+++ ref.hpp     1 Dec 2006 02:58:48 -0000       1.10
@@ -25,7 +25,6 @@
         typedef typename Expr::tag_type tag_type;
         typedef typename Expr::args_type args_type;
         typedef typename Expr::arity arity;
-        typedef typename Expr::id_type id_type;
         typedef proto_ref_tag fusion_tag;
         typedef void is_boost_proto_ref_;
         typedef void is_boost_proto_expr_;

Index: traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/traits.hpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- traits.hpp  21 Nov 2006 17:33:47 -0000      1.18
+++ traits.hpp  1 Dec 2006 02:58:48 -0000       1.19
@@ -213,9 +213,8 @@
             // id
             template<typename Expr>
             struct id
-            {
-                typedef typename Expr::id_type type;
-            };
+              : deep_copy<Expr>
+            {};
 
         #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, 
<boost/xpressive/proto/traits.hpp>))
         #include BOOST_PP_ITERATE()


-------------------------------------------------------------------------
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