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

Modified Files:
        expr.hpp extends.hpp literal.hpp operators.hpp proto_fwd.hpp 
        ref.hpp traits.hpp 
Log Message:
extended proto terminals can be stored by non-const-ref; unref(), arg() and 
friends respect constness

Index: expr.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/expr.hpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- expr.hpp    13 Feb 2007 08:25:32 -0000      1.21
+++ expr.hpp    13 Feb 2007 21:57:21 -0000      1.22
@@ -46,7 +46,7 @@
         /**/
 
     #define BOOST_PROTO_UNREF_ARG_TYPE(z, n, data)\
-        typename result_of::unref<typename Args::BOOST_PP_CAT(arg, 
n)>::reference\
+        typename result_of::unref<typename Args::BOOST_PP_CAT(arg, 
n)>::const_reference\
         /**/
 
     #define BOOST_PROTO_UNREF_ARG(z, n, data)\
@@ -127,34 +127,34 @@
             }
 
             template<typename A>
-            expr<tag::assign, args2<ref<expr>, typename 
result_of::as_arg<A>::type> > const
+            expr<tag::assign, args2<ref<expr const>, typename 
result_of::as_arg<A>::type> > const
             operator =(A &a) const
             {
-                expr<tag::assign, args2<ref<expr>, typename 
result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+                expr<tag::assign, args2<ref<expr const>, typename 
result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             template<typename A>
-            expr<tag::assign, args2<ref<expr>, typename result_of::as_arg<A 
const>::type> > const
+            expr<tag::assign, args2<ref<expr const>, typename 
result_of::as_arg<A const>::type> > const
             operator =(A const &a) const
             {
-                expr<tag::assign, args2<ref<expr>, typename 
result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+                expr<tag::assign, args2<ref<expr const>, typename 
result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             template<typename A>
-            expr<tag::subscript, args2<ref<expr>, typename 
result_of::as_arg<A>::type> > const
+            expr<tag::subscript, args2<ref<expr const>, typename 
result_of::as_arg<A>::type> > const
             operator [](A &a) const
             {
-                expr<tag::subscript, args2<ref<expr>, typename 
result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+                expr<tag::subscript, args2<ref<expr const>, typename 
result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             template<typename A>
-            expr<tag::subscript, args2<ref<expr>, typename result_of::as_arg<A 
const>::type> > const
+            expr<tag::subscript, args2<ref<expr const>, typename 
result_of::as_arg<A const>::type> > const
             operator [](A const &a) const
             {
-                expr<tag::subscript, args2<ref<expr>, typename 
result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+                expr<tag::subscript, args2<ref<expr const>, typename 
result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
@@ -164,13 +164,13 @@
             template<typename This>
             struct result<This()>
             {
-                typedef expr<tag::function, args1<ref<expr> > > type;
+                typedef expr<tag::function, args1<ref<expr const> > > type;
             };
 
-            expr<tag::function, args1<ref<expr> > > const
+            expr<tag::function, args1<ref<expr const> > > const
             operator ()() const
             {
-                expr<tag::function, args1<ref<expr> > > that = {{*this}};
+                expr<tag::function, args1<ref<expr const> > > that = {{*this}};
                 return that;
             }
 

Index: extends.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/extends.hpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- extends.hpp 13 Feb 2007 08:25:32 -0000      1.19
+++ extends.hpp 13 Feb 2007 21:57:21 -0000      1.20
@@ -53,37 +53,37 @@
         }
 
         template<typename A>
-        typename generate<Domain, expr<tag::assign, args2<ref<Derived>, 
typename result_of::as_arg<A>::type> > >::type const
+        typename generate<Domain, expr<tag::assign, args2<ref<Derived const>, 
typename result_of::as_arg<A>::type> > >::type const
         operator =(A &a) const
         {
-            typedef expr<tag::assign, args2<ref<Derived>, typename 
result_of::as_arg<A>::type> > that_type;
+            typedef expr<tag::assign, args2<ref<Derived const>, typename 
result_of::as_arg<A>::type> > that_type;
             that_type that = {{this->derived()}, proto::as_arg(a)};
             return generate<Domain, that_type>::make(that);
         }
 
         template<typename A>
-        typename generate<Domain, expr<tag::assign, args2<ref<Derived>, 
typename result_of::as_arg<A const>::type> > >::type const
+        typename generate<Domain, expr<tag::assign, args2<ref<Derived const>, 
typename result_of::as_arg<A const>::type> > >::type const
         operator =(A const &a) const
         {
-            typedef expr<tag::assign, args2<ref<Derived>, typename 
result_of::as_arg<A const>::type> > that_type;
+            typedef expr<tag::assign, args2<ref<Derived const>, typename 
result_of::as_arg<A const>::type> > that_type;
             that_type that = {{this->derived()}, proto::as_arg(a)};
             return generate<Domain, that_type>::make(that);
         }
 
         template<typename A>
-        typename generate<Domain, expr<tag::subscript, args2<ref<Derived>, 
typename result_of::as_arg<A>::type> > >::type const
+        typename generate<Domain, expr<tag::subscript, args2<ref<Derived 
const>, typename result_of::as_arg<A>::type> > >::type const
         operator [](A &a) const
         {
-            typedef expr<tag::subscript, args2<ref<Derived>, typename 
result_of::as_arg<A>::type> > that_type;
+            typedef expr<tag::subscript, args2<ref<Derived const>, typename 
result_of::as_arg<A>::type> > that_type;
             that_type that = {{this->derived()}, proto::as_arg(a)};
             return generate<Domain, that_type>::make(that);
         }
 
         template<typename A>
-        typename generate<Domain, expr<tag::subscript, args2<ref<Derived>, 
typename result_of::as_arg<A const>::type> > >::type const
+        typename generate<Domain, expr<tag::subscript, args2<ref<Derived 
const>, typename result_of::as_arg<A const>::type> > >::type const
         operator [](A const &a) const
         {
-            typedef expr<tag::subscript, args2<ref<Derived>, typename 
result_of::as_arg<A const>::type> > that_type;
+            typedef expr<tag::subscript, args2<ref<Derived const>, typename 
result_of::as_arg<A const>::type> > that_type;
             that_type that = {{this->derived()}, proto::as_arg(a)};
             return generate<Domain, that_type>::make(that);
         }
@@ -94,14 +94,16 @@
         template<typename This>
         struct result<This()>
         {
-            typedef typename generate<Domain, expr<tag::function, 
args1<ref<Derived> > > >::type type;
+            typedef typename generate<Domain, expr<tag::function, 
args1<ref<Derived const> > > >::type type;
         };
 
-        typename generate<Domain, expr<tag::function, args1<ref<Derived> > > 
>::type const
+        // BUGBUG Derived is incomplete here!
+        //typename generate<Domain, expr<tag::function, args1<ref<Derived 
const> > >, void >::type const
+        expr<tag::function, args1<ref<Derived const> > > const
         operator ()() const
         {
-            expr<tag::function, args1<ref<Derived> > > that = 
{{this->derived()}};
-            return generate<Domain, expr<tag::function, args1<ref<Derived> > > 
>::make(that);
+            expr<tag::function, args1<ref<Derived const> > > that = 
{{this->derived()}};
+            return generate<Domain, expr<tag::function, args1<ref<Derived 
const> > > >::make(that);
         }
 
     #define BOOST_PP_LOCAL_MACRO(N) \

Index: literal.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/literal.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- literal.hpp 3 Feb 2007 00:14:33 -0000       1.5
+++ literal.hpp 13 Feb 2007 21:57:21 -0000      1.6
@@ -43,12 +43,16 @@
         using extends<terminal_type, literal<T> >::operator =;
     };
 
+    /// lit
+    ///
     template<typename T>
     inline literal<T &> lit(T &t)
     {
         return literal<T &>(t);
     }
 
+    /// \overload
+    ///
     template<typename T>
     inline literal<T const &> lit(T const &t)
     {

Index: operators.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/operators.hpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- operators.hpp       13 Feb 2007 08:25:32 -0000      1.24
+++ operators.hpp       13 Feb 2007 21:57:21 -0000      1.25
@@ -45,14 +45,14 @@
               , expr<
                     Tag
                   , args2<
-                        ref<typename Left::boost_proto_expr_type_>
+                        ref<Left>
                       , typename generate<typename Left::domain, 
expr<tag::terminal, args1<Right &> > >::type
                     >
                 >
             >
         {
             typedef expr<tag::terminal, args1<Right &> > term_type;
-            typedef expr<Tag, args2<ref<typename 
Left::boost_proto_expr_type_>, typename generate<typename Left::domain, 
term_type>::type> > expr_type;
+            typedef expr<Tag, args2<ref<Left>, typename generate<typename 
Left::domain, term_type>::type> > expr_type;
 
             template<typename Left2>
             static typename generate<typename Left2::domain, expr_type>::type
@@ -72,13 +72,13 @@
                     Tag
                   , args2<
                         typename generate<typename Right::domain, 
expr<tag::terminal, args1<Left &> > >::type
-                      , ref<typename Right::boost_proto_expr_type_>
+                      , ref<Right>
                     >
                 >
             >
         {
             typedef expr<tag::terminal, args1<Left &> > term_type;
-            typedef expr<Tag, args2<typename generate<typename Right::domain, 
term_type>::type, ref<typename Right::boost_proto_expr_type_> > > expr_type;
+            typedef expr<Tag, args2<typename generate<typename Right::domain, 
term_type>::type, ref<Right> > > expr_type;
 
             template<typename Right2>
             static typename generate<typename Right2::domain, expr_type>::type
@@ -99,10 +99,10 @@
         struct as_expr_if<Tag, Left, Right, typename 
Left::is_boost_proto_expr_, typename Right::is_boost_proto_expr_>
           : generate<
                 typename Left::domain
-              , expr<Tag, args2<ref<typename Left::boost_proto_expr_type_>, 
ref<typename Right::boost_proto_expr_type_> > >
+              , expr<Tag, args2<ref<Left>, ref<Right> > >
             >
         {
-            typedef expr<Tag, args2<ref<typename 
Left::boost_proto_expr_type_>, ref<typename Right::boost_proto_expr_type_> > > 
expr_type;
+            typedef expr<Tag, args2<ref<Left>, ref<Right> > > expr_type;
             BOOST_MPL_ASSERT((is_same<typename Left::domain, typename 
Right::domain>));
 
             template<typename Left2>
@@ -118,11 +118,18 @@
 #define BOOST_PROTO_UNARY_OP(op, tag)\
     template<typename Arg>\
     inline typename generate<typename Arg::domain, expr<tag, 
args1<ref<typename Arg::boost_proto_expr_type_> > > >::type const\
-    operator op(Arg const &arg)\
+    operator op(Arg &arg)\
     {\
         expr<tag, args1<ref<typename Arg::boost_proto_expr_type_> > > that = 
{{arg}};\
         return generate<typename Arg::domain, expr<tag, args1<ref<typename 
Arg::boost_proto_expr_type_> > > >::make(that);\
     }\
+    template<typename Arg>\
+    inline typename generate<typename Arg::domain, expr<tag, 
args1<ref<typename Arg::boost_proto_expr_type_ const> > > >::type const\
+    operator op(Arg const &arg)\
+    {\
+        expr<tag, args1<ref<typename Arg::boost_proto_expr_type_ const> > > 
that = {{arg}};\
+        return generate<typename Arg::domain, expr<tag, args1<ref<typename 
Arg::boost_proto_expr_type_ const> > > >::make(that);\
+    }\
     /**/
 
 #define BOOST_PROTO_BINARY_OP(op, tag)\
@@ -195,20 +202,36 @@
 
     template<typename Arg>
     inline typename generate<typename Arg::domain, expr<tag::post_inc, 
args1<ref<typename Arg::boost_proto_expr_type_> > > >::type const
-    operator ++(Arg const &arg, int)
+    operator ++(Arg &arg, int)
     {
         expr<tag::post_inc, args1<ref<typename Arg::boost_proto_expr_type_> > 
> that = {{arg}};
         return generate<typename Arg::domain, expr<tag::post_inc, 
args1<ref<typename Arg::boost_proto_expr_type_> > > >::make(that);
     }
 
     template<typename Arg>
+    inline typename generate<typename Arg::domain, expr<tag::post_inc, 
args1<ref<typename Arg::boost_proto_expr_type_ const> > > >::type const
+    operator ++(Arg const &arg, int)
+    {
+        expr<tag::post_inc, args1<ref<typename Arg::boost_proto_expr_type_ 
const> > > that = {{arg}};
+        return generate<typename Arg::domain, expr<tag::post_inc, 
args1<ref<typename Arg::boost_proto_expr_type_ const> > > >::make(that);
+    }
+
+    template<typename Arg>
     inline typename generate<typename Arg::domain, expr<tag::post_dec, 
args1<ref<typename Arg::boost_proto_expr_type_> > > >::type const
-    operator --(Arg const &arg, int)
+    operator --(Arg &arg, int)
     {
         expr<tag::post_dec, args1<ref<typename Arg::boost_proto_expr_type_> > 
> that = {{arg}};
         return generate<typename Arg::domain, expr<tag::post_dec, 
args1<ref<typename Arg::boost_proto_expr_type_> > > >::make(that);
     }
 
+    template<typename Arg>
+    inline typename generate<typename Arg::domain, expr<tag::post_dec, 
args1<ref<typename Arg::boost_proto_expr_type_ const> > > >::type const
+    operator --(Arg const &arg, int)
+    {
+        expr<tag::post_dec, args1<ref<typename Arg::boost_proto_expr_type_ 
const> > > that = {{arg}};
+        return generate<typename Arg::domain, expr<tag::post_dec, 
args1<ref<typename Arg::boost_proto_expr_type_ const> > > >::make(that);
+    }
+
 #undef BOOST_PROTO_UNARY_OP
 #undef BOOST_PROTO_BINARY_OP
 

Index: proto_fwd.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/proto_fwd.hpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- proto_fwd.hpp       13 Feb 2007 08:25:32 -0000      1.50
+++ proto_fwd.hpp       13 Feb 2007 21:57:21 -0000      1.51
@@ -9,20 +9,36 @@
 #ifndef BOOST_PROTO_FWD_HPP_EAN_04_01_2005
 #define BOOST_PROTO_FWD_HPP_EAN_04_01_2005
 
+#include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
 #include <cstddef>
 #include <climits>
-#include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
 #include <boost/preprocessor/arithmetic/sub.hpp>
 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
 #include <boost/mpl/long.hpp>
 #include <boost/type_traits/remove_cv.hpp>
 #include <boost/type_traits/remove_reference.hpp>
-#include <boost/xpressive/proto/detail/suffix.hpp>
 
 #ifndef BOOST_PROTO_MAX_ARITY
 # define BOOST_PROTO_MAX_ARITY 5
 #endif
 
+#if BOOST_WORKAROUND(__GNUC__, == 3)
+# define BOOST_PROTO_BROKEN_CONST_OVERLOADS
+#endif
+
+#ifdef BOOST_PROTO_BROKEN_CONST_OVERLOADS
+# include <boost/utility/enable_if.hpp>
+# include <boost/type_traits/is_const.hpp>
+# define BOOST_PROTO_DISABLE_IF_IS_CONST(T)\
+    , typename boost::disable_if<boost::is_const<T> >::type * = 0
+#else
+# define BOOST_PROTO_DISABLE_IF_IS_CONST(T)
+#endif
+
+#include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+
 namespace boost { namespace proto
 {
     
///////////////////////////////////////////////////////////////////////////////

Index: ref.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/ref.hpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ref.hpp     3 Feb 2007 00:14:33 -0000       1.22
+++ ref.hpp     13 Feb 2007 21:57:21 -0000      1.23
@@ -44,7 +44,7 @@
             return this->expr.cast();
         }
 
-        Expr const &expr;
+        Expr &expr;
     };
 
     // ref-to-ref is not allowed. this will cause a compile error.
@@ -60,14 +60,16 @@
         struct unref
         {
             typedef T type;
-            typedef T const &reference;
+            typedef T &reference;
+            typedef T const &const_reference;
         };
 
         template<typename T>
         struct unref<ref<T> >
         {
-            typedef T type;
-            typedef T const &reference;
+            typedef typename T::boost_proto_expr_type_ type;
+            typedef T &reference;
+            typedef T &const_reference;
         };
 
         template<typename T>
@@ -75,6 +77,7 @@
         {
             typedef T type;
             typedef T &reference;
+            typedef T &const_reference;
         };
 
         template<typename T>
@@ -82,6 +85,7 @@
         {
             typedef T type;
             typedef T const &reference;
+            typedef T const &const_reference;
         };
 
         template<typename T, std::size_t N>
@@ -89,6 +93,7 @@
         {
             typedef T (&type)[N];
             typedef T (&reference)[N];
+            typedef T (&const_reference)[N];
         };
 
         template<typename T, std::size_t N>
@@ -96,6 +101,7 @@
         {
             typedef T const (&type)[N];
             typedef T const (&reference)[N];
+            typedef T const (&const_reference)[N];
         };
     }
 
@@ -124,13 +130,13 @@
             }
 
             template<typename T>
-            T const &operator()(ref<T> &t) const
+            T &operator()(ref<T> &t) const
             {
                 return t.expr;
             }
 
             template<typename T>
-            T const &operator()(ref<T> const &t) const
+            T &operator()(ref<T> const &t) const
             {
                 return t.expr;
             }

Index: traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/traits.hpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- traits.hpp  3 Feb 2007 18:00:46 -0000       1.40
+++ traits.hpp  13 Feb 2007 21:57:21 -0000      1.41
@@ -77,7 +77,12 @@
             template<typename T, typename EnableIf>
             struct as_expr
             {
-                typedef typename mpl::if_<mpl::or_<BOOST_PROTO_IS_ARRAY_(T), 
is_function<T> >, T &, T>::type arg0_type;
+                typedef typename mpl::if_<
+                    mpl::or_<BOOST_PROTO_IS_ARRAY_(T), is_function<T> >
+                  , T &
+                  , T
+                >::type arg0_type;
+
                 typedef expr<proto::tag::terminal, args1<arg0_type> > type;
 
                 typedef type result_type;
@@ -109,7 +114,7 @@
             template<typename T>
             struct as_arg<T, typename T::is_boost_proto_expr_>
             {
-                typedef ref<typename T::boost_proto_expr_type_> type;
+                typedef ref<T> type;
             };
 
             template<typename Expr, typename N>
@@ -267,7 +272,7 @@
     #define BOOST_PROTO_ARG_N_TYPE(z, n, data)\
         typename proto::result_of::unref<\
             typename Expr::BOOST_PP_CAT(BOOST_PP_CAT(arg, n), _type)\
-        >::reference\
+        >::const_reference\
         /**/
 
     #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, 
<boost/xpressive/proto/traits.hpp>))
@@ -339,7 +344,13 @@
                 {};
 
                 template<typename Expr>
-                typename result_of::arg_c<Expr, N>::reference operator()(Expr 
const &expr) const
+                typename result_of::arg_c<Expr, N>::reference operator()(Expr 
&expr) const
+                {
+                    return result_of::arg_c<Expr, N>::call(expr);
+                }
+
+                template<typename Expr>
+                typename result_of::arg_c<Expr, N>::const_reference 
operator()(Expr const &expr) const
                 {
                     return result_of::arg_c<Expr, N>::call(expr);
                 }
@@ -357,7 +368,13 @@
                 {};
 
                 template<typename Expr>
-                typename result_of::arg<Expr, N>::reference operator()(Expr 
const &expr) const
+                typename result_of::arg<Expr, N>::reference operator()(Expr 
&expr) const
+                {
+                    return result_of::arg<Expr, N>::call(expr);
+                }
+
+                template<typename Expr>
+                typename result_of::arg<Expr, N>::const_reference 
operator()(Expr const &expr) const
                 {
                     return result_of::arg<Expr, N>::call(expr);
                 }
@@ -374,9 +391,15 @@
                 {};
 
                 template<typename Expr>
-                typename result_of::left<Expr>::reference operator()(Expr 
const &expr) const
+                typename result_of::left<Expr>::reference operator()(Expr 
&expr) const
                 {
-                    return proto::unref(expr.cast().arg0);
+                    return proto::unref(expr.arg0);
+                }
+
+                template<typename Expr>
+                typename result_of::left<Expr>::const_reference 
operator()(Expr const &expr) const
+                {
+                    return proto::unref(expr.arg0);
                 }
             };
 
@@ -391,9 +414,15 @@
                 {};
 
                 template<typename Expr>
-                typename result_of::right<Expr>::reference operator()(Expr 
const &expr) const
+                typename result_of::right<Expr>::reference operator()(Expr 
&expr) const
                 {
-                    return proto::unref(expr.cast().arg1);
+                    return proto::unref(expr.arg1);
+                }
+
+                template<typename Expr>
+                typename result_of::right<Expr>::const_reference 
operator()(Expr const &expr) const
+                {
+                    return proto::unref(expr.arg1);
                 }
             };
 
@@ -404,21 +433,55 @@
         op::left const left = {};
         op::right const right = {};
 
+        /// arg
+        ///
         template<typename Expr>
         typename result_of::unref<typename Expr::type::arg0_type>::reference
+        arg(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+        {
+            return proto::unref(expr.arg0);
+        };
+
+        /// \overload
+        ///
+        template<typename Expr>
+        typename result_of::unref<typename 
Expr::type::arg0_type>::const_reference
         arg(Expr const &expr)
         {
-            return proto::unref(expr.cast().arg0);
+            return proto::unref(expr.arg0);
         };
 
+        /// \overload
+        ///
         template<typename N, typename Expr>
-        typename result_of::arg<Expr, N>::reference arg(Expr const &expr)
+        typename result_of::arg<Expr, N>::reference 
+        arg(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+        {
+            return result_of::arg<Expr, N>::call(expr);
+        };
+
+        /// \overload
+        ///
+        template<typename N, typename Expr>
+        typename result_of::arg<Expr, N>::const_reference 
+        arg(Expr const &expr)
         {
             return result_of::arg<Expr, N>::call(expr);
         };
 
+        /// arg_c
+        ///
+        template<long N, typename Expr>
+        typename result_of::arg_c<Expr, N>::reference
+        arg_c(Expr &expr BOOST_PROTO_DISABLE_IF_IS_CONST(Expr))
+        {
+            return result_of::arg_c<Expr, N>::call(expr);
+        };
+
+        /// \overload
+        ///
         template<long N, typename Expr>
-        typename result_of::arg_c<Expr, N>::reference arg_c(Expr const &expr)
+        typename result_of::arg_c<Expr, N>::const_reference arg_c(Expr const 
&expr)
         {
             return result_of::arg_c<Expr, N>::call(expr);
         };
@@ -483,11 +546,21 @@
             struct arg_c<Expr, N>
               : unref<typename Expr::BOOST_PP_CAT(BOOST_PP_CAT(arg, N), _type)>
             {
-                static typename arg_c::reference call(Expr const &expr)
+                static typename arg_c::reference call(Expr &expr)
                 {
-                    return proto::unref(expr.cast().BOOST_PP_CAT(arg, N));
+                    return proto::unref(expr.BOOST_PP_CAT(arg, N));
+                }
+
+                static typename arg_c::const_reference call(Expr const &expr)
+                {
+                    return proto::unref(expr.BOOST_PP_CAT(arg, N));
                 }
             };
+
+            template<typename Expr>
+            struct arg_c<Expr const, N>
+              : arg_c<Expr, N>
+            {};
         }
 
     #undef N


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