Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-12-20 00:47:16


Author: eric_niebler
Date: 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
New Revision: 42193
URL: http://svn.boost.org/trac/boost/changeset/42193

Log:
expr::make(...) -> proto::construct<expr>(...)
Text files modified:
   branches/proto/v3/boost/xpressive/proto/detail/make_.hpp | 2
   branches/proto/v3/boost/xpressive/proto/expr.hpp | 42 ++++++++++++++++++++++++++++++++-------
   branches/proto/v3/boost/xpressive/proto/literal.hpp | 6 ++--
   branches/proto/v3/boost/xpressive/proto/make_expr.hpp | 2
   branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp | 17 ++++++++++++++++
   branches/proto/v3/boost/xpressive/proto/traits.hpp | 4 +-
   branches/proto/v3/boost/xpressive/proto/transform/make.hpp | 2
   branches/proto/v3/boost/xpressive/regex_actions.hpp | 8 +++---
   branches/proto/v3/boost/xpressive/regex_primitives.hpp | 4 +-
   branches/proto/v3/libs/xpressive/proto/example/lazy_vector.cpp | 2
   10 files changed, 66 insertions(+), 23 deletions(-)

Modified: branches/proto/v3/boost/xpressive/proto/detail/make_.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/make_.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/make_.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -55,7 +55,7 @@
         #define TMP1(Z, N, DATA) AsExpr<Domain>()(a##N)
         static type call(BOOST_PP_ENUM(BOOST_PP_ITERATION(), TMP0, ~))
         {
- return Domain::make(expr_type::make(BOOST_PP_ENUM(BOOST_PP_ITERATION(), TMP1, ~)));
+ return Domain::make(proto::construct<expr_type>(BOOST_PP_ENUM(BOOST_PP_ITERATION(), TMP1, ~)));
         }
         #undef TMP0
         #undef TMP1

Modified: branches/proto/v3/boost/xpressive/proto/expr.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/expr.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/expr.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -72,14 +72,6 @@
                 return boost::addressof(this->proto_args_.car);
             }
 
- // TODO make this a free function
- template<typename... A>
- static expr make(A &&... a)
- {
- expr that = {argsns_::make_cons_<typename Args::cons_type>(a...)};
- return that;
- }
-
         #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
 
             template<typename A>
@@ -232,8 +224,42 @@
 
         };
 
+ /// construct
+ ///
+ template<typename Expr, typename A>
+ inline Expr construct(A &a)
+ {
+ typedef typename Expr::proto_args::cons_type cons_type;
+ Expr that = {proto::argsns_::make_cons_<cons_type>(a)};
+ return that;
+ }
+
+ #ifdef BOOST_HAS_VARIADIC_TMPL
+ /// \overload
+ ///
+ template<typename Expr, typename... A>
+ inline Expr construct(A const &... a)
+ {
+ typedef typename Expr::proto_args::cons_type cons_type;
+ Expr that = {proto::argsns_::make_cons_<cons_type>(a...)};
+ return that;
+ }
+ #else
+ #define TMP(Z, N, DATA) \
+ template<typename Expr BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, typename A)> \
+ inline Expr construct(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) \
+ { \
+ typedef typename Expr::proto_args::cons_type cons_type; \
+ Expr that = {proto::argsns_::make_cons_<cons_type>(BOOST_PP_ENUM_PARAMS_Z(Z, N, a))}; \
+ return that; \
+ } \
+ /**/
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), TMP, ~)
+ #undef TMP
+ #endif
     }
 
+
 }}
 
 #endif

Modified: branches/proto/v3/boost/xpressive/proto/literal.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/literal.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/literal.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -28,17 +28,17 @@
 
             template<typename U>
             literal(U &u)
- : base_type(terminal_type::make(u))
+ : base_type(proto::construct<terminal_type>(u))
             {}
 
             template<typename U>
             literal(U const &u)
- : base_type(terminal_type::make(u))
+ : base_type(proto::construct<terminal_type>(u))
             {}
 
             template<typename U>
             literal(literal<U, Domain> const &u)
- : base_type(terminal_type::make(proto::arg(u)))
+ : base_type(proto::construct<terminal_type>(proto::arg(u)))
             {}
 
             using base_type::operator =;

Modified: branches/proto/v3/boost/xpressive/proto/make_expr.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/make_expr.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/make_expr.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -454,7 +454,7 @@
 
             static type call(CVREF(Args)... args)
             {
- return Domain::make(expr_type::make(AsExpr<Domain>()(args)...));
+ return Domain::make(proto::construct<expr_type>(AsExpr<Domain>()(args)...));
             }
         };
 

Modified: branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -111,11 +111,28 @@
         struct extends;
 
         struct is_proto_expr;
+
+ template<typename Expr, typename A>
+ Expr construct(A &a);
+
+ #ifdef BOOST_HAS_VARIADIC_TMPL
+ template<typename Expr, typename... A>
+ Expr construct(A const &... a);
+ #else
+ #define TMP(Z, N, DATA) \
+ template<typename Expr BOOST_PP_ENUM_TRAILING_PARAMS_Z(Z, N, typename A)> \
+ Expr construct(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)); \
+ /**/
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), TMP, ~)
+ #undef TMP
+ #endif
+
     }
 
     using exprns_::expr;
     using exprns_::extends;
     using exprns_::is_proto_expr;
+ using exprns_::construct;
 
     namespace tag
     {

Modified: branches/proto/v3/boost/xpressive/proto/traits.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/traits.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/traits.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -301,7 +301,7 @@
 
             static type const call(CVREF(T) t)
             {
- return Domain::make(expr_type::make(t));
+ return Domain::make(proto::construct<expr_type>(t));
             }
         };
 
@@ -335,7 +335,7 @@
 
             static type const call(CVREF(T) t)
             {
- return Domain::make(expr_type::make(t));
+ return Domain::make(proto::construct<expr_type>(t));
             }
         };
 

Modified: branches/proto/v3/boost/xpressive/proto/transform/make.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/make.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/make.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -145,7 +145,7 @@
                 template<typename... Args>
                 result_type operator()(Args &&... args) const
                 {
- return result_type::make(args...);
+ return proto::construct<result_type>(args...);
                 }
             };
 

Modified: branches/proto/v3/boost/xpressive/regex_actions.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/regex_actions.hpp (original)
+++ branches/proto/v3/boost/xpressive/regex_actions.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -619,7 +619,7 @@
         {}
 
         explicit value(T const &t)
- : base_type(base_type::proto_base_expr::make(t))
+ : base_type(proto::construct<typename base_type::proto_base_expr>(t))
         {}
 
         using base_type::operator =;
@@ -642,7 +642,7 @@
         typedef proto::extends<typename proto::terminal<reference_wrapper<T> >::type, reference<T> > base_type;
 
         explicit reference(T &t)
- : base_type(base_type::proto_base_expr::make(boost::ref(t)))
+ : base_type(proto::construct<typename base_type::proto_base_expr>(boost::ref(t)))
         {}
 
         using base_type::operator =;
@@ -664,13 +664,13 @@
         local()
           : noncopyable()
           , detail::value_wrapper<T>()
- , base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
+ , base_type(proto::construct<base_type>(boost::ref(detail::value_wrapper<T>::value)))
         {}
 
         explicit local(T const &t)
           : noncopyable()
           , detail::value_wrapper<T>(t)
- , base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
+ , base_type(proto::construct<base_type>(boost::ref(detail::value_wrapper<T>::value)))
         {}
 
         using base_type::operator =;

Modified: branches/proto/v3/boost/xpressive/regex_primitives.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/regex_primitives.hpp (original)
+++ branches/proto/v3/boost/xpressive/regex_primitives.hpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -470,7 +470,7 @@
 by_ref(basic_regex<BidiIter> const &rex)
 {
     reference_wrapper<basic_regex<BidiIter> const> ref(rex);
- return proto::terminal<reference_wrapper<basic_regex<BidiIter> const> >::type::make(ref);
+ return proto::construct<typename proto::terminal<reference_wrapper<basic_regex<BidiIter> const> >::type>(ref);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -485,7 +485,7 @@
 range(Char ch_min, Char ch_max)
 {
     detail::range_placeholder<Char> that = {ch_min, ch_max};
- return proto::terminal<detail::range_placeholder<Char> >::type::make(that);
+ return proto::construct<typename proto::terminal<detail::range_placeholder<Char> >::type>(that);
 }
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: branches/proto/v3/libs/xpressive/proto/example/lazy_vector.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/example/lazy_vector.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/example/lazy_vector.cpp 2007-12-20 00:47:14 EST (Thu, 20 Dec 2007)
@@ -97,7 +97,7 @@
     typedef typename proto::terminal< std::vector<T> >::type expr_type;
 
     lazy_vector( std::size_t size = 0, T const & value = T() )
- : lazy_vector_expr<expr_type>( expr_type::make( std::vector<T>( size, value ) ) )
+ : lazy_vector_expr<expr_type>( proto::construct<expr_type>( std::vector<T>( size, value ) ) )
     {}
 
     // Here we define a += operator for lazy vector terminals 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