Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62951 - in trunk/boost/proto: . detail
From: eric_at_[hidden]
Date: 2010-06-14 17:26:13


Author: eric_niebler
Date: 2010-06-14 17:26:12 EDT (Mon, 14 Jun 2010)
New Revision: 62951
URL: http://svn.boost.org/trac/boost/changeset/62951

Log:
as_expr and as_child no longer run objects that are already proto expressions through the domain's generator
Text files modified:
   trunk/boost/proto/detail/as_expr.hpp | 97 ----------------------------------------
   trunk/boost/proto/domain.hpp | 28 ++++------
   2 files changed, 12 insertions(+), 113 deletions(-)

Modified: trunk/boost/proto/detail/as_expr.hpp
==============================================================================
--- trunk/boost/proto/detail/as_expr.hpp (original)
+++ trunk/boost/proto/detail/as_expr.hpp 2010-06-14 17:26:12 EDT (Mon, 14 Jun 2010)
@@ -90,55 +90,6 @@
     };
 
     ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr, typename Generator, bool SameGenerator>
- struct already_expr
- {
- typedef typename Expr::proto_derived_expr uncv_expr_type;
- typedef typename Generator::template result<Generator(uncv_expr_type)>::type result_type;
-
- result_type operator()(Expr &e) const
- {
- return Generator()(e);
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr, typename Generator>
- struct already_expr<Expr, Generator, true>
- {
- typedef typename remove_const<Expr>::type result_type; // remove cv
-
- result_type operator()(Expr &e) const
- {
- return e;
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr>
- struct already_expr<Expr, default_generator, false>
- {
- typedef typename remove_const<Expr>::type result_type; // remove cv
-
- result_type operator()(Expr &e) const
- {
- return e;
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr>
- struct already_expr<Expr, default_generator, true>
- {
- typedef typename remove_const<Expr>::type result_type; // remove cv
-
- result_type operator()(Expr &e) const
- {
- return e;
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
     template<typename T, typename Generator, bool WantsBasicExpr>
     struct as_child;
 
@@ -192,54 +143,6 @@
         }
     };
 
- ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr, typename Generator, bool SameGenerator>
- struct already_child
- {
- typedef typename Generator::template result<Generator(Expr)>::type result_type;
-
- result_type operator()(Expr &e) const
- {
- return Generator()(e);
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr, typename Generator>
- struct already_child<Expr, Generator, true>
- {
- typedef Expr &result_type;
-
- result_type operator()(Expr &e) const
- {
- return e;
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr>
- struct already_child<Expr, default_generator, false>
- {
- typedef Expr &result_type;
-
- result_type operator()(Expr &e) const
- {
- return e;
- }
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////
- template<typename Expr>
- struct already_child<Expr, default_generator, true>
- {
- typedef Expr &result_type;
-
- result_type operator()(Expr &e) const
- {
- return e;
- }
- };
-
 }}}
 
 #endif

Modified: trunk/boost/proto/domain.hpp
==============================================================================
--- trunk/boost/proto/domain.hpp (original)
+++ trunk/boost/proto/domain.hpp 2010-06-14 17:26:12 EDT (Mon, 14 Jun 2010)
@@ -138,16 +138,14 @@
             ///
             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()
+ typedef typename remove_const<T>::type result_type;
+
+ result_type operator()(T &e) const
+ {
+ return e;
+ }
             };
 
             /// \brief A unary MonomorphicFunctionObject that turns objects into Proto
@@ -183,16 +181,14 @@
             ///
             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()
+ typedef T &result_type;
+
+ result_type operator()(T &e) const
+ {
+ return e;
+ }
             };
         };
 


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