Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54610 - trunk/boost/proto
From: eric_at_[hidden]
Date: 2009-07-03 12:58:56


Author: eric_niebler
Date: 2009-07-03 12:58:55 EDT (Fri, 03 Jul 2009)
New Revision: 54610
URL: http://svn.boost.org/trac/boost/changeset/54610

Log:
fix slicing problem of unary operators
Text files modified:
   trunk/boost/proto/operators.hpp | 14 ++++++++------
   1 files changed, 8 insertions(+), 6 deletions(-)

Modified: trunk/boost/proto/operators.hpp
==============================================================================
--- trunk/boost/proto/operators.hpp (original)
+++ trunk/boost/proto/operators.hpp 2009-07-03 12:58:55 EDT (Fri, 03 Jul 2009)
@@ -28,7 +28,7 @@
 {
     namespace detail
     {
- template<typename Domain, typename Expr>
+ template<typename Domain, typename Expr, typename EnableIf = void>
         struct generate_if
           : lazy_enable_if_c<
                 matches<Expr, typename Domain::proto_grammar>::value
@@ -38,7 +38,7 @@
 
         // Optimization, generate fewer templates...
         template<typename Expr>
- struct generate_if<proto::default_domain, Expr>
+ struct generate_if<proto::default_domain, Expr, void>
         {
             typedef Expr type;
         };
@@ -224,22 +224,24 @@
     template<typename Arg> \
     typename detail::generate_if< \
         typename Arg::proto_domain \
- , proto::expr<TAG, list1<typename Arg::proto_derived_expr &>, 1> \
+ , proto::expr<TAG, list1<Arg &>, 1> \
+ , typename Arg::proto_is_expr_ \
>::type const \
     operator OP(Arg &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
     { \
- typedef proto::expr<TAG, list1<typename Arg::proto_derived_expr &>, 1> that_type; \
+ typedef proto::expr<TAG, list1<Arg &>, 1> that_type; \
         that_type that = {arg}; \
         return typename Arg::proto_domain()(that); \
     } \
     template<typename Arg> \
     typename detail::generate_if< \
         typename Arg::proto_domain \
- , proto::expr<TAG, list1<typename Arg::proto_derived_expr const &>, 1> \
+ , proto::expr<TAG, list1<Arg const &>, 1> \
+ , typename Arg::proto_is_expr_ \
>::type const \
     operator OP(Arg const &arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
     { \
- typedef proto::expr<TAG, list1<typename Arg::proto_derived_expr const &>, 1> that_type; \
+ typedef proto::expr<TAG, list1<Arg const &>, 1> that_type; \
         that_type that = {arg}; \
         return typename Arg::proto_domain()(that); \
     } \


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