$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r62926 - trunk/boost/proto
From: eric_at_[hidden]
Date: 2010-06-13 22:47:10
Author: eric_niebler
Date: 2010-06-13 22:47:07 EDT (Sun, 13 Jun 2010)
New Revision: 62926
URL: http://svn.boost.org/trac/boost/changeset/62926
Log:
sigh, add back some ADL-blocker namespaces
Text files modified: 
   trunk/boost/proto/args.hpp      |    42 ++--                                    
   trunk/boost/proto/domain.hpp    |   370 ++++++++++++++++++++------------------- 
   trunk/boost/proto/proto_fwd.hpp |    46 +++-                                    
   trunk/boost/proto/traits.hpp    |    29 +-                                      
   4 files changed, 252 insertions(+), 235 deletions(-)
Modified: trunk/boost/proto/args.hpp
==============================================================================
--- trunk/boost/proto/args.hpp	(original)
+++ trunk/boost/proto/args.hpp	2010-06-13 22:47:07 EDT (Sun, 13 Jun 2010)
@@ -142,30 +142,32 @@
             typedef mpl::void_ BOOST_PP_CAT(child, n);                                              \
             /**< INTERNAL ONLY */
 
-        /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
-        ///
-        /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
-        /// The types in the sequence correspond to the children of a node in an expression tree.
-        template< typename Arg0 >
-        struct term
+        namespace argsns_
         {
-            BOOST_STATIC_CONSTANT(long, arity = 0);
-            typedef Arg0 child0;
-
-            #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
-            BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
-            #endif
-
-            /// INTERNAL ONLY
+            /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
             ///
-            typedef Arg0 back_;
-        };
-
-        #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/args.hpp>))
-        #include BOOST_PP_ITERATE()
+            /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
+            /// The types in the sequence correspond to the children of a node in an expression tree.
+            template< typename Arg0 >
+            struct term
+            {
+                BOOST_STATIC_CONSTANT(long, arity = 0);
+                typedef Arg0 child0;
+
+                #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
+                BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)
+                #endif
+
+                /// INTERNAL ONLY
+                ///
+                typedef Arg0 back_;
+            };
 
-        #undef BOOST_PROTO_DEFINE_CHILD_N
+            #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/args.hpp>))
+            #include BOOST_PP_ITERATE()
 
+            #undef BOOST_PROTO_DEFINE_CHILD_N
+        }
         ////////////////////////////////////////////////////////////////////////////////////////////
     }}
     #endif
Modified: trunk/boost/proto/domain.hpp
==============================================================================
--- trunk/boost/proto/domain.hpp	(original)
+++ trunk/boost/proto/domain.hpp	2010-06-13 22:47:07 EDT (Sun, 13 Jun 2010)
@@ -33,185 +33,208 @@
         {};
     }
 
-    /// \brief For use in defining domain tags to be used
-    /// with \c proto::extends\<\>. A \e Domain associates
-    /// an expression type with a \e Generator, and optionally
-    /// a \e Grammar.
-    ///
-    /// The Generator determines how new expressions in the
-    /// domain are constructed. Typically, a generator wraps
-    /// all new expressions in a wrapper that imparts
-    /// domain-specific behaviors to expressions within its
-    /// domain. (See \c proto::extends\<\>.)
-    ///
-    /// The Grammar determines whether a given expression is
-    /// valid within the domain, and automatically disables
-    /// any operator overloads which would cause an invalid
-    /// expression to be created. By default, the Grammar
-    /// parameter defaults to the wildcard, \c proto::_, which
-    /// makes all expressions valid within the domain.
-    ///
-    /// The Super declares the domain currently being defined
-    /// to be a sub-domain of Super. Expressions in sub-domains
-    /// can be freely combined with expressions in its super-
-    /// domain (and <I>its</I> super-domain, etc.).
-    ///
-    /// Example:
-    /// \code
-    /// template<typename Expr>
-    /// struct MyExpr;
-    ///
-    /// struct MyGrammar
-    ///   : or_< terminal<_>, plus<MyGrammar, MyGrammar> >
-    /// {};
-    ///
-    /// // Define MyDomain, in which all expressions are
-    /// // wrapped in MyExpr<> and only expressions that
-    /// // conform to MyGrammar are allowed.
-    /// struct MyDomain
-    ///   : domain<generator<MyExpr>, MyGrammar>
-    /// {};
-    ///
-    /// // Use MyDomain to define MyExpr
-    /// template<typename Expr>
-    /// struct MyExpr
-    ///   : extends<Expr, MyExpr<Expr>, MyDomain>
-    /// {
-    ///     // ...
-    /// };
-    /// \endcode
-    ///
-    template<
-        typename Generator // = default_generator
-      , typename Grammar   // = proto::_
-      , typename Super     // = no_super_domain
-    >
-    struct domain
-      : Generator
+    namespace domainns_
     {
-        typedef Generator proto_generator;
-        typedef Grammar   proto_grammar;
-        typedef Super     proto_super_domain;
-        typedef domain    proto_base_domain;
-
-        /// INTERNAL ONLY
-        typedef void proto_is_domain_;
-
-        /// \brief A unary MonomorphicFunctionObject that turns objects into Proto
-        /// expression objects in this domain.
-        ///
-        /// The <tt>as_expr\<\></tt> function object turns objects into Proto expressions, if
-        /// they are not already, by making them Proto terminals held by value if
-        /// possible. Objects that are already Proto expressions are left alone.
-        ///
-        /// If <tt>wants_basic_expr\<Generator\>::value</tt> is true, then let \c E be \c basic_expr;
-        /// otherwise, let \t E be \c expr. Given an lvalue \c t of type \c T:
-        ///
-        /// If \c T is not a Proto expression type the resulting terminal is
-        /// calculated as follows:
-        ///
-        ///   If \c T is a function type, an abstract type, or a type derived from
-        ///   \c std::ios_base, let \c A be <tt>T &</tt>.
-        ///   Otherwise, let \c A be the type \c T stripped of cv-qualifiers.
-        ///   Then, the result of applying <tt>as_expr\<T\>()(t)</tt> is
-        ///   <tt>Generator()(E\<tag::terminal, term\<A\> \>::make(t))</tt>.
-        ///
-        /// If \c T is a Proto expression type and its generator type is different from
-        /// \c Generator, the result is <tt>Generator()(t)</tt>.
-        ///
-        /// Otherwise, the result is \c t converted to an (un-const) rvalue.
-        ///
-        template<typename T, typename IsExpr = void, typename Callable = proto::callable>
-        struct as_expr
-          : detail::as_expr<
-                T
-              , typename detail::base_generator<Generator>::type
-              , wants_basic_expr<Generator>::value
-            >
+        /// \brief For use in defining domain tags to be used
+        /// with \c proto::extends\<\>. A \e Domain associates
+        /// an expression type with a \e Generator, and optionally
+        /// a \e Grammar.
+        ///
+        /// The Generator determines how new expressions in the
+        /// domain are constructed. Typically, a generator wraps
+        /// all new expressions in a wrapper that imparts
+        /// domain-specific behaviors to expressions within its
+        /// domain. (See \c proto::extends\<\>.)
+        ///
+        /// The Grammar determines whether a given expression is
+        /// valid within the domain, and automatically disables
+        /// any operator overloads which would cause an invalid
+        /// expression to be created. By default, the Grammar
+        /// parameter defaults to the wildcard, \c proto::_, which
+        /// makes all expressions valid within the domain.
+        ///
+        /// The Super declares the domain currently being defined
+        /// to be a sub-domain of Super. Expressions in sub-domains
+        /// can be freely combined with expressions in its super-
+        /// domain (and <I>its</I> super-domain, etc.).
+        ///
+        /// Example:
+        /// \code
+        /// template<typename Expr>
+        /// struct MyExpr;
+        ///
+        /// struct MyGrammar
+        ///   : or_< terminal<_>, plus<MyGrammar, MyGrammar> >
+        /// {};
+        ///
+        /// // Define MyDomain, in which all expressions are
+        /// // wrapped in MyExpr<> and only expressions that
+        /// // conform to MyGrammar are allowed.
+        /// struct MyDomain
+        ///   : domain<generator<MyExpr>, MyGrammar>
+        /// {};
+        ///
+        /// // Use MyDomain to define MyExpr
+        /// template<typename Expr>
+        /// struct MyExpr
+        ///   : extends<Expr, MyExpr<Expr>, MyDomain>
+        /// {
+        ///     // ...
+        /// };
+        /// \endcode
+        ///
+        template<
+            typename Generator // = default_generator
+          , typename Grammar   // = proto::_
+          , typename Super     // = no_super_domain
+        >
+        struct domain
+          : Generator
         {
-            BOOST_PROTO_CALLABLE()
+            typedef Generator proto_generator;
+            typedef Grammar   proto_grammar;
+            typedef Super     proto_super_domain;
+            typedef domain    proto_base_domain;
+
+            /// INTERNAL ONLY
+            typedef void proto_is_domain_;
+
+            /// \brief A unary MonomorphicFunctionObject that turns objects into Proto
+            /// expression objects in this domain.
+            ///
+            /// The <tt>as_expr\<\></tt> function object turns objects into Proto expressions, if
+            /// they are not already, by making them Proto terminals held by value if
+            /// possible. Objects that are already Proto expressions are left alone.
+            ///
+            /// If <tt>wants_basic_expr\<Generator\>::value</tt> is true, then let \c E be \c basic_expr;
+            /// otherwise, let \t E be \c expr. Given an lvalue \c t of type \c T:
+            ///
+            /// If \c T is not a Proto expression type the resulting terminal is
+            /// calculated as follows:
+            ///
+            ///   If \c T is a function type, an abstract type, or a type derived from
+            ///   \c std::ios_base, let \c A be <tt>T &</tt>.
+            ///   Otherwise, let \c A be the type \c T stripped of cv-qualifiers.
+            ///   Then, the result of applying <tt>as_expr\<T\>()(t)</tt> is
+            ///   <tt>Generator()(E\<tag::terminal, term\<A\> \>::make(t))</tt>.
+            ///
+            /// If \c T is a Proto expression type and its generator type is different from
+            /// \c Generator, the result is <tt>Generator()(t)</tt>.
+            ///
+            /// Otherwise, the result is \c t converted to an (un-const) rvalue.
+            ///
+            template<typename T, typename IsExpr = void, typename Callable = proto::callable>
+            struct as_expr
+              : detail::as_expr<
+                    T
+                  , typename detail::base_generator<Generator>::type
+                  , wants_basic_expr<Generator>::value
+                >
+            {
+                BOOST_PROTO_CALLABLE()
+            };
+
+            /// INTERNAL ONLY
+            ///
+            template<typename T>
+            struct as_expr<T, typename T::proto_is_expr_, proto::callable>
+              : detail::already_expr<
+                    T
+                  , typename detail::base_generator<Generator>::type
+                  , is_same<
+                        typename detail::base_generator<Generator>::type
+                      , typename detail::base_generator<typename T::proto_generator>::type
+                    >::value
+                >
+            {
+                BOOST_PROTO_CALLABLE()
+            };
+
+            /// \brief A unary MonomorphicFunctionObject that turns objects into Proto
+            /// expression objects in this domain.
+            ///
+            /// The <tt>as_child\<\></tt> function object turns objects into Proto expressions, if
+            /// they are not already, by making them Proto terminals held by reference.
+            /// Objects that are already Proto expressions are simply returned by reference.
+            ///
+            /// If <tt>wants_basic_expr\<Generator\>::value</tt> is true, then let \c E be \c basic_expr;
+            /// otherwise, let \t E be \c expr. Given an lvalue \c t of type \c T:
+            ///
+            /// If \c T is not a Proto expression type the resulting terminal is
+            /// <tt>Generator()(E\<tag::terminal, term\<T &\> \>::make(t))</tt>.
+            ///
+            /// If \c T is a Proto expression type and its generator type is different from
+            /// \c Generator, the result is <tt>Generator()(t)</tt>.
+            ///
+            /// Otherwise, the result is the lvalue \c t.
+            ///
+            template<typename T, typename IsExpr = void, typename Callable = proto::callable>
+            struct as_child
+              : detail::as_child<
+                    T
+                  , typename detail::base_generator<Generator>::type
+                  , wants_basic_expr<Generator>::value
+                >
+            {
+                BOOST_PROTO_CALLABLE()
+            };
+
+            /// INTERNAL ONLY
+            ///
+            template<typename T>
+            struct as_child<T, typename T::proto_is_expr_, proto::callable>
+              : detail::already_child<
+                    T
+                  , typename detail::base_generator<Generator>::type
+                  , is_same<
+                        typename detail::base_generator<Generator>::type
+                      , typename detail::base_generator<typename T::proto_generator>::type
+                    >::value
+                >
+            {
+                BOOST_PROTO_CALLABLE()
+            };
         };
 
-        /// INTERNAL ONLY
+        /// \brief The domain expressions have by default, if
+        /// \c proto::extends\<\> has not been used to associate
+        /// a domain with an expression.
         ///
-        template<typename T>
-        struct as_expr<T, typename T::proto_is_expr_, proto::callable>
-          : detail::already_expr<
-                T
-              , typename detail::base_generator<Generator>::type
-              , is_same<
-                    typename detail::base_generator<Generator>::type
-                  , typename detail::base_generator<typename T::proto_generator>::type
-                >::value
-            >
-        {
-            BOOST_PROTO_CALLABLE()
-        };
+        struct default_domain
+          : domain<>
+        {};
 
-        /// \brief A unary MonomorphicFunctionObject that turns objects into Proto
-        /// expression objects in this domain.
+        /// \brief A pseudo-domain for use in functions and
+        /// metafunctions that require a domain parameter. It
+        /// indicates that the domain of the parent node should
+        /// be inferred from the domains of the child nodes.
+        ///
+        /// \attention \c deduce_domain is not itself a valid domain.
         ///
-        /// The <tt>as_child\<\></tt> function object turns objects into Proto expressions, if
-        /// they are not already, by making them Proto terminals held by reference.
-        /// Objects that are already Proto expressions are simply returned by reference.
-        ///
-        /// If <tt>wants_basic_expr\<Generator\>::value</tt> is true, then let \c E be \c basic_expr;
-        /// otherwise, let \t E be \c expr. Given an lvalue \c t of type \c T:
-        ///
-        /// If \c T is not a Proto expression type the resulting terminal is
-        /// <tt>Generator()(E\<tag::terminal, term\<T &\> \>::make(t))</tt>.
-        ///
-        /// If \c T is a Proto expression type and its generator type is different from
-        /// \c Generator, the result is <tt>Generator()(t)</tt>.
-        ///
-        /// Otherwise, the result is the lvalue \c t.
-        ///
-        template<typename T, typename IsExpr = void, typename Callable = proto::callable>
-        struct as_child
-          : detail::as_child<
-                T
-              , typename detail::base_generator<Generator>::type
-              , wants_basic_expr<Generator>::value
-            >
+        struct deduce_domain
+          : domain<detail::not_a_generator, detail::not_a_grammar, detail::not_a_domain>
+        {};
+
+        /// \brief Given a domain, a tag type and an argument list,
+        /// compute the type of the expression to generate. This is
+        /// either an instance of \c proto::expr\<\> or
+        /// \c proto::basic_expr\<\>.
+        ///
+        template<typename Domain, typename Tag, typename Args, typename Void /*= void*/>
+        struct base_expr
         {
-            BOOST_PROTO_CALLABLE()
+            typedef proto::expr<Tag, Args, Args::arity> type;
         };
 
         /// INTERNAL ONLY
         ///
-        template<typename T>
-        struct as_child<T, typename T::proto_is_expr_, proto::callable>
-          : detail::already_child<
-                T
-              , typename detail::base_generator<Generator>::type
-              , is_same<
-                    typename detail::base_generator<Generator>::type
-                  , typename detail::base_generator<typename T::proto_generator>::type
-                >::value
-            >
+        template<typename Domain, typename Tag, typename Args>
+        struct base_expr<Domain, Tag, Args, typename Domain::proto_generator::proto_use_basic_expr_>
         {
-            BOOST_PROTO_CALLABLE()
+            typedef proto::basic_expr<Tag, Args, Args::arity> type;
         };
-    };
-
-    /// \brief The domain expressions have by default, if
-    /// \c proto::extends\<\> has not been used to associate
-    /// a domain with an expression.
-    ///
-    struct default_domain
-      : domain<>
-    {};
 
