Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-04-06 17:35:00


Author: eric_niebler
Date: 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
New Revision: 44084
URL: http://svn.boost.org/trac/boost/changeset/44084

Log:
another attempt at rvalue/lvalue handling in proto transforms
Text files modified:
   branches/proto/v4/boost/proto/detail/as_lvalue.hpp | 28 ++++++++--
   branches/proto/v4/boost/proto/make_expr.hpp | 45 +++++++++++++++++
   branches/proto/v4/boost/proto/proto_fwd.hpp | 105 ++++++++++++++++++++-------------------
   branches/proto/v4/boost/proto/traits.hpp | 35 +++---------
   branches/proto/v4/boost/proto/transform/arg.hpp | 52 +++++++++++++++++++
   branches/proto/v4/boost/proto/transform/call.hpp | 32 ++++-------
   branches/proto/v4/libs/proto/test/examples.cpp | 7 ++
   branches/proto/v4/libs/proto/test/make_expr.cpp | 16 +++--
   8 files changed, 208 insertions(+), 112 deletions(-)

Modified: branches/proto/v4/boost/proto/detail/as_lvalue.hpp
==============================================================================
--- branches/proto/v4/boost/proto/detail/as_lvalue.hpp (original)
+++ branches/proto/v4/boost/proto/detail/as_lvalue.hpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 /// \file as_lvalue.hpp
-/// Contains definition the as_lvalue() and as_nonconst_lvalue() functions.
+/// Contains definition the as_lvalue() functions.
 //
 // Copyright 2008 Eric Niebler. Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
@@ -9,26 +9,42 @@
 #ifndef BOOST_PROTO_TRANSFORM_AS_LVALUE_HPP_EAN_12_27_2007
 #define BOOST_PROTO_TRANSFORM_AS_LVALUE_HPP_EAN_12_27_2007
 
+#include <boost/proto/detail/prefix.hpp>
+#include <boost/proto/proto_fwd.hpp>
+#include <boost/proto/detail/suffix.hpp>
+
 namespace boost { namespace proto
 {
     namespace detail
     {
+ struct int_
+ {
+ int_() {}
+ int_(int) {}
+ };
+
         template<typename T>
- T &as_lvalue(T &t)
+ T &as_lvalue(T &t, int = 0)
         {
             return t;
         }
 
         template<typename T>
- T const &as_lvalue(T const &t)
+ T const &as_lvalue(T const &t, int = 0)
         {
             return t;
         }
 
- template<typename T>
- T &as_nonconst_lvalue(T const &t)
+ template<typename Ret, typename T>
+ Ret as_lvalue(T &t, int_ = int_() BOOST_PROTO_DISABLE_IF_IS_CONST(T))
+ {
+ return t;
+ }
+
+ template<typename Ret, typename T>
+ Ret as_lvalue(T const &t, int_ = int_())
         {
- return const_cast<T &>(t);
+ return t;
         }
     }
 }}

Modified: branches/proto/v4/boost/proto/make_expr.hpp
==============================================================================
--- branches/proto/v4/boost/proto/make_expr.hpp (original)
+++ branches/proto/v4/boost/proto/make_expr.hpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -940,6 +940,36 @@
           : mpl::true_
         {};
 
+ template<typename Tag, typename Domain BOOST_PROTO_WHEN_BUILDING_DOCS(= deduce_domain)>
+ struct _make_expr : callable
+ {
+ template<typename Sig>
+ struct result
+ : functor::make_expr<Tag, Domain>::template result<Sig>
+ {};
+
+ #define M0(Z, N, DATA) \
+ template<BOOST_PP_ENUM_PARAMS_Z(Z, N, typename A)> \
+ BOOST_PP_CAT(detail::implicit_expr_, N)<BOOST_PP_ENUM_PARAMS_Z(Z, N, A)> \
+ operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, &a)) const \
+ { \
+ BOOST_PP_CAT(detail::implicit_expr_, N)<BOOST_PP_ENUM_PARAMS_Z(Z, N, A)> that = { \
+ BOOST_PP_ENUM_PARAMS_Z(Z, N, a) \
+ }; \
+ return that; \
+ } \
+ /**/
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), M0, ~)
+ #undef M0
+ };
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Tag, typename Domain>
+ struct is_callable<_make_expr<Tag, Domain> >
+ : mpl::true_
+ {};
+
     }}
 
     #undef BOOST_PROTO_AT
