diff options
Diffstat (limited to 'boost/proto/transform')
22 files changed, 1901 insertions, 497 deletions
diff --git a/boost/proto/transform/call.hpp b/boost/proto/transform/call.hpp index ecee355112..7d87c906d6 100644 --- a/boost/proto/transform/call.hpp +++ b/boost/proto/transform/call.hpp @@ -9,6 +9,11 @@ #ifndef BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007 #define BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007 +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(push) +# pragma warning(disable: 4714) // function 'xxx' marked as __forceinline not inlined +#endif + #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/facilities/intercept.hpp> #include <boost/preprocessor/iteration/iterate.hpp> @@ -24,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 { @@ -79,6 +85,29 @@ namespace boost { namespace proto : 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. @@ -365,4 +394,8 @@ namespace boost { namespace proto }} // namespace boost::proto +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/transform/default.hpp b/boost/proto/transform/default.hpp index 706689d059..26a4682415 100644 --- a/boost/proto/transform/default.hpp +++ b/boost/proto/transform/default.hpp @@ -545,7 +545,7 @@ namespace boost { namespace proto BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->* BOOST_PROTO_DEFAULT_EVAL(~, 0, e) )(); } @@ -561,7 +561,7 @@ namespace boost { namespace proto BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->* BOOST_PROTO_DEFAULT_EVAL(~, 0, e) ); } diff --git a/boost/proto/transform/detail/call.hpp b/boost/proto/transform/detail/call.hpp index d0ebca1db9..629f4de95e 100644 --- a/boost/proto/transform/detail/call.hpp +++ b/boost/proto/transform/detail/call.hpp @@ -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 // BUGBUG this isn't right. Could be pack(_child), should use arity of child! + , 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 diff --git a/boost/proto/transform/detail/default_function_impl.hpp b/boost/proto/transform/detail/default_function_impl.hpp index dc339aff29..e46d8368db 100644 --- a/boost/proto/transform/detail/default_function_impl.hpp +++ b/boost/proto/transform/detail/default_function_impl.hpp @@ -86,7 +86,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->* BOOST_PROTO_DEFAULT_EVAL(~, 0, e) )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEF_FUN_INVOKE_ARG, e)); } diff --git a/boost/proto/transform/detail/expand_pack.hpp b/boost/proto/transform/detail/expand_pack.hpp new file mode 100644 index 0000000000..c87e3807c4 --- /dev/null +++ b/boost/proto/transform/detail/expand_pack.hpp @@ -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 diff --git a/boost/proto/transform/detail/lazy.hpp b/boost/proto/transform/detail/lazy.hpp index 26a9c5b3d0..fbd13651cf 100644 --- a/boost/proto/transform/detail/lazy.hpp +++ b/boost/proto/transform/detail/lazy.hpp @@ -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 diff --git a/boost/proto/transform/detail/make.hpp b/boost/proto/transform/detail/make.hpp index e03a832811..31a89cc764 100644 --- a/boost/proto/transform/detail/make.hpp +++ b/boost/proto/transform/detail/make.hpp @@ -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 diff --git a/boost/proto/transform/detail/pack.hpp b/boost/proto/transform/detail/pack.hpp new file mode 100644 index 0000000000..863e7a02c4 --- /dev/null +++ b/boost/proto/transform/detail/pack.hpp @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////// +/// \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/type_traits/is_same.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)> + { + // BUGBUG fix me. See comment in transform/detail/call.hpp + BOOST_MPL_ASSERT_MSG( + (is_same<T, _>::value) + , PACK_EXPANSIONS_OF_EXPRESSIONS_OTHER_THAN_THE_CURRENT_NOT_YET_SUPPORTED + , (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 diff --git a/boost/proto/transform/detail/pack_impl.hpp b/boost/proto/transform/detail/pack_impl.hpp new file mode 100644 index 0000000000..d5f10afd23 --- /dev/null +++ b/boost/proto/transform/detail/pack_impl.hpp @@ -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_UNPACKING_PATTERN + , (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 C, 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 C)> + struct cat<BOOST_PP_ENUM_PARAMS(I, C)> + { + typedef msvc_fun_workaround<Ret(BOOST_PP_ENUM_PARAMS(J, A) BOOST_PP_COMMA_IF(J) BOOST_PP_ENUM_PARAMS(I, C))> type; + }; + #undef J + #undef I + #endif +#endif diff --git a/boost/proto/transform/detail/preprocessed/call.hpp b/boost/proto/transform/detail/preprocessed/call.hpp index 6a3e357982..54575ccc15 100644 --- a/boost/proto/transform/detail/preprocessed/call.hpp +++ b/boost/proto/transform/detail/preprocessed/call.hpp @@ -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> + {}; + }; diff --git a/boost/proto/transform/detail/preprocessed/default_function_impl.hpp b/boost/proto/transform/detail/preprocessed/default_function_impl.hpp index dc13095f32..9086c9a322 100644 --- a/boost/proto/transform/detail/preprocessed/default_function_impl.hpp +++ b/boost/proto/transform/detail/preprocessed/default_function_impl.hpp @@ -49,7 +49,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d )); } @@ -97,7 +97,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d )); } @@ -145,7 +145,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d )); } @@ -193,7 +193,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d )); } @@ -241,7 +241,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d )); } @@ -289,7 +289,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d )); } @@ -337,7 +337,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d )); } @@ -385,7 +385,7 @@ BOOST_PROTO_USE_GET_POINTER(); typedef typename detail::classtypeof<function_type>::type class_type; return ( - BOOST_PROTO_GET_POINTER(class_type, BOOST_PROTO_DEFAULT_EVAL(~, 1, e)) ->* + BOOST_PROTO_GET_POINTER(class_type, (typename Grammar::template impl<e1, State, Data>()( proto::child_c< 1>( e), s, d ))) ->* typename Grammar::template impl<e0, State, Data>()( proto::child_c< 0>( e), s, d ) )(typename Grammar::template impl<e2, State, Data>()( proto::child_c< 2>( e), s, d ) , typename Grammar::template impl<e3, State, Data>()( proto::child_c< 3>( e), s, d ) , typename Grammar::template impl<e4, State, Data>()( proto::child_c< 4>( e), s, d ) , typename Grammar::template impl<e5, State, Data>()( proto::child_c< 5>( e), s, d ) , typename Grammar::template impl<e6, State, Data>()( proto::child_c< 6>( e), s, d ) , typename Grammar::template impl<e7, State, Data>()( proto::child_c< 7>( e), s, d ) , typename Grammar::template impl<e8, State, Data>()( proto::child_c< 8>( e), s, d ) , typename Grammar::template impl<e9, State, Data>()( proto::child_c< 9>( e), s, d )); } diff --git a/boost/proto/transform/detail/preprocessed/expand_pack.hpp b/boost/proto/transform/detail/preprocessed/expand_pack.hpp new file mode 100644 index 0000000000..8f758a3fa9 --- /dev/null +++ b/boost/proto/transform/detail/preprocessed/expand_pack.hpp @@ -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; + }; diff --git a/boost/proto/transform/detail/preprocessed/lazy.hpp b/boost/proto/transform/detail/preprocessed/lazy.hpp index af0f90651a..c32d20fa25 100644 --- a/boost/proto/transform/detail/preprocessed/lazy.hpp +++ b/boost/proto/transform/detail/preprocessed/lazy.hpp @@ -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> + {}; + }; diff --git a/boost/proto/transform/detail/preprocessed/make.hpp b/boost/proto/transform/detail/preprocessed/make.hpp index 6ab9b38563..e5811277ed 100644 --- a/boost/proto/transform/detail/preprocessed/make.hpp +++ b/boost/proto/transform/detail/preprocessed/make.hpp @@ -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> + {}; + }; diff --git a/boost/proto/transform/detail/preprocessed/pack_impl.hpp b/boost/proto/transform/detail/preprocessed/pack_impl.hpp new file mode 100644 index 0000000000..802bb6abc1 --- /dev/null +++ b/boost/proto/transform/detail/preprocessed/pack_impl.hpp @@ -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_UNPACKING_PATTERN + , (Fun) + ); + }; + template<typename Ret > + struct expand_pattern_rest_0 + { + template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void , typename C8 = void , typename C9 = void , typename C10 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret( C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret( C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3> + struct cat<C0 , C1 , C2 , C3> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4> + struct cat<C0 , C1 , C2 , C3 , C4> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5> + struct cat<C0 , C1 , C2 , C3 , C4 , C5> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7 , typename C8> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7 , typename C8 , typename C9> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9> + { + typedef msvc_fun_workaround<Ret( C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8 , C9)> 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_UNPACKING_PATTERN + , (Fun) + ); + }; + template<typename Ret , typename A0> + struct expand_pattern_rest_1 + { + template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void , typename C8 = void , typename C9 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3> + struct cat<C0 , C1 , C2 , C3> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4> + struct cat<C0 , C1 , C2 , C3 , C4> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5> + struct cat<C0 , C1 , C2 , C3 , C4 , C5> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5 , C6)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7 , typename C8> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8> + { + typedef msvc_fun_workaround<Ret(A0 , C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7 , C8)> 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_UNPACKING_PATTERN + , (Fun) + ); + }; + template<typename Ret , typename A0 , typename A1> + struct expand_pattern_rest_2 + { + template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void , typename C8 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3> + struct cat<C0 , C1 , C2 , C3> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4> + struct cat<C0 , C1 , C2 , C3 , C4> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5> + struct cat<C0 , C1 , C2 , C3 , C4 , C5> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4 , C5)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4 , C5 , C6)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6 , typename C7> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , C0 , C1 , C2 , C3 , C4 , C5 , C6 , C7)> 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_UNPACKING_PATTERN + , (Fun) + ); + }; + template<typename Ret , typename A0 , typename A1 , typename A2> + struct expand_pattern_rest_3 + { + template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void , typename C7 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3> + struct cat<C0 , C1 , C2 , C3> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4> + struct cat<C0 , C1 , C2 , C3 , C4> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3 , C4)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5> + struct cat<C0 , C1 , C2 , C3 , C4 , C5> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3 , C4 , C5)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5 , typename C6> + struct cat<C0 , C1 , C2 , C3 , C4 , C5 , C6> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , C0 , C1 , C2 , C3 , C4 , C5 , C6)> 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_UNPACKING_PATTERN + , (Fun) + ); + }; + template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3> + struct expand_pattern_rest_4 + { + template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void , typename C6 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3> + struct cat<C0 , C1 , C2 , C3> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2 , C3)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4> + struct cat<C0 , C1 , C2 , C3 , C4> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2 , C3 , C4)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4 , typename C5> + struct cat<C0 , C1 , C2 , C3 , C4 , C5> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , C0 , C1 , C2 , C3 , C4 , C5)> 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_UNPACKING_PATTERN + , (Fun) + ); + }; + template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4> + struct expand_pattern_rest_5 + { + template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void , typename C5 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1 , C2)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3> + struct cat<C0 , C1 , C2 , C3> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1 , C2 , C3)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3 , typename C4> + struct cat<C0 , C1 , C2 , C3 , C4> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , C0 , C1 , C2 , C3 , C4)> 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_UNPACKING_PATTERN + , (Fun) + ); + }; + template<typename Ret , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5> + struct expand_pattern_rest_6 + { + template<typename C0 = void , typename C1 = void , typename C2 = void , typename C3 = void , typename C4 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0 , C1 , C2)> type; + }; + template<typename C0 , typename C1 , typename C2 , typename C3> + struct cat<C0 , C1 , C2 , C3> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , C0 , C1 , C2 , C3)> 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_UNPACKING_PATTERN + , (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 C0 = void , typename C1 = void , typename C2 = void , typename C3 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , C0 , C1)> type; + }; + template<typename C0 , typename C1 , typename C2> + struct cat<C0 , C1 , C2> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , C0 , C1 , C2)> 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_UNPACKING_PATTERN + , (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 C0 = void , typename C1 = void , typename C2 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , C0)> type; + }; + template<typename C0 , typename C1> + struct cat<C0 , C1> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , C0 , C1)> 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_UNPACKING_PATTERN + , (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 C0 = void , typename C1 = void> + struct cat; + template<typename C0> + struct cat<C0> + { + typedef msvc_fun_workaround<Ret(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , C0)> type; + }; + }; diff --git a/boost/proto/transform/detail/preprocessed/when.hpp b/boost/proto/transform/detail/preprocessed/when.hpp index 51b24ef7b2..9f5acc9f6f 100644 --- a/boost/proto/transform/detail/preprocessed/when.hpp +++ b/boost/proto/transform/detail/preprocessed/when.hpp @@ -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...)> + {}; diff --git a/boost/proto/transform/detail/when.hpp b/boost/proto/transform/detail/when.hpp index 5977eff728..136210758b 100644 --- a/boost/proto/transform/detail/when.hpp +++ b/boost/proto/transform/detail/when.hpp @@ -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 diff --git a/boost/proto/transform/impl.hpp b/boost/proto/transform/impl.hpp index ecb0cc6c04..80e9a624f0 100644 --- a/boost/proto/transform/impl.hpp +++ b/boost/proto/transform/impl.hpp @@ -12,6 +12,11 @@ #include <boost/config.hpp> #include <boost/proto/proto_fwd.hpp> +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(push) +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined +#endif + namespace boost { namespace proto { #ifdef BOOST_NO_RVALUE_REFERENCES @@ -238,4 +243,8 @@ namespace boost { namespace proto }} // namespace boost::proto +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/transform/lazy.hpp b/boost/proto/transform/lazy.hpp index 7cdb68f921..e2d43abad1 100644 --- a/boost/proto/transform/lazy.hpp +++ b/boost/proto/transform/lazy.hpp @@ -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 @@ namespace boost { namespace proto {}; }; + /// INTERNAL ONLY + template<typename Fun> + struct lazy<detail::msvc_fun_workaround<Fun> > + : lazy<Fun> + {}; + #include <boost/proto/transform/detail/lazy.hpp> /// INTERNAL ONLY diff --git a/boost/proto/transform/make.hpp b/boost/proto/transform/make.hpp index eec3292509..1f183d9343 100644 --- a/boost/proto/transform/make.hpp +++ b/boost/proto/transform/make.hpp @@ -29,9 +29,15 @@ #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> +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(push) +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined +#endif + namespace boost { namespace proto { namespace detail @@ -245,6 +251,12 @@ namespace boost { namespace proto }; }; + /// 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> @@ -265,4 +277,8 @@ namespace boost { namespace proto }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/transform/pass_through.hpp b/boost/proto/transform/pass_through.hpp index ac12d97e12..d53d15a840 100644 --- a/boost/proto/transform/pass_through.hpp +++ b/boost/proto/transform/pass_through.hpp @@ -22,6 +22,11 @@ #include <boost/proto/transform/impl.hpp> #include <boost/proto/detail/ignore_unused.hpp> +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(push) +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined +#endif + namespace boost { namespace proto { namespace detail @@ -134,4 +139,8 @@ namespace boost { namespace proto }} // namespace boost::proto +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/transform/when.hpp b/boost/proto/transform/when.hpp index 4bbb8a7aa8..bd4cb9fa6a 100644 --- a/boost/proto/transform/when.hpp +++ b/boost/proto/transform/when.hpp @@ -22,8 +22,63 @@ #include <boost/proto/transform/make.hpp> #include <boost/proto/transform/impl.hpp> +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(push) +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined +#endif + 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. /// @@ -194,4 +249,8 @@ namespace boost { namespace proto }} // namespace boost::proto +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif |