|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71709 - trunk/boost/proto/detail
From: eric_at_[hidden]
Date: 2011-05-04 05:56:29
Author: eric_niebler
Date: 2011-05-04 05:56:27 EDT (Wed, 04 May 2011)
New Revision: 71709
URL: http://svn.boost.org/trac/boost/changeset/71709
Log:
proto::expr::operator() uses variadic templates if they are available
Text files modified:
trunk/boost/proto/detail/expr0.hpp | 45 ++++++++++++++++++++++++++++++++++++++-
trunk/boost/proto/detail/funop.hpp | 8 +++---
2 files changed, 47 insertions(+), 6 deletions(-)
Modified: trunk/boost/proto/detail/expr0.hpp
==============================================================================
--- trunk/boost/proto/detail/expr0.hpp (original)
+++ trunk/boost/proto/detail/expr0.hpp 2011-05-04 05:56:27 EDT (Wed, 04 May 2011)
@@ -432,6 +432,45 @@
typedef typename result_of::funop<Sig, expr, default_domain>::type const type;
};
+#ifndef BOOST_NO_VARIADIC_TEMPLATES
+ /// \overload
+ ///
+ template<typename ...A>
+ typename result_of::funop<
+ expr const(A const &...)
+ , expr
+ , default_domain
+ >::type const
+ operator ()(A const &... a) const
+ {
+ return result_of::funop<
+ expr const(A const &...)
+ , expr
+ , default_domain
+ >::call(*this, a...);
+ }
+
+ #ifdef BOOST_PROTO_DEFINE_TERMINAL
+ /// \overload
+ ///
+ template<typename ...A>
+ typename result_of::funop<
+ expr(A const &...)
+ , expr
+ , default_domain
+ >::type const
+ operator ()(A const &... a)
+ {
+ return result_of::funop<
+ expr(A const &...)
+ , expr
+ , default_domain
+ >::call(*this, a...);
+ }
+ #endif
+
+#else // BOOST_NO_VARIADIC_TEMPLATES
+
/// Function call
///
/// \return A new \c expr\<\> node representing the function invocation of \c (*this)().
@@ -453,8 +492,10 @@
}
#endif
-#define BOOST_PP_ITERATION_PARAMS_2 (3, (1, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/proto/detail/expr1.hpp>))
-#include BOOST_PP_ITERATE()
+ #define BOOST_PP_ITERATION_PARAMS_2 (3, (1, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/proto/detail/expr1.hpp>))
+ #include BOOST_PP_ITERATE()
+
+#endif
};
#undef ARG_COUNT
Modified: trunk/boost/proto/detail/funop.hpp
==============================================================================
--- trunk/boost/proto/detail/funop.hpp (original)
+++ trunk/boost/proto/detail/funop.hpp 2011-05-04 05:56:27 EDT (Wed, 04 May 2011)
@@ -23,14 +23,14 @@
template<typename Expr, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename A)>
struct BOOST_PP_CAT(funop, BOOST_PP_ITERATION())
{
- typedef proto::expr<
- tag::function
+ typedef typename proto::base_expr<
+ Domain
+ , tag::function
, BOOST_PP_CAT(list, BOOST_PP_INC(BOOST_PP_ITERATION()))<
Expr &
BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION(), M0, ~)
>
- , BOOST_PP_INC(BOOST_PP_ITERATION())
- > type;
+ >::type type;
static type const call(
Expr &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