@@ -954,6 +984,21 @@
     #define N BOOST_PP_ITERATION()
     #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
 
+ template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ struct BOOST_PP_CAT(implicit_expr_, N)
+ {
+ #define M0(Z, N, DATA) BOOST_PP_CAT(A, N) &BOOST_PP_CAT(a, N);
+ BOOST_PP_REPEAT(N, M0, ~)
+ #undef M0
+
+ template<typename Expr>
+ operator Expr() const
+ {
+ typename Expr::proto_base_expr that = {BOOST_PP_ENUM_PARAMS(N, a)};
+ return typename Expr::proto_domain()(that);
+ }
+ };
+
         template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, typename T)>
         struct select_nth<BOOST_PP_DEC(N), BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, T)>
         {

Modified: branches/proto/v4/boost/proto/proto_fwd.hpp
==============================================================================
--- branches/proto/v4/boost/proto/proto_fwd.hpp (original)
+++ branches/proto/v4/boost/proto/proto_fwd.hpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -581,7 +581,7 @@
         struct unfused_expr;
 
         typedef make_expr<tag::terminal> make_terminal;
- typedef make_expr<tag::unary_plus> make_posit;
+ typedef make_expr<tag::unary_plus> make_unary_plus;
         typedef make_expr<tag::negate> make_negate;
         typedef make_expr<tag::dereference> make_dereference;
         typedef make_expr<tag::complement> make_complement;
@@ -631,58 +631,61 @@
         struct reverse;
     }
 
- typedef functor::make_terminal _make_terminal;
- typedef functor::make_posit _make_posit;
- typedef functor::make_negate _make_negate;
- typedef functor::make_dereference _make_dereference;
- typedef functor::make_complement _make_complement;
- typedef functor::make_address_of _make_address_of;
- typedef functor::make_logical_not _make_logical_not;
- typedef functor::make_pre_inc _make_pre_inc;
- typedef functor::make_pre_dec _make_pre_dec;
- typedef functor::make_post_inc _make_post_inc;
- typedef functor::make_post_dec _make_post_dec;
- typedef functor::make_shift_left _make_shift_left;
- typedef functor::make_shift_right _make_shift_right;
- typedef functor::make_multiplies _make_multiplies;
- typedef functor::make_divides _make_divides;
- typedef functor::make_modulus _make_modulus;
- typedef functor::make_plus _make_plus;
- typedef functor::make_minus _make_minus;
- typedef functor::make_less _make_less;
- typedef functor::make_greater _make_greater;
- typedef functor::make_less_equal _make_less_equal;
- typedef functor::make_greater_equal _make_greater_equal;
- typedef functor::make_equal_to _make_equal_to;
- typedef functor::make_not_equal_to _make_not_equal_to;
- typedef functor::make_logical_or _make_logical_or;
- typedef functor::make_logical_and _make_logical_and;
- typedef functor::make_bitwise_and _make_bitwise_and;
- typedef functor::make_bitwise_or _make_bitwise_or;
- typedef functor::make_bitwise_xor _make_bitwise_xor;
- typedef functor::make_comma _make_comma;
- typedef functor::make_mem_ptr _make_mem_ptr;
- typedef functor::make_assign _make_assign;
- typedef functor::make_shift_left_assign _make_shift_left_assign;
- typedef functor::make_shift_right_assign _make_shift_right_assign;
- typedef functor::make_multiplies_assign _make_multiplies_assign;
- typedef functor::make_divides_assign _make_divides_assign;
- typedef functor::make_modulus_assign _make_modulus_assign;
- typedef functor::make_plus_assign _make_plus_assign;
- typedef functor::make_minus_assign _make_minus_assign;
- typedef functor::make_bitwise_and_assign _make_bitwise_and_assign;
- typedef functor::make_bitwise_or_assign _make_bitwise_or_assign;
- typedef functor::make_bitwise_xor_assign _make_bitwise_xor_assign;
- typedef functor::make_subscript _make_subscript;
- typedef functor::make_if_else _make_if_else;
- typedef functor::make_function _make_function;
-
     typedef functor::flatten _flatten;
     typedef functor::pop_front _pop_front;
     typedef functor::reverse _reverse;
     typedef functor::eval _eval;
     typedef functor::deep_copy _deep_copy;
 
+ template<typename Tag, typename Domain = deduce_domain>
+ struct _make_expr;
+
+ typedef _make_expr<tag::terminal> _make_terminal;
+ typedef _make_expr<tag::unary_plus> _make_unary_plus;
+ typedef _make_expr<tag::negate> _make_negate;
+ typedef _make_expr<tag::dereference> _make_dereference;
+ typedef _make_expr<tag::complement> _make_complement;
+ typedef _make_expr<tag::address_of> _make_address_of;
+ typedef _make_expr<tag::logical_not> _make_logical_not;
+ typedef _make_expr<tag::pre_inc> _make_pre_inc;
+ typedef _make_expr<tag::pre_dec> _make_pre_dec;
+ typedef _make_expr<tag::post_inc> _make_post_inc;
+ typedef _make_expr<tag::post_dec> _make_post_dec;
+ typedef _make_expr<tag::shift_left> _make_shift_left;
+ typedef _make_expr<tag::shift_right> _make_shift_right;
+ typedef _make_expr<tag::multiplies> _make_multiplies;
+ typedef _make_expr<tag::divides> _make_divides;
+ typedef _make_expr<tag::modulus> _make_modulus;
+ typedef _make_expr<tag::plus> _make_plus;
+ typedef _make_expr<tag::minus> _make_minus;
+ typedef _make_expr<tag::less> _make_less;
+ typedef _make_expr<tag::greater> _make_greater;
+ typedef _make_expr<tag::less_equal> _make_less_equal;
+ typedef _make_expr<tag::greater_equal> _make_greater_equal;
+ typedef _make_expr<tag::equal_to> _make_equal_to;
+ typedef _make_expr<tag::not_equal_to> _make_not_equal_to;
+ typedef _make_expr<tag::logical_or> _make_logical_or;
+ typedef _make_expr<tag::logical_and> _make_logical_and;
+ typedef _make_expr<tag::bitwise_and> _make_bitwise_and;
+ typedef _make_expr<tag::bitwise_or> _make_bitwise_or;
+ typedef _make_expr<tag::bitwise_xor> _make_bitwise_xor;
+ typedef _make_expr<tag::comma> _make_comma;
+ typedef _make_expr<tag::mem_ptr> _make_mem_ptr;
+ typedef _make_expr<tag::assign> _make_assign;
+ typedef _make_expr<tag::shift_left_assign> _make_shift_left_assign;
+ typedef _make_expr<tag::shift_right_assign> _make_shift_right_assign;
+ typedef _make_expr<tag::multiplies_assign> _make_multiplies_assign;
+ typedef _make_expr<tag::divides_assign> _make_divides_assign;
+ typedef _make_expr<tag::modulus_assign> _make_modulus_assign;
+ typedef _make_expr<tag::plus_assign> _make_plus_assign;
+ typedef _make_expr<tag::minus_assign> _make_minus_assign;
+ typedef _make_expr<tag::bitwise_and_assign> _make_bitwise_and_assign;
+ typedef _make_expr<tag::bitwise_or_assign> _make_bitwise_or_assign;
+ typedef _make_expr<tag::bitwise_xor_assign> _make_bitwise_xor_assign;
+ typedef _make_expr<tag::subscript> _make_subscript;
+ typedef _make_expr<tag::if_else_> _make_if_else;
+ typedef _make_expr<tag::function> _make_function;
+
     template<typename T>
     struct is_callable;
 
@@ -739,23 +742,23 @@
 
     typedef _child_c<0> _child0;
     typedef _child_c<1> _child1;
- typedef _child_c<2> _child2;
     typedef _child0 _child;
     typedef _child0 _value;
     typedef _child0 _left;
     typedef _child1 _right;
 
- // child3, child4, child5, ...
+ // _child2, _child3, _child4, ...
     #define M0(Z, N, DATA) typedef _child_c<N> BOOST_PP_CAT(_child, N);
     BOOST_PP_REPEAT_FROM_TO(
- 3
+ 2
       , BOOST_PP_DEC(BOOST_PROTO_MAX_ARITY)
       , M0
       , ~
     )
     #undef M0
 
- struct _ref;
+ struct _byref;
+ struct _byval;
 
     template<typename T>
     struct is_extension;

Modified: branches/proto/v4/boost/proto/traits.hpp
==============================================================================
--- branches/proto/v4/boost/proto/traits.hpp (original)
+++ branches/proto/v4/boost/proto/traits.hpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -1511,10 +1511,6 @@
         typedef BOOST_PP_CAT(DATA, N) BOOST_PP_CAT(proto_child, N); \
         /**/
 
- #define BOOST_PROTO_IMPLICIT_ARG(Z, N, DATA) \
- BOOST_PP_CAT(DATA, N) &BOOST_PP_CAT(a, N); \
- /**/
-
     #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/traits.hpp>))
     #include BOOST_PP_ITERATE()
 
@@ -2186,19 +2182,6 @@
 
         namespace detail
         {
- template<BOOST_PP_ENUM_PARAMS(N, typename A)>
- struct BOOST_PP_CAT(implicit_expr_, N)
- {
- BOOST_PP_REPEAT(N, BOOST_PROTO_IMPLICIT_ARG, A)
-
- template<typename Tag, typename Args, long Arity>
- operator proto::expr<Tag, Args, Arity> () const
- {
- proto::expr<Tag, Args, Arity> that = {BOOST_PP_ENUM_PARAMS(N, a)};
- return that;
- }
- };
-
             template<
                 template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class T
               , BOOST_PP_ENUM_PARAMS(N, typename A)
@@ -2208,15 +2191,15 @@
             {};
         }
 
- /// INTERNAL ONLY
- template<BOOST_PP_ENUM_PARAMS(N, typename A)>
- detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)>
- implicit_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a))
- {
- detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)> that
- = {BOOST_PP_ENUM_PARAMS(N, a)};
- return that;
- }
+ ///// INTERNAL ONLY
+ //template<BOOST_PP_ENUM_PARAMS(N, typename A)>
+ //detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)>
+ //implicit_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a))
+ //{
+ // detail::BOOST_PP_CAT(implicit_expr_, N)<BOOST_PP_ENUM_PARAMS(N, A)> that
+ // = {BOOST_PP_ENUM_PARAMS(N, a)};
+ // return that;
+ //}
 
     #endif
 

Modified: branches/proto/v4/boost/proto/transform/arg.hpp
==============================================================================
--- branches/proto/v4/boost/proto/transform/arg.hpp (original)
+++ branches/proto/v4/boost/proto/transform/arg.hpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -116,7 +116,7 @@
 
     /// \brief A unary CallableTransform that wraps its argument
     /// in a \c boost::reference_wrapper\<\>.
- struct _ref : callable
+ struct _byref : callable
     {
         template<typename Sig>
         struct result;
@@ -151,6 +151,47 @@
         }
     };
 