-    /// \brief A pseudo-domain for use in functions and
-    /// metafunctions that require a domain parameter. It
-    /// indicates that the domain of the parent node should
-    /// be inferred from the domains of the child nodes.
-    ///
-    /// \attention \c deduce_domain is not itself a valid domain.
-    ///
-    struct deduce_domain
-      : domain<detail::not_a_generator, detail::not_a_grammar, detail::not_a_domain>
-    {};
+    }
 
     /// A metafunction that returns \c mpl::true_
     /// if the type \c T is the type of a Proto domain;
@@ -273,25 +296,6 @@
         typedef typename domain_of<T>::type type;
     };
 
-    /// \brief Given a domain, a tag type and an argument list,
-    /// compute the type of the expression to generate. This is
-    /// either an instance of \c proto::expr\<\> or
-    /// \c proto::basic_expr\<\>.
-    ///
-    template<typename Domain, typename Tag, typename Args, typename Void /*= void*/>
-    struct base_expr
-    {
-        typedef proto::expr<Tag, Args, Args::arity> type;
-    };
-
-    /// INTERNAL ONLY
-    ///
-    template<typename Domain, typename Tag, typename Args>
-    struct base_expr<Domain, Tag, Args, typename Domain::proto_generator::proto_use_basic_expr_>
-    {
-        typedef proto::basic_expr<Tag, Args, Args::arity> type;
-    };
-
 }}
 
 #endif
Modified: trunk/boost/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/proto/proto_fwd.hpp	(original)
+++ trunk/boost/proto/proto_fwd.hpp	2010-06-13 22:47:07 EDT (Sun, 13 Jun 2010)
@@ -166,14 +166,19 @@
 
     typedef detail::ignore const ignore;
 
-    template<typename Arg0>
-    struct term;
+    namespace argsns_
+    {
+        template<typename Arg0>
+        struct term;
 
-    #define M0(Z, N, DATA)                                                                      \
-    template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename Arg)> struct BOOST_PP_CAT(list, N);          \
-    /**/
-    BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), M0, ~)
-    #undef M0
+        #define M0(Z, N, DATA)                                                                      \
+        template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename Arg)> struct BOOST_PP_CAT(list, N);          \
+        /**/
+        BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), M0, ~)
+        #undef M0
+    }
+
+    using namespace argsns_;
 
     ///////////////////////////////////////////////////////////////////////////////
     // Operator tags
@@ -258,21 +263,26 @@
     struct use_basic_expr;
 
     ////////////////////////////////////////////////////////////////////////////////////////////////
-    typedef detail::not_a_domain no_super_domain;
+    namespace domainns_
+    {
+        typedef detail::not_a_domain no_super_domain;
 
-    template<
-        typename Generator  = default_generator
-      , typename Grammar    = proto::_
-      , typename Super      = no_super_domain
-    >
-    struct domain;
+        template<
+            typename Generator  = default_generator
+          , typename Grammar    = proto::_
+          , typename Super      = no_super_domain
+        >
+        struct domain;
 
-    struct default_domain;
+        struct default_domain;
 
-    struct deduce_domain;
+        struct deduce_domain;
+
+        template<typename Domain, typename Tag, typename Args, typename Void = void>
+        struct base_expr;
+    }
 
-    template<typename Domain, typename Tag, typename Args, typename Void = void>
-    struct base_expr;
+    using namespace domainns_;
 
     ////////////////////////////////////////////////////////////////////////////////////////////////
     namespace exprns_
Modified: trunk/boost/proto/traits.hpp
==============================================================================
--- trunk/boost/proto/traits.hpp	(original)
+++ trunk/boost/proto/traits.hpp	2010-06-13 22:47:07 EDT (Sun, 13 Jun 2010)
@@ -28,6 +28,7 @@
     #include <boost/mpl/aux_/lambda_arity_param.hpp>
     #include <boost/type_traits/is_pod.hpp>
     #include <boost/type_traits/is_same.hpp>
+    #include <boost/type_traits/add_const.hpp>
     #include <boost/proto/proto_fwd.hpp>
     #include <boost/proto/args.hpp>
     #include <boost/proto/domain.hpp>
@@ -630,7 +631,7 @@
                 /// \param t The object to wrap.
                 /// \return <tt>proto::as_expr\<Domain\>(t)</tt>
                 template<typename T>
-                typename result<as_expr(T &)>::type
+                typename add_const<typename result<as_expr(T &)>::type>::type
                 operator ()(T &t) const
                 {
                     return typename Domain::template as_expr<T>()(t);
@@ -639,7 +640,7 @@
                 /// \overload
                 ///
                 template<typename T>
-                typename result<as_expr(T const &)>::type
+                typename add_const<typename result<as_expr(T const &)>::type>::type
                 operator ()(T const &t) const
                 {
                     return typename Domain::template as_expr<T const>()(t);
@@ -647,14 +648,14 @@
 
                 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
                 template<typename T, std::size_t N_>
-                typename result<as_expr(T (&)[N_])>::type
+                typename add_const<typename result<as_expr(T (&)[N_])>::type>::type
                 operator ()(T (&t)[N_]) const
                 {
                     return typename Domain::template as_expr<T[N_]>()(t);
                 }
 
                 template<typename T, std::size_t N_>
-                typename result<as_expr(T const (&)[N_])>::type
+                typename add_const<typename result<as_expr(T const (&)[N_])>::type>::type
                 operator ()(T const (&t)[N_]) const
                 {
                     return typename Domain::template as_expr<T const[N_]>()(t);
@@ -689,7 +690,7 @@
                 /// \param t The object to wrap.
                 /// \return <tt>proto::as_child\<Domain\>(t)</tt>
                 template<typename T>
-                typename result<as_child(T &)>::type
+                typename add_const<typename result<as_child(T &)>::type>::type
                 operator ()(T &t) const
                 {
                     return typename Domain::template as_child<T>()(t);
@@ -698,7 +699,7 @@
                 /// \overload
                 ///
                 template<typename T>
-                typename result<as_child(T const &)>::type
+                typename add_const<typename result<as_child(T const &)>::type>::type
                 operator ()(T const &t) const
                 {
                     return typename Domain::template as_child<T const>()(t);
@@ -923,7 +924,7 @@
         ///
         /// \param t The object to wrap.
         template<typename T>
-        typename result_of::as_expr<T, default_domain>::type
+        typename add_const<typename result_of::as_expr<T, default_domain>::type>::type
         as_expr(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T) BOOST_PROTO_DISABLE_IF_IS_FUNCTION(T))
         {
             return default_domain::as_expr<T>()(t);
@@ -932,7 +933,7 @@
         /// \overload
         ///
         template<typename T>
-        typename result_of::as_expr<T const, default_domain>::type
+        typename add_const<typename result_of::as_expr<T const, default_domain>::type>::type
         as_expr(T const &t)
         {
             return default_domain::as_expr<T const>()(t);
@@ -941,7 +942,7 @@
         /// \overload
         ///
         template<typename Domain, typename T>
-        typename result_of::as_expr<T, Domain>::type
+        typename add_const<typename result_of::as_expr<T, Domain>::type>::type
         as_expr(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T) BOOST_PROTO_DISABLE_IF_IS_FUNCTION(T))
         {
             return typename Domain::template as_expr<T>()(t);
@@ -950,7 +951,7 @@
         /// \overload
         ///
         template<typename Domain, typename T>
-        typename result_of::as_expr<T const, Domain>::type
+        typename add_const<typename result_of::as_expr<T const, Domain>::type>::type
         as_expr(T const &t)
         {
             return typename Domain::template as_expr<T const>()(t);
@@ -976,7 +977,7 @@
         ///
         /// \param t The object to wrap.
         template<typename T>
-        typename result_of::as_child<T, default_domain>::type
+        typename add_const<typename result_of::as_child<T, default_domain>::type>::type
         as_child(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T) BOOST_PROTO_DISABLE_IF_IS_FUNCTION(T))
         {
             return default_domain::as_child<T>()(t);
@@ -985,7 +986,7 @@
         /// \overload
         ///
         template<typename T>
-        typename result_of::as_child<T const, default_domain>::type
+        typename add_const<typename result_of::as_child<T const, default_domain>::type>::type
         as_child(T const &t)
         {
             return default_domain::as_child<T const>()(t);
@@ -994,7 +995,7 @@
         /// \overload
         ///
         template<typename Domain, typename T>
-        typename result_of::as_child<T, Domain>::type
+        typename add_const<typename result_of::as_child<T, Domain>::type>::type
         as_child(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T) BOOST_PROTO_DISABLE_IF_IS_FUNCTION(T))
         {
             return typename Domain::template as_child<T>()(t);
@@ -1003,7 +1004,7 @@
         /// \overload
         ///
         template<typename Domain, typename T>
-        typename result_of::as_child<T const, Domain>::type
+        typename add_const<typename result_of::as_child<T const, Domain>::type>::type
         as_child(T const &t)
         {
             return typename Domain::template as_child<T const>()(t);