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

Modified Files:
        basic_expr.hpp extends.hpp proto_fwd.hpp ref.hpp traits.hpp 
Log Message:
faster proto is_ref, is_extends, is_expr; remove is_basic_expr; eliminate 
extends_base and extends multiple inheritance, misc. clean-up

Index: basic_expr.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/basic_expr.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- basic_expr.hpp      7 Nov 2006 05:03:51 -0000       1.7
+++ basic_expr.hpp      10 Nov 2006 04:09:38 -0000      1.8
@@ -79,6 +79,8 @@
             typedef Args args_type;
             typedef mpl::long_<BOOST_PP_ITERATION()> arity;
             typedef proto_expr_tag fusion_tag;
+            typedef void is_boost_proto_basic_expr_;
+            typedef void is_boost_proto_expr_;
 
             BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_PROTO_ARG, _)
             BOOST_PP_REPEAT_FROM_TO(BOOST_PP_ITERATION(), 
BOOST_PROTO_MAX_ARITY, BOOST_PROTO_VOID, _)

Index: extends.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/extends.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- extends.hpp 7 Nov 2006 14:46:50 -0000       1.3
+++ extends.hpp 10 Nov 2006 04:09:38 -0000      1.4
@@ -11,7 +11,6 @@
 
 #include <boost/mpl/and.hpp>
 #include <boost/mpl/bool.hpp>
-#include <boost/mpl/assert.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_base_and_derived.hpp>
 #include <boost/xpressive/proto/ref.hpp>
@@ -22,72 +21,14 @@
 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 
-#ifndef BOOST_PROTO_EXTENDS_TAG_MAX_ARITY
-# define BOOST_PROTO_EXTENDS_TAG_MAX_ARITY BOOST_PROTO_MAX_ARITY
-#endif
-
-namespace boost { namespace proto
+namespace boost { namespace proto { namespace extends_private_
 {
-
-    namespace extends_private_
-    {
-        struct extends_base
-        {};
-
-    #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> >\
-          , basic_expr<tag, mpl::vector2<ref<typename Left::expr_type>, 
ref<typename Left::expr_type> > > const\
-        >::type\
-        operator op(Left const &left, Right const &right)\
-        {\
-            return left.cast() op right.cast();\
-        }\
-        /**/
-
-        BOOST_PROTO_EXTENDS_BINARY_OP(<<, left_shift_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(>>, right_shift_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(*, multiply_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(/, divide_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(%, modulus_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(+, add_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(-, subtract_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(<, less_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(>, greater_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(<=, less_equal_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(>=, greater_equal_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(==, equal_tag)
-        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(BOOST_PP_COMMA(), comma_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(->*, mem_ptr_tag)
-
-        BOOST_PROTO_EXTENDS_BINARY_OP(<<=, left_shift_assign_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(>>=, right_shift_assign_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(*=, multiply_assign_tag)
-        BOOST_PROTO_EXTENDS_BINARY_OP(/=, divide_assign_tag)
-        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)
-    
-    #undef BOOST_PROTO_EXTENDS_BINARY_OP
-    }
-
     template<typename Expr>
     struct extends
       : Expr
-      , extends_private_::extends_base
     {
-        BOOST_MPL_ASSERT((meta::is_basic_expr<Expr>));
         typedef Expr type;
+        typedef void is_boost_proto_extends_private_extends_;
 
         extends()
           : Expr()
@@ -101,6 +42,52 @@
         using Expr::operator =;
     };
 
-}}
+#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> >\
+      , basic_expr<tag, mpl::vector2<ref<typename Left::expr_type>, 
ref<typename Left::expr_type> > > const\
+    >::type\
+    operator op(Left const &left, Right const &right)\
+    {\
+        return left.cast() op right.cast();\
+    }\
+    /**/
+
+    BOOST_PROTO_EXTENDS_BINARY_OP(<<, left_shift_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(>>, right_shift_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(*, multiply_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(/, divide_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(%, modulus_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(+, add_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(-, subtract_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(<, less_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(>, greater_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(<=, less_equal_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(>=, greater_equal_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(==, equal_tag)
+    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(BOOST_PP_COMMA(), comma_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(->*, mem_ptr_tag)
+
+    BOOST_PROTO_EXTENDS_BINARY_OP(<<=, left_shift_assign_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(>>=, right_shift_assign_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(*=, multiply_assign_tag)
+    BOOST_PROTO_EXTENDS_BINARY_OP(/=, divide_assign_tag)
+    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)
+
+#undef BOOST_PROTO_EXTENDS_BINARY_OP
+
+}}}
 
 #endif

Index: proto_fwd.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/proto_fwd.hpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- proto_fwd.hpp       8 Nov 2006 01:58:20 -0000       1.29
+++ proto_fwd.hpp       10 Nov 2006 04:09:38 -0000      1.30
@@ -168,9 +168,12 @@
 
     namespace extends_private_
     {
-        struct extends_base;
+        template<typename Expr>
+        struct extends;
     }
 
+    using extends_private_::extends;
+
     namespace meta
     {
         template<typename T>
@@ -179,16 +182,13 @@
             typedef typename remove_cv<typename 
remove_reference<T>::type>::type type;
         };
 
-        template<typename T>
-        struct is_basic_expr;
-
-        template<typename T>
+        template<typename T, typename EnableIf = void>
         struct is_ref;
 
-        template<typename T>
+        template<typename T, typename EnableIf = void>
         struct is_extends;
 
-        template<typename T>
+        template<typename T, typename EnableIf = void>
         struct is_expr;
 
         template<typename T, bool IsExpr = is_expr<T>::value>

Index: ref.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/ref.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ref.hpp     7 Nov 2006 05:03:51 -0000       1.6
+++ ref.hpp     10 Nov 2006 04:09:38 -0000      1.7
@@ -26,6 +26,8 @@
         typedef typename Expr::args_type args_type;
         typedef typename Expr::arity arity;
         typedef proto_ref_tag fusion_tag;
+        typedef void is_boost_proto_ref_;
+        typedef void is_boost_proto_expr_;
 
         BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_ARG, _)
 

Index: traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/traits.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- traits.hpp  8 Nov 2006 01:58:20 -0000       1.13
+++ traits.hpp  10 Nov 2006 04:09:38 -0000      1.14
@@ -17,7 +17,6 @@
     #include <boost/mpl/bool.hpp>
     #include <boost/call_traits.hpp>
     #include <boost/static_assert.hpp>
-    #include <boost/type_traits/is_base_and_derived.hpp>
     #include <boost/xpressive/proto/proto_fwd.hpp>
     #include <boost/xpressive/proto/tags.hpp>
     #include <boost/xpressive/proto/ref.hpp>
@@ -30,53 +29,37 @@
 
         namespace meta
         {
-            // is_basic_expr
-            template<typename T>
-            struct is_basic_expr
+            // is_extends
+            template<typename T, typename EnableIf>
+            struct is_extends
               : mpl::false_
             {};
 
-            template<typename Tag, typename Args, long Arity>
-            struct is_basic_expr<basic_expr<Tag, Args, Arity> >
-              : mpl::true_
-            {};
-
             template<typename T>
-            struct is_basic_expr<T const>
-              : is_basic_expr<T>
+            struct is_extends<T, typename 
T::is_boost_proto_extends_private_extends_>
+              : mpl::true_
             {};
 
             // is_ref
-            template<typename T>
+            template<typename T, typename EnableIf>
             struct is_ref
               : mpl::false_
             {};
 
             template<typename T>
-            struct is_ref<ref<T> >
+            struct is_ref<T, typename T::is_boost_proto_ref_>
               : mpl::true_
             {};
 
-            template<typename T>
-            struct is_ref<T const>
-              : is_ref<T>
-            {};
-
-            // is_extends
-            template<typename T>
-            struct is_extends
-              : is_base_and_derived<extends_private_::extends_base, T>
-            {};
-
-            template<typename T>
-            struct is_extends<T const>
-              : is_extends<T>
+            // is_expr
+            template<typename T, typename EnableIf>
+            struct is_expr
+              : mpl::false_
             {};
 
-            // is_expr
             template<typename T>
-            struct is_expr
-              : mpl::or_<is_basic_expr<T>, is_ref<T>, is_extends<T> >
+            struct is_expr<T, typename T::is_boost_proto_expr_>
+              : mpl::true_
             {};
 
             // as_expr


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to