+ /// \brief A unary CallableTransform that strips references
+ /// from its argument.
+ struct _byval : callable
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename T>
+ struct result<This(T)>
+ {
+ typedef T type;
+ };
+
+ template<typename This, typename T>
+ struct result<This(T &)>
+ : result<This(T)>
+ {};
+
+ template<typename This, typename T>
+ struct result<This(boost::reference_wrapper<T>)>
+ : result<This(T)>
+ {};
+
+ /// \param t The object to unref
+ /// \return <tt>t</tt>
+ /// \throw nothrow
+ template<typename T>
+ T const &operator ()(T const &t) const
+ {
+ return t;
+ }
+
+ /// \overload
+ ///
+ template<typename T>
+ T &operator ()(boost::reference_wrapper<T> const &t) const
+ {
+ return t;
+ }
+ };
+
     /// INTERNAL ONLY
     ///
     template<>
@@ -182,7 +223,14 @@
     /// INTERNAL ONLY
     ///
     template<>
- struct is_callable<_ref>
+ struct is_callable<_byref>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<_byval>
       : mpl::true_
     {};
 

Modified: branches/proto/v4/boost/proto/transform/call.hpp
==============================================================================
--- branches/proto/v4/boost/proto/transform/call.hpp (original)
+++ branches/proto/v4/boost/proto/transform/call.hpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -28,8 +28,6 @@
     #include <boost/proto/detail/as_lvalue.hpp>
     #include <boost/proto/detail/suffix.hpp>
 
- #define UNCVREF BOOST_PROTO_UNCVREF
-
     namespace boost { namespace proto
     {
         /// \brief Wrap \c PrimitiveTransform so that <tt>when\<\></tt> knows
@@ -144,7 +142,7 @@
               : transform_impl<Expr, State, Data>
             {
                 typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename boost::result_of<Fun(UNCVREF(a0))>::type result_type;
+ typedef typename boost::result_of<Fun(a0)>::type result_type;
                 result_type operator ()(
                     typename impl2::expr_param expr
                   , typename impl2::state_param state
@@ -152,8 +150,7 @@
                 ) const
                 {
                     return Fun()(
- typename when<_, A0>
- ::template impl<Expr, State, Data>()(expr, state, data)
+ detail::as_lvalue<a0>(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data), 0)
                     );
                 }
             };
@@ -215,7 +212,7 @@
             {
                 typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
                 typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
- typedef typename boost::result_of<Fun(UNCVREF(a0), UNCVREF(a1))>::type result_type;
+ typedef typename boost::result_of<Fun(a0, a1)>::type result_type;
                 result_type operator ()(
                     typename impl2::expr_param expr
                   , typename impl2::state_param state
@@ -223,8 +220,8 @@
                 ) const
                 {
                     return Fun()(
- typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data)
- , typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data)
+ detail::as_lvalue<a0>(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data), 0)
+ , detail::as_lvalue<a1>(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data), 0)
                     );
                 }
             };
@@ -295,7 +292,7 @@
                 typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
                 typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
                 typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;
- typedef typename boost::result_of<Fun(UNCVREF(a0), UNCVREF(a1), UNCVREF(a2))>::type result_type;
+ typedef typename boost::result_of<Fun(a0, a1, a2)>::type result_type;
                 result_type operator ()(
                     typename impl2::expr_param expr
                   , typename impl2::state_param state
@@ -303,9 +300,9 @@
                 ) const
                 {
                     return Fun()(
- typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data)
- , typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data)
- , typename when<_, A2>::template impl<Expr, State, Data>()(expr, state, data)
+ detail::as_lvalue<a0>(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data), 0)
+ , detail::as_lvalue<a1>(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data), 0)
+ , detail::as_lvalue<a2>(typename when<_, A2>::template impl<Expr, State, Data>()(expr, state, data), 0)
                     );
                 }
             };
@@ -361,8 +358,6 @@
 
     }} // namespace boost::proto
 
- #undef UNCVREF
-
     #endif
 
 #else
@@ -389,9 +384,7 @@
                 #undef M0
 
                 typedef
- typename boost::result_of<
- Fun(BOOST_PP_ENUM_BINARY_PARAMS(N, typename detail::uncvref<a, >::type BOOST_PP_INTERCEPT))
- >::type
+ typename boost::result_of<Fun(BOOST_PP_ENUM_PARAMS(N, a))>::type
                 result_type;
 
                 /// Let \c ax be <tt>when\<_, Ax\>()(expr, state, data)</tt>
@@ -408,8 +401,9 @@
                 ) const
                 {
                     #define M0(Z, M, DATA) \
- typename when<_, BOOST_PP_CAT(A, M)> \
- ::template impl<Expr, State, Data>()(expr, state, data) \
+ detail::as_lvalue<BOOST_PP_CAT(a, M)>( \
+ typename when<_, BOOST_PP_CAT(A, M)> \
+ ::template impl<Expr, State, Data>()(expr, state, data), 0) \
                     return Fun()(BOOST_PP_ENUM(N, M0, ~));
                     #undef M0
                 }

Modified: branches/proto/v4/libs/proto/test/examples.cpp
==============================================================================
--- branches/proto/v4/libs/proto/test/examples.cpp (original)
+++ branches/proto/v4/libs/proto/test/examples.cpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -291,7 +291,12 @@
         template<typename This, typename First, typename Second>
         struct result<This(First, Second)>
         {
- typedef std::pair<First, Second> type;
+ typedef
+ std::pair<
+ BOOST_PROTO_UNCVREF(First)
+ , BOOST_PROTO_UNCVREF(Second)
+ >
+ type;
         };
 
         template<typename First, typename Second>

Modified: branches/proto/v4/libs/proto/test/make_expr.cpp
==============================================================================
--- branches/proto/v4/libs/proto/test/make_expr.cpp (original)
+++ branches/proto/v4/libs/proto/test/make_expr.cpp 2008-04-06 17:34:59 EDT (Sun, 06 Apr 2008)
@@ -150,14 +150,15 @@
 }
 
 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
-#define _ref(x) call<_ref(x)>
+#define _byref(x) call<_byref(x)>
+#define _byval(x) call<_byval(x)>
 #define Minus(x) call<Minus(x)>
 #endif
 
 // Turn all terminals held by reference into ones held by value
 struct ByVal
   : or_<
- when<terminal<_>, _make_terminal(_value)>
+ when<terminal<_>, _make_terminal(_byval(_value))>
       , when<nary_expr<_, vararg<ByVal> > >
>
 {};
@@ -165,7 +166,7 @@
 // Turn all terminals held by value into ones held by reference (not safe in general)
 struct ByRef
   : or_<
- when<terminal<_>, _make_terminal(_ref(_value))>
+ when<terminal<_>, _make_terminal(_byref(_value))>
       , when<nary_expr<_, vararg<ByRef> > >
>
 {};
@@ -182,13 +183,14 @@
   : or_<
         // Not creating new terminal nodes here,
         // so hold the existing terminals by reference:
- when<terminal<_>, _make_multiplies(_ref(_), _ref(_))>
+ when<terminal<_>, _make_multiplies(_, _)>
       , when<plus<Square, Square> >
>
 {};
 
 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
-#undef _ref
+#undef _byref
+#undef _byval
 #undef Minus
 #endif
 
@@ -205,8 +207,8 @@
>::type t2 = ByRef()(as_expr(1) + 1);
 
     minus<
- terminal<int>::type
- , terminal<int const &>::type
+ terminal<int>::type const &
+ , terminal<int const &>::type const &
>::type t3 = Minus()(as_expr(1) + 1);
 
     plus<


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk