|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79461 - in trunk: boost/proto boost/proto/detail boost/proto/transform boost/proto/transform/detail boost/proto/transform/detail/preprocessed libs/proto/preprocess libs/proto/test
From: eric_at_[hidden]
Date: 2012-07-12 17:54:33
Author: eric_niebler
Date: 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
New Revision: 79461
URL: http://svn.boost.org/trac/boost/changeset/79461
Log:
transforms get pseudo-parameter pack expansion support for unpacking expressions
Added:
trunk/boost/proto/transform/detail/expand_pack.hpp (contents, props changed)
trunk/boost/proto/transform/detail/pack.hpp (contents, props changed)
trunk/boost/proto/transform/detail/pack_impl.hpp (contents, props changed)
trunk/boost/proto/transform/detail/preprocessed/expand_pack.hpp (contents, props changed)
trunk/boost/proto/transform/detail/preprocessed/pack_impl.hpp (contents, props changed)
trunk/libs/proto/test/pack_expansion.cpp (contents, props changed)
Text files modified:
trunk/boost/proto/detail/deduce_domain.hpp | 1
trunk/boost/proto/fusion.hpp | 21
trunk/boost/proto/proto_fwd.hpp | 2
trunk/boost/proto/transform/call.hpp | 24 +
trunk/boost/proto/transform/detail/call.hpp | 29 +
trunk/boost/proto/transform/detail/lazy.hpp | 21 +
trunk/boost/proto/transform/detail/make.hpp | 24 +
trunk/boost/proto/transform/detail/preprocessed/call.hpp | 200 ++++++++++
trunk/boost/proto/transform/detail/preprocessed/lazy.hpp | 180 +++++++++
trunk/boost/proto/transform/detail/preprocessed/make.hpp | 220 +++++++++++
trunk/boost/proto/transform/detail/preprocessed/when.hpp | 762 ++++++++++++++++-----------------------
trunk/boost/proto/transform/detail/when.hpp | 77 +--
trunk/boost/proto/transform/lazy.hpp | 7
trunk/boost/proto/transform/make.hpp | 7
trunk/boost/proto/transform/when.hpp | 50 ++
trunk/libs/proto/preprocess/Jamfile.v2 | 2
trunk/libs/proto/preprocess/wave.cfg | 3
trunk/libs/proto/test/Jamfile.v2 | 3
18 files changed, 1134 insertions(+), 499 deletions(-)
Modified: trunk/boost/proto/detail/deduce_domain.hpp
==============================================================================
--- trunk/boost/proto/detail/deduce_domain.hpp (original)
+++ trunk/boost/proto/detail/deduce_domain.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -19,6 +19,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
Modified: trunk/boost/proto/fusion.hpp
==============================================================================
--- trunk/boost/proto/fusion.hpp (original)
+++ trunk/boost/proto/fusion.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -44,12 +44,11 @@
: fusion::iterator_base<expr_iterator<Expr, Pos> >
{
typedef Expr expr_type;
- typedef typename Expr::proto_tag proto_tag;
static const long index = Pos;
typedef fusion::random_access_traversal_tag category;
typedef tag::proto_expr_iterator fusion_tag;
- expr_iterator(Expr &e)
+ explicit expr_iterator(Expr &e)
: expr(e)
{}
@@ -60,7 +59,6 @@
struct flat_view
{
typedef Expr expr_type;
- typedef typename Expr::proto_tag proto_tag;
typedef fusion::forward_traversal_tag category;
typedef tag::proto_flat_view fusion_tag;
@@ -373,7 +371,7 @@
struct apply
{
typedef
- typename proto::detail::expr_iterator<
+ proto::detail::expr_iterator<
typename Iterator::expr_type
, Iterator::index + N::value
>
@@ -583,12 +581,14 @@
template<typename Sequence>
struct apply
{
- typedef typename Sequence::proto_tag proto_tag;
+ typedef typename Sequence::expr_type::proto_tag proto_tag;
- typedef fusion::transform_view<
- typename Sequence::expr_type
- , proto::detail::as_element<proto_tag>
- > type;
+ typedef
+ fusion::transform_view<
+ typename Sequence::expr_type
+ , proto::detail::as_element<proto_tag>
+ >
+ type;
static type call(Sequence &sequence)
{
@@ -639,7 +639,6 @@
: mpl::false_
{};
}
-
}}
namespace boost { namespace mpl
@@ -655,7 +654,7 @@
{
typedef fusion::fusion_sequence_tag type;
};
-}}
+}}
#ifdef BOOST_MSVC
#pragma warning(pop)
Modified: trunk/boost/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/proto/proto_fwd.hpp (original)
+++ trunk/boost/proto/proto_fwd.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -404,6 +404,8 @@
template<typename Grammar>
struct vararg;
+ struct pack;
+
// Boost bug https://svn.boost.org/trac/boost/ticket/4602
//int const N = INT_MAX;
int const N = (INT_MAX >> 10);
Modified: trunk/boost/proto/transform/call.hpp
==============================================================================
--- trunk/boost/proto/transform/call.hpp (original)
+++ trunk/boost/proto/transform/call.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -29,6 +29,7 @@
#include <boost/proto/transform/impl.hpp>
#include <boost/proto/detail/as_lvalue.hpp>
#include <boost/proto/detail/poly_function.hpp>
+#include <boost/proto/transform/detail/pack.hpp>
namespace boost { namespace proto
{
@@ -84,6 +85,29 @@
: PrimitiveTransform
{};
+ /// \brief A specialization that treats function pointer Transforms as
+ /// if they were function type Transforms.
+ ///
+ /// This specialization requires that \c Fun is actually a function type.
+ ///
+ /// This specialization is required for nested transforms such as
+ /// <tt>call\<T0(T1(_))\></tt>. In C++, functions that are used as
+ /// parameters to other functions automatically decay to funtion
+ /// pointer types. In other words, the type <tt>T0(T1(_))</tt> is
+ /// indistinguishable from <tt>T0(T1(*)(_))</tt>. This specialization
+ /// is required to handle these nested function pointer type transforms
+ /// properly.
+ template<typename Fun>
+ struct call<Fun *>
+ : call<Fun>
+ {};
+
+ /// INTERNAL ONLY
+ template<typename Fun>
+ struct call<detail::msvc_fun_workaround<Fun> >
+ : call<Fun>
+ {};
+
/// \brief Either call the PolymorphicFunctionObject with 0
/// arguments, or invoke the PrimitiveTransform with 3
/// arguments.
Modified: trunk/boost/proto/transform/detail/call.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/call.hpp (original)
+++ trunk/boost/proto/transform/detail/call.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -31,11 +31,9 @@
#pragma wave option(preserve: 1)
#endif
- #if BOOST_PROTO_MAX_ARITY > 3
#define BOOST_PP_ITERATION_PARAMS_1 \
- (3, (4, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/call.hpp>))
+ (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/call.hpp>))
#include BOOST_PP_ITERATE()
- #endif
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
@@ -48,6 +46,7 @@
#define N BOOST_PP_ITERATION()
+ #if N > 3
/// \brief Call the PolymorphicFunctionObject \c Fun with the
/// current expression, state and data, transformed according
/// to \c A0 through \c AN.
@@ -81,6 +80,30 @@
}
};
};
+ #endif
+
+ #if N > 0
+ /// \brief Call the PolymorphicFunctionObject \c Fun with the
+ /// current expression, state and data, transformed according
+ /// to \c A0 through \c AN.
+ template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , BOOST_PP_CAT(A, BOOST_PP_DEC(N))
+ , detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
+ Fun
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+ #endif
#undef N
Added: trunk/boost/proto/transform/detail/expand_pack.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/proto/transform/detail/expand_pack.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -0,0 +1,46 @@
+#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
+
+ #include <boost/proto/transform/detail/preprocessed/expand_pack.hpp>
+
+#elif !defined(BOOST_PP_IS_ITERATING)
+
+ #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 2, line: 0, output: "preprocessed/expand_pack.hpp")
+ #endif
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file expand_pack.hpp
+ /// Contains helpers for pseudo-pack expansion.
+ //
+ // Copyright 2012 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 1)
+ #endif
+
+ #define BOOST_PP_ITERATION_PARAMS_1 \
+ (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/expand_pack.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(output: null)
+ #endif
+
+#else
+ #define N BOOST_PP_ITERATION()
+ #define M0(Z, X, DATA) typename expand_pattern_helper<Tfx, BOOST_PP_CAT(A, X)>::type
+ #define M1(Z, X, DATA) expand_pattern_helper<Tfx, BOOST_PP_CAT(A, X)>::applied::value ||
+
+ template<typename Tfx, typename Ret BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct expand_pattern_helper<Tfx, Ret(BOOST_PP_ENUM_PARAMS(N, A))>
+ {
+ typedef Ret (*type)(BOOST_PP_ENUM(N, M0, ~));
+ typedef mpl::bool_<BOOST_PP_REPEAT(N, M1, ~) false> applied;
+ };
+
+ #undef M1
+ #undef M0
+ #undef N
+#endif
Modified: trunk/boost/proto/transform/detail/lazy.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/lazy.hpp (original)
+++ trunk/boost/proto/transform/detail/lazy.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -53,6 +53,27 @@
{};
};
+ #if N > 0
+ template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct lazy<Object(BOOST_PP_ENUM_PARAMS(N, A)...)>
+ : transform<lazy<Object(BOOST_PP_ENUM_PARAMS(N, A)...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , BOOST_PP_CAT(A, BOOST_PP_DEC(N))
+ , detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
+ Object
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+ #endif
+
#undef N
#endif
Modified: trunk/boost/proto/transform/detail/make.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/make.hpp (original)
+++ trunk/boost/proto/transform/detail/make.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -173,6 +173,30 @@
};
};
+ #if N > 0
+ /// \brief A PrimitiveTransform which computes a type by evaluating any
+ /// nested transforms and then constructs an object of that type with the
+ /// current expression, state and data, transformed according
+ /// to \c A0 through \c AN.
+ template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct make<Object(BOOST_PP_ENUM_PARAMS(N, A)...)>
+ : transform<make<Object(BOOST_PP_ENUM_PARAMS(N, A)...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , BOOST_PP_CAT(A, BOOST_PP_DEC(N))
+ , detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
+ Object
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+ #endif
#undef N
#endif
Added: trunk/boost/proto/transform/detail/pack.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/proto/transform/detail/pack.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -0,0 +1,90 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file pack.hpp
+/// Contains helpers for pseudo-pack expansion.
+//
+// Copyright 2012 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
+#define BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/iteration/iterate.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/proto/proto_fwd.hpp>
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(push)
+# pragma warning(disable: 4348) // redefinition of default parameter
+#endif
+
+namespace boost { namespace proto
+{
+ namespace detail
+ {
+ template<typename Fun>
+ struct msvc_fun_workaround;
+
+ template<typename Tfx, typename T>
+ struct expand_pattern_helper
+ {
+ typedef T type;
+ typedef mpl::false_ applied;
+ };
+
+ template<typename Tfx, typename Fun>
+ struct expand_pattern_helper<Tfx, Fun *>
+ : expand_pattern_helper<Tfx, Fun>
+ {};
+
+ template<typename Tfx, typename T>
+ struct expand_pattern_helper<Tfx, pack(T)>
+ {
+ typedef Tfx type(T);
+ typedef mpl::true_ applied;
+ };
+
+ template<typename Tfx>
+ struct expand_pattern_helper<Tfx, pack(_)>
+ {
+ typedef Tfx type;
+ typedef mpl::true_ applied;
+ };
+
+ #include <boost/proto/transform/detail/expand_pack.hpp>
+
+ template<long Arity, typename Fun, typename Cont>
+ struct expand_pattern;
+
+ template<typename Fun, typename Cont>
+ struct expand_pattern<0, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_value, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_value, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+
+ #include <boost/proto/transform/detail/pack_impl.hpp>
+ }
+}}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma warning(pop)
+#endif
+
+#endif
Added: trunk/boost/proto/transform/detail/pack_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/proto/transform/detail/pack_impl.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -0,0 +1,72 @@
+#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
+
+ #include <boost/proto/transform/detail/preprocessed/pack_impl.hpp>
+
+#elif !defined(BOOST_PP_IS_ITERATING)
+
+ #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 2, line: 0, output: "preprocessed/pack_impl.hpp")
+ #endif
+
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file pack_impl.hpp
+ /// Contains helpers for pseudo-pack expansion.
+ //
+ // Copyright 2012 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+ #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 1)
+ #endif
+
+ #define BOOST_PP_ITERATION_PARAMS_1 \
+ (3, (0, BOOST_PP_DEC(BOOST_PROTO_MAX_ARITY), <boost/proto/transform/detail/pack_impl.hpp>))
+ #include BOOST_PP_ITERATE()
+
+ #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(output: null)
+ #endif
+
+#else
+ #if BOOST_PP_ITERATION_DEPTH() == 1
+ #define N BOOST_PP_ITERATION()
+ #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
+ #define M0(Z, X, D) typename expand_pattern_helper<proto::_child_c<X>, Fun>::type
+
+ template<typename Fun, typename Cont>
+ struct expand_pattern<BOOST_PP_INC(N), Fun, Cont>
+ : Cont::template cat<BOOST_PP_ENUM(BOOST_PP_INC(N), M0, ~)>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+
+ template<typename Ret BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct BOOST_PP_CAT(expand_pattern_rest_, N)
+ {
+ template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(M), typename B, void)>
+ struct cat;
+
+ #define BOOST_PP_ITERATION_PARAMS_2 \
+ (3, (1, M, <boost/proto/transform/detail/pack_impl.hpp>))
+ #include BOOST_PP_ITERATE()
+ };
+ #undef M0
+ #undef M
+ #undef N
+ #else
+ #define I BOOST_PP_ITERATION()
+ #define J BOOST_PP_RELATIVE_ITERATION(1)
+ template<BOOST_PP_ENUM_PARAMS(I, typename B)>
+ struct cat<BOOST_PP_ENUM_PARAMS(I, B)>
+ {
+ typedef msvc_fun_workaround<Ret(BOOST_PP_ENUM_PARAMS(J, A) BOOST_PP_COMMA_IF(J) BOOST_PP_ENUM_PARAMS(I, B))> type;
+ };
+ #undef J
+ #undef I
+ #endif
+#endif
Modified: trunk/boost/proto/transform/detail/preprocessed/call.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/preprocessed/call.hpp (original)
+++ trunk/boost/proto/transform/detail/preprocessed/call.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -8,6 +8,66 @@
+ template<typename Fun , typename A0>
+ struct call<Fun(A0...)> : transform<call<Fun(A0...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A0
+ , detail::expand_pattern_rest_0<
+ Fun
+
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
+ template<typename Fun , typename A0 , typename A1>
+ struct call<Fun(A0 , A1...)> : transform<call<Fun(A0 , A1...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A1
+ , detail::expand_pattern_rest_1<
+ Fun
+ , A0
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
+ template<typename Fun , typename A0 , typename A1 , typename A2>
+ struct call<Fun(A0 , A1 , A2...)> : transform<call<Fun(A0 , A1 , A2...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A2
+ , detail::expand_pattern_rest_2<
+ Fun
+ , A0 , A1
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3>
struct call<Fun(A0 , A1 , A2 , A3)> : transform<call<Fun(A0 , A1 , A2 , A3)> >
{
@@ -39,6 +99,26 @@
+ template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3>
+ struct call<Fun(A0 , A1 , A2 , A3...)> : transform<call<Fun(A0 , A1 , A2 , A3...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A3
+ , detail::expand_pattern_rest_3<
+ Fun
+ , A0 , A1 , A2
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
struct call<Fun(A0 , A1 , A2 , A3 , A4)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4)> >
{
@@ -70,6 +150,26 @@
+ template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
+ struct call<Fun(A0 , A1 , A2 , A3 , A4...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A4
+ , detail::expand_pattern_rest_4<
+ Fun
+ , A0 , A1 , A2 , A3
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5)> >
{
@@ -101,6 +201,26 @@
+ template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
+ struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A5
+ , detail::expand_pattern_rest_5<
+ Fun
+ , A0 , A1 , A2 , A3 , A4
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6)> >
{
@@ -132,6 +252,26 @@
+ template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
+ struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A6
+ , detail::expand_pattern_rest_6<
+ Fun
+ , A0 , A1 , A2 , A3 , A4 , A5
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> >
{
@@ -163,6 +303,26 @@
+ template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
+ struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A7
+ , detail::expand_pattern_rest_7<
+ Fun
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> >
{
@@ -194,6 +354,26 @@
+ template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
+ struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A8
+ , detail::expand_pattern_rest_8<
+ Fun
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
+
+
+
template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> >
{
@@ -222,3 +402,23 @@
}
};
};
+
+
+
+ template<typename Fun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
+ struct call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)> : transform<call<Fun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : call<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A9
+ , detail::expand_pattern_rest_9<
+ Fun
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
Added: trunk/boost/proto/transform/detail/preprocessed/expand_pack.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/proto/transform/detail/preprocessed/expand_pack.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -0,0 +1,73 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file expand_pack.hpp
+ /// Contains helpers for pseudo-pack expansion.
+ //
+ // Copyright 2012 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ template<typename Tfx, typename Ret >
+ struct expand_pattern_helper<Tfx, Ret()>
+ {
+ typedef Ret (*type)();
+ typedef mpl::bool_< false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0>
+ struct expand_pattern_helper<Tfx, Ret(A0)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type , typename expand_pattern_helper<Tfx, A7>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || expand_pattern_helper<Tfx, A7>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type , typename expand_pattern_helper<Tfx, A7>::type , typename expand_pattern_helper<Tfx, A8>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || expand_pattern_helper<Tfx, A7>::applied::value || expand_pattern_helper<Tfx, A8>::applied::value || false> applied;
+ };
+ template<typename Tfx, typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
+ struct expand_pattern_helper<Tfx, Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
+ {
+ typedef Ret (*type)(typename expand_pattern_helper<Tfx, A0>::type , typename expand_pattern_helper<Tfx, A1>::type , typename expand_pattern_helper<Tfx, A2>::type , typename expand_pattern_helper<Tfx, A3>::type , typename expand_pattern_helper<Tfx, A4>::type , typename expand_pattern_helper<Tfx, A5>::type , typename expand_pattern_helper<Tfx, A6>::type , typename expand_pattern_helper<Tfx, A7>::type , typename expand_pattern_helper<Tfx, A8>::type , typename expand_pattern_helper<Tfx, A9>::type);
+ typedef mpl::bool_<expand_pattern_helper<Tfx, A0>::applied::value || expand_pattern_helper<Tfx, A1>::applied::value || expand_pattern_helper<Tfx, A2>::applied::value || expand_pattern_helper<Tfx, A3>::applied::value || expand_pattern_helper<Tfx, A4>::applied::value || expand_pattern_helper<Tfx, A5>::applied::value || expand_pattern_helper<Tfx, A6>::applied::value || expand_pattern_helper<Tfx, A7>::applied::value || expand_pattern_helper<Tfx, A8>::applied::value || expand_pattern_helper<Tfx, A9>::applied::value || false> applied;
+ };
Modified: trunk/boost/proto/transform/detail/preprocessed/lazy.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/preprocessed/lazy.hpp (original)
+++ trunk/boost/proto/transform/detail/preprocessed/lazy.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -45,6 +45,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0>
+ struct lazy<Object(A0...)>
+ : transform<lazy<Object(A0...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A0
+ , detail::expand_pattern_rest_0<
+ Object
+
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -65,6 +83,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1>
+ struct lazy<Object(A0 , A1...)>
+ : transform<lazy<Object(A0 , A1...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A1
+ , detail::expand_pattern_rest_1<
+ Object
+ , A0
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -85,6 +121,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2>
+ struct lazy<Object(A0 , A1 , A2...)>
+ : transform<lazy<Object(A0 , A1 , A2...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A2
+ , detail::expand_pattern_rest_2<
+ Object
+ , A0 , A1
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -105,6 +159,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3>
+ struct lazy<Object(A0 , A1 , A2 , A3...)>
+ : transform<lazy<Object(A0 , A1 , A2 , A3...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A3
+ , detail::expand_pattern_rest_3<
+ Object
+ , A0 , A1 , A2
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -125,6 +197,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
+ struct lazy<Object(A0 , A1 , A2 , A3 , A4...)>
+ : transform<lazy<Object(A0 , A1 , A2 , A3 , A4...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A4
+ , detail::expand_pattern_rest_4<
+ Object
+ , A0 , A1 , A2 , A3
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -145,6 +235,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
+ struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5...)>
+ : transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A5
+ , detail::expand_pattern_rest_5<
+ Object
+ , A0 , A1 , A2 , A3 , A4
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -165,6 +273,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
+ struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6...)>
+ : transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A6
+ , detail::expand_pattern_rest_6<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -185,6 +311,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
+ struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)>
+ : transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A7
+ , detail::expand_pattern_rest_7<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -205,6 +349,24 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
+ struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)>
+ : transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A8
+ , detail::expand_pattern_rest_8<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
@@ -225,3 +387,21 @@
>::template impl<Expr, State, Data>
{};
};
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
+ struct lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)>
+ : transform<lazy<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : lazy<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A9
+ , detail::expand_pattern_rest_9<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
Modified: trunk/boost/proto/transform/detail/preprocessed/make.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/preprocessed/make.hpp (original)
+++ trunk/boost/proto/transform/detail/preprocessed/make.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -180,6 +180,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0>
+ struct make<Object(A0...)>
+ : transform<make<Object(A0...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A0
+ , detail::expand_pattern_rest_0<
+ Object
+
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -282,6 +304,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1>
+ struct make<Object(A0 , A1...)>
+ : transform<make<Object(A0 , A1...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A1
+ , detail::expand_pattern_rest_1<
+ Object
+ , A0
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -384,6 +428,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2>
+ struct make<Object(A0 , A1 , A2...)>
+ : transform<make<Object(A0 , A1 , A2...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A2
+ , detail::expand_pattern_rest_2<
+ Object
+ , A0 , A1
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -486,6 +552,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3>
+ struct make<Object(A0 , A1 , A2 , A3...)>
+ : transform<make<Object(A0 , A1 , A2 , A3...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A3
+ , detail::expand_pattern_rest_3<
+ Object
+ , A0 , A1 , A2
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -588,6 +676,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
+ struct make<Object(A0 , A1 , A2 , A3 , A4...)>
+ : transform<make<Object(A0 , A1 , A2 , A3 , A4...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A4
+ , detail::expand_pattern_rest_4<
+ Object
+ , A0 , A1 , A2 , A3
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -690,6 +800,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
+ struct make<Object(A0 , A1 , A2 , A3 , A4 , A5...)>
+ : transform<make<Object(A0 , A1 , A2 , A3 , A4 , A5...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A5
+ , detail::expand_pattern_rest_5<
+ Object
+ , A0 , A1 , A2 , A3 , A4
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -792,6 +924,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
+ struct make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6...)>
+ : transform<make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A6
+ , detail::expand_pattern_rest_6<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -894,6 +1048,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
+ struct make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)>
+ : transform<make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A7
+ , detail::expand_pattern_rest_7<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -996,6 +1172,28 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
+ struct make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)>
+ : transform<make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A8
+ , detail::expand_pattern_rest_8<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
namespace detail
{
template<
@@ -1098,3 +1296,25 @@
}
};
};
+
+
+
+
+ template<typename Object , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
+ struct make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)>
+ : transform<make<Object(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)> >
+ {
+ template<typename Expr, typename State, typename Data>
+ struct impl
+ : make<
+ typename detail::expand_pattern<
+ proto::arity_of<Expr>::value
+ , A9
+ , detail::expand_pattern_rest_9<
+ Object
+ , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
+ >
+ >::type
+ >::template impl<Expr, State, Data>
+ {};
+ };
Added: trunk/boost/proto/transform/detail/preprocessed/pack_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/proto/transform/detail/preprocessed/pack_impl.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -0,0 +1,442 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ /// \file pack_impl.hpp
+ /// Contains helpers for pseudo-pack expansion.
+ //
+ // Copyright 2012 Eric Niebler. Distributed under the Boost
+ // Software License, Version 1.0. (See accompanying file
+ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ template<typename Fun, typename Cont>
+ struct expand_pattern<1, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret >
+ struct expand_pattern_rest_0
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void , typename B4 = void , typename B5 = void , typename B6 = void , typename B7 = void , typename B8 = void , typename B9 = void , typename B10 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret( B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3>
+ struct cat<B0 , B1 , B2 , B3>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2 , B3)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4>
+ struct cat<B0 , B1 , B2 , B3 , B4>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2 , B3 , B4)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2 , B3 , B4 , B5)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2 , B3 , B4 , B5 , B6)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6 , typename B7>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6 , typename B7 , typename B8>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7 , B8>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7 , B8)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6 , typename B7 , typename B8 , typename B9>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7 , B8 , B9>
+ {
+ typedef msvc_fun_workaround<Ret( B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7 , B8 , B9)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<2, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0>
+ struct expand_pattern_rest_1
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void , typename B4 = void , typename B5 = void , typename B6 = void , typename B7 = void , typename B8 = void , typename B9 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1 , B2)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3>
+ struct cat<B0 , B1 , B2 , B3>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1 , B2 , B3)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4>
+ struct cat<B0 , B1 , B2 , B3 , B4>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1 , B2 , B3 , B4)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1 , B2 , B3 , B4 , B5)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1 , B2 , B3 , B4 , B5 , B6)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6 , typename B7>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6 , typename B7 , typename B8>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7 , B8>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7 , B8)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<3, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1>
+ struct expand_pattern_rest_2
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void , typename B4 = void , typename B5 = void , typename B6 = void , typename B7 = void , typename B8 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0 , B1 , B2)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3>
+ struct cat<B0 , B1 , B2 , B3>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0 , B1 , B2 , B3)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4>
+ struct cat<B0 , B1 , B2 , B3 , B4>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0 , B1 , B2 , B3 , B4)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0 , B1 , B2 , B3 , B4 , B5)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0 , B1 , B2 , B3 , B4 , B5 , B6)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6 , typename B7>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , B0 , B1 , B2 , B3 , B4 , B5 , B6 , B7)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<4, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1 , typename A2>
+ struct expand_pattern_rest_3
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void , typename B4 = void , typename B5 = void , typename B6 = void , typename B7 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , B0 , B1 , B2)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3>
+ struct cat<B0 , B1 , B2 , B3>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , B0 , B1 , B2 , B3)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4>
+ struct cat<B0 , B1 , B2 , B3 , B4>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , B0 , B1 , B2 , B3 , B4)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , B0 , B1 , B2 , B3 , B4 , B5)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5 , typename B6>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5 , B6>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , B0 , B1 , B2 , B3 , B4 , B5 , B6)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<5, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3>
+ struct expand_pattern_rest_4
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void , typename B4 = void , typename B5 = void , typename B6 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , B0 , B1 , B2)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3>
+ struct cat<B0 , B1 , B2 , B3>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , B0 , B1 , B2 , B3)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4>
+ struct cat<B0 , B1 , B2 , B3 , B4>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , B0 , B1 , B2 , B3 , B4)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4 , typename B5>
+ struct cat<B0 , B1 , B2 , B3 , B4 , B5>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , B0 , B1 , B2 , B3 , B4 , B5)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<6, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
+ struct expand_pattern_rest_5
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void , typename B4 = void , typename B5 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , B0 , B1 , B2)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3>
+ struct cat<B0 , B1 , B2 , B3>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , B0 , B1 , B2 , B3)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3 , typename B4>
+ struct cat<B0 , B1 , B2 , B3 , B4>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , B0 , B1 , B2 , B3 , B4)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<7, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
+ struct expand_pattern_rest_6
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void , typename B4 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , B0 , B1 , B2)> type;
+ };
+ template<typename B0 , typename B1 , typename B2 , typename B3>
+ struct cat<B0 , B1 , B2 , B3>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , B0 , B1 , B2 , B3)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<8, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 7>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
+ struct expand_pattern_rest_7
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void , typename B3 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , B0 , B1)> type;
+ };
+ template<typename B0 , typename B1 , typename B2>
+ struct cat<B0 , B1 , B2>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , B0 , B1 , B2)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<9, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 7>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 8>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
+ struct expand_pattern_rest_8
+ {
+ template<typename B0 = void , typename B1 = void , typename B2 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , B0)> type;
+ };
+ template<typename B0 , typename B1>
+ struct cat<B0 , B1>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , B0 , B1)> type;
+ };
+ };
+ template<typename Fun, typename Cont>
+ struct expand_pattern<10, Fun, Cont>
+ : Cont::template cat<typename expand_pattern_helper<proto::_child_c< 0>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 1>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 2>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 3>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 4>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 5>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 6>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 7>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 8>, Fun>::type , typename expand_pattern_helper<proto::_child_c< 9>, Fun>::type>
+ {
+ BOOST_MPL_ASSERT_MSG(
+ (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
+ , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
+ , (Fun)
+ );
+ };
+ template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
+ struct expand_pattern_rest_9
+ {
+ template<typename B0 = void , typename B1 = void>
+ struct cat;
+ template<typename B0>
+ struct cat<B0>
+ {
+ typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , B0)> type;
+ };
+ };
Modified: trunk/boost/proto/transform/detail/preprocessed/when.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/preprocessed/when.hpp (original)
+++ trunk/boost/proto/transform/detail/preprocessed/when.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -33,46 +33,8 @@
template<typename Grammar, typename R >
struct when<Grammar, R()>
- : transform<when<Grammar, R()> >
- {
- typedef Grammar first;
- typedef R second();
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R()>
- , make<R()>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R()>
+ {};
@@ -101,46 +63,38 @@
template<typename Grammar, typename R , typename A0>
struct when<Grammar, R(A0)>
- : transform<when<Grammar, R(A0)> >
- {
- typedef Grammar first;
- typedef R second(A0);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0)>
- , make<R(A0)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0>
+ struct when<Grammar, R(A0...)>
+ : detail::when_impl<Grammar, R, R(A0...)>
+ {};
@@ -169,46 +123,38 @@
template<typename Grammar, typename R , typename A0 , typename A1>
struct when<Grammar, R(A0 , A1)>
- : transform<when<Grammar, R(A0 , A1)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1)>
- , make<R(A0 , A1)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1>
+ struct when<Grammar, R(A0 , A1...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1...)>
+ {};
@@ -237,46 +183,38 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2>
struct when<Grammar, R(A0 , A1 , A2)>
- : transform<when<Grammar, R(A0 , A1 , A2)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2)>
- , make<R(A0 , A1 , A2)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2>
+ struct when<Grammar, R(A0 , A1 , A2...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2...)>
+ {};
@@ -305,46 +243,38 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3>
struct when<Grammar, R(A0 , A1 , A2 , A3)>
- : transform<when<Grammar, R(A0 , A1 , A2 , A3)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2 , A3);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2 , A3)>
- , make<R(A0 , A1 , A2 , A3)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3>
+ struct when<Grammar, R(A0 , A1 , A2 , A3...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3...)>
+ {};
@@ -373,46 +303,38 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4)>
- : transform<when<Grammar, R(A0 , A1 , A2 , A3 , A4)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2 , A3 , A4);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2 , A3 , A4)>
- , make<R(A0 , A1 , A2 , A3 , A4)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
+ struct when<Grammar, R(A0 , A1 , A2 , A3 , A4...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4...)>
+ {};
@@ -441,46 +363,38 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5)>
- : transform<when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2 , A3 , A4 , A5);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2 , A3 , A4 , A5)>
- , make<R(A0 , A1 , A2 , A3 , A4 , A5)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
+ struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5...)>
+ {};
@@ -509,46 +423,38 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
- : transform<when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2 , A3 , A4 , A5 , A6);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
- , make<R(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
+ struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6...)>
+ {};
@@ -577,46 +483,38 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
- : transform<when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
- , make<R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
+ struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7...)>
+ {};
@@ -645,46 +543,38 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
- : transform<when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
- , make<R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
+ struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8...)>
+ {};
@@ -713,43 +603,35 @@
template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
- : transform<when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)> >
- {
- typedef Grammar first;
- typedef R second(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9);
- typedef typename Grammar::proto_grammar proto_grammar;
-
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
-
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
- , make<R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
- >::type
- which;
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
-
-
-
-
-
-
-
-
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
+ {};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ template<typename Grammar, typename R , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
+ struct when<Grammar, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)>
+ : detail::when_impl<Grammar, R, R(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9...)>
+ {};
Modified: trunk/boost/proto/transform/detail/when.hpp
==============================================================================
--- trunk/boost/proto/transform/detail/when.hpp (original)
+++ trunk/boost/proto/transform/detail/when.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -60,50 +60,41 @@
/// ObjectTransforms.
template<typename Grammar, typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A))>
- : transform<when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A))> >
- {
- typedef Grammar first;
- typedef R second(BOOST_PP_ENUM_PARAMS(N, A));
- typedef typename Grammar::proto_grammar proto_grammar;
+ : detail::when_impl<Grammar, R, R(BOOST_PP_ENUM_PARAMS(N, A))>
+ {};
- // Note: do not evaluate is_callable<R> in this scope.
- // R may be an incomplete type at this point.
-
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
- // OK to evaluate is_callable<R> here. R should be compete by now.
- typedef
- typename mpl::if_c<
- is_callable<R>::value
- , call<R(BOOST_PP_ENUM_PARAMS(N, A))> // "R" is a function to call
- , make<R(BOOST_PP_ENUM_PARAMS(N, A))> // "R" is an object to construct
- >::type
- which;
-
- typedef typename which::template impl<Expr, State, Data>::result_type result_type;
-
- /// Evaluate <tt>R(A0,A1,...)</tt> as a transform either with
- /// <tt>call\<\></tt> or with <tt>make\<\></tt> depending on
- /// whether <tt>is_callable\<R\>::value</tt> is \c true or
- /// \c false.
- ///
- /// \param e The current expression
- /// \param s The current state
- /// \param d An arbitrary data
- /// \pre <tt>matches\<Expr, Grammar\>::value</tt> is \c true
- /// \return <tt>which()(e, s, d)</tt>
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl::expr_param e
- , typename impl::state_param s
- , typename impl::data_param d
- ) const
- {
- return typename which::template impl<Expr, State, Data>()(e, s, d);
- }
- };
- };
+ #if N > 0
+ /// \brief A grammar element and a PrimitiveTransform that associates
+ /// a transform with the grammar.
+ ///
+ /// Use <tt>when\<\></tt> to override a grammar's default transform
+ /// with a custom transform. It is for used when composing larger
+ /// transforms by associating smaller transforms with individual
+ /// rules in your grammar, as in the following transform which
+ /// counts the number of terminals in an expression.
+ ///
+ /// \code
+ /// // Count the terminals in an expression tree.
+ /// // Must be invoked with initial state == mpl::int_<0>().
+ /// struct CountLeaves
+ /// : or_<
+ /// when<terminal<_>, mpl::next<_state>()>
+ /// , otherwise<fold<_, _state, CountLeaves> >
+ /// >
+ /// {};
+ /// \endcode
+ ///
+ /// The <tt>when\<G, R(A0,A1,...)\></tt> form accepts either a
+ /// CallableTransform or an ObjectTransform as its second parameter.
+ /// <tt>when\<\></tt> uses <tt>is_callable\<R\>::value</tt> to
+ /// distinguish between the two, and uses <tt>call\<\></tt> to
+ /// evaluate CallableTransforms and <tt>make\<\></tt> to evaluate
+ /// ObjectTransforms.
+ template<typename Grammar, typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A)...)>
+ : detail::when_impl<Grammar, R, R(BOOST_PP_ENUM_PARAMS(N, A)...)>
+ {};
+ #endif
#undef N
Modified: trunk/boost/proto/transform/lazy.hpp
==============================================================================
--- trunk/boost/proto/transform/lazy.hpp (original)
+++ trunk/boost/proto/transform/lazy.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -16,6 +16,7 @@
#include <boost/proto/transform/make.hpp>
#include <boost/proto/transform/call.hpp>
#include <boost/proto/transform/impl.hpp>
+#include <boost/proto/transform/detail/pack.hpp>
namespace boost { namespace proto
{
@@ -38,6 +39,12 @@
{};
};
+ /// INTERNAL ONLY
+ template<typename Fun>
+ struct lazy<detail::msvc_fun_workaround<Fun> >
+ : lazy<Fun>
+ {};
+
#include <boost/proto/transform/detail/lazy.hpp>
/// INTERNAL ONLY
Modified: trunk/boost/proto/transform/make.hpp
==============================================================================
--- trunk/boost/proto/transform/make.hpp (original)
+++ trunk/boost/proto/transform/make.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -29,6 +29,7 @@
#include <boost/proto/traits.hpp>
#include <boost/proto/args.hpp>
#include <boost/proto/transform/impl.hpp>
+#include <boost/proto/transform/detail/pack.hpp>
#include <boost/proto/detail/as_lvalue.hpp>
#include <boost/proto/detail/ignore_unused.hpp>
@@ -250,6 +251,12 @@
};
};
+ /// INTERNAL ONLY
+ template<typename Fun>
+ struct make<detail::msvc_fun_workaround<Fun> >
+ : make<Fun>
+ {};
+
// Other specializations generated by the preprocessor.
#include <boost/proto/transform/detail/make.hpp>
#include <boost/proto/transform/detail/make_gcc_workaround.hpp>
Modified: trunk/boost/proto/transform/when.hpp
==============================================================================
--- trunk/boost/proto/transform/when.hpp (original)
+++ trunk/boost/proto/transform/when.hpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -29,6 +29,56 @@
namespace boost { namespace proto
{
+ namespace detail
+ {
+ template<typename Grammar, typename R, typename Fun>
+ struct when_impl
+ : transform<when<Grammar, Fun> >
+ {
+ typedef Grammar first;
+ typedef Fun second;
+ typedef typename Grammar::proto_grammar proto_grammar;
+
+ // Note: do not evaluate is_callable<R> in this scope.
+ // R may be an incomplete type at this point.
+
+ template<typename Expr, typename State, typename Data>
+ struct impl : transform_impl<Expr, State, Data>
+ {
+ // OK to evaluate is_callable<R> here. R should be compete by now.
+ typedef
+ typename mpl::if_c<
+ is_callable<R>::value
+ , proto::call<Fun> // "R" is a function to call
+ , proto::make<Fun> // "R" is an object to construct
+ >::type
+ which;
+
+ typedef typename which::template impl<Expr, State, Data>::result_type result_type;
+
+ /// Evaluate <tt>R(A0,A1,...)</tt> as a transform either with
+ /// <tt>call\<\></tt> or with <tt>make\<\></tt> depending on
+ /// whether <tt>is_callable\<R\>::value</tt> is \c true or
+ /// \c false.
+ ///
+ /// \param e The current expression
+ /// \param s The current state
+ /// \param d An arbitrary data
+ /// \pre <tt>matches\<Expr, Grammar\>::value</tt> is \c true
+ /// \return <tt>which()(e, s, d)</tt>
+ BOOST_FORCEINLINE
+ result_type operator ()(
+ typename impl::expr_param e
+ , typename impl::state_param s
+ , typename impl::data_param d
+ ) const
+ {
+ return typename which::template impl<Expr, State, Data>()(e, s, d);
+ }
+ };
+ };
+ }
+
/// \brief A grammar element and a PrimitiveTransform that associates
/// a transform with the grammar.
///
Modified: trunk/libs/proto/preprocess/Jamfile.v2
==============================================================================
--- trunk/libs/proto/preprocess/Jamfile.v2 (original)
+++ trunk/libs/proto/preprocess/Jamfile.v2 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -6,7 +6,7 @@
actions wave
{
- $(>[2]) -o- -DBOOST_PROTO_MAX_ARITY=5 --config-file wave.cfg $(>[1])
+ $(>[2]) -o- -DBOOST_PROTO_MAX_ARITY=10 --config-file wave.cfg $(>[1])
}
W = ../../../tools/wave/build//wave ;
Modified: trunk/libs/proto/preprocess/wave.cfg
==============================================================================
--- trunk/libs/proto/preprocess/wave.cfg (original)
+++ trunk/libs/proto/preprocess/wave.cfg 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -16,6 +16,9 @@
-NBOOST_PROTO_GET_POINTER
-NBOOST_PROTO_ASSERT_VALID_DOMAIN
-NBOOST_FORCEINLINE
+-NBOOST_MPL_ASSERT
+-NBOOST_MPL_ASSERT_MSG
+-NBOOST_MPL_ASSERT_RELATION
-S../../..
-S"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
-S.
Modified: trunk/libs/proto/test/Jamfile.v2
==============================================================================
--- trunk/libs/proto/test/Jamfile.v2 (original)
+++ trunk/libs/proto/test/Jamfile.v2 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -35,8 +35,9 @@
[ run toy_spirit.cpp ]
[ run toy_spirit2.cpp ]
[ run make.cpp ]
- [ run noinvoke.cpp ]
[ run mem_ptr.cpp : : : <toolset>msvc:<cxxflags>/wd4355 ]
+ [ run noinvoke.cpp ]
+ [ run pack_expansion.cpp ]
[ compile bug2407.cpp ]
;
Added: trunk/libs/proto/test/pack_expansion.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/proto/test/pack_expansion.cpp 2012-07-12 17:54:30 EDT (Thu, 12 Jul 2012)
@@ -0,0 +1,109 @@
+///////////////////////////////////////////////////////////////////////////////
+// pack_expansion.hpp
+//
+// Copyright 2008 Eric Niebler. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/proto/proto.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/typeof/typeof.hpp>
+
+namespace mpl = boost::mpl;
+namespace proto = boost::proto;
+using proto::_;
+
+template<typename T> T declval();
+
+struct eval_ : proto::callable
+{
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Left, typename Right>
+ struct result<This(proto::tag::plus, Left, Right)>
+ {
+ typedef BOOST_TYPEOF_TPL(declval<Left>() + declval<Right>()) type;
+ };
+
+ template<typename This, typename Left, typename Right>
+ struct result<This(proto::tag::multiplies, Left, Right)>
+ {
+ typedef BOOST_TYPEOF_TPL(declval<Left>() * declval<Right>()) type;
+ };
+
+ template<typename Left, typename Right>
+ typename result<eval_(proto::tag::plus, Left, Right)>::type
+ operator()(proto::tag::plus, Left left, Right right) const
+ {
+ return left + right;
+ }
+
+ template<typename Left, typename Right>
+ typename result<eval_(proto::tag::multiplies, Left, Right)>::type
+ operator()(proto::tag::multiplies, Left left, Right right) const
+ {
+ return left * right;
+ }
+};
+
+struct eval1
+ : proto::or_<
+ proto::when<proto::terminal<_>, proto::_value>
+ , proto::otherwise<eval_(proto::tag_of<_>(), eval1(proto::pack(_))...)>
+ >
+{};
+
+struct eval2
+ : proto::or_<
+ proto::when<proto::terminal<_>, proto::_value>
+ , proto::otherwise<proto::call<eval_(proto::tag_of<_>(), eval2(proto::pack(_))...)> >
+ >
+{};
+
+void test_call_pack()
+{
+ proto::terminal<int>::type i = {42};
+ int res = eval1()(i + 2);
+ BOOST_CHECK_EQUAL(res, 44);
+ res = eval1()(i * 2);
+ BOOST_CHECK_EQUAL(res, 84);
+ res = eval1()(i * 2 + 4);
+ BOOST_CHECK_EQUAL(res, 88);
+
+ res = eval2()(i + 2);
+ BOOST_CHECK_EQUAL(res, 44);
+ res = eval2()(i * 2);
+ BOOST_CHECK_EQUAL(res, 84);
+ res = eval2()(i * 2 + 4);
+ BOOST_CHECK_EQUAL(res, 88);
+}
+
+struct make_pair
+ : proto::when<
+ proto::binary_expr<_, proto::terminal<int>, proto::terminal<int> >
+ , std::pair<int, int>(proto::_value(proto::pack(_))...)
+ >
+{};
+
+void test_make_pack()
+{
+ proto::terminal<int>::type i = {42};
+ std::pair<int, int> p = make_pair()(i + 43);
+ BOOST_CHECK_EQUAL(p.first, 42);
+ BOOST_CHECK_EQUAL(p.second, 43);
+}
+
+using namespace boost::unit_test;
+///////////////////////////////////////////////////////////////////////////////
+// init_unit_test_suite
+//
+test_suite* init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite *test = BOOST_TEST_SUITE("test immediate evaluation of proto parse trees");
+
+ test->add(BOOST_TEST_CASE(&test_call_pack));
+ test->add(BOOST_TEST_CASE(&test_make_pack));
+
+ return test;
+}
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