diff options
Diffstat (limited to 'boost/proto')
42 files changed, 2072 insertions, 555 deletions
diff --git a/boost/proto/context/default.hpp b/boost/proto/context/default.hpp index 5dd7e4e651..6aeb596289 100644 --- a/boost/proto/context/default.hpp +++ b/boost/proto/context/default.hpp @@ -366,7 +366,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, expr))) ->* BOOST_PROTO_DEFAULT_EVAL(~, 0, expr) )(); } @@ -376,7 +376,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, expr))) ->* BOOST_PROTO_DEFAULT_EVAL(~, 0, expr) ); } diff --git a/boost/proto/context/detail/default_eval.hpp b/boost/proto/context/detail/default_eval.hpp index b875c9f62c..4114f92943 100644 --- a/boost/proto/context/detail/default_eval.hpp +++ b/boost/proto/context/detail/default_eval.hpp @@ -71,7 +71,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, expr))) ->* BOOST_PROTO_DEFAULT_EVAL(~, 0, expr) )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEFAULT_EVAL_SHIFTED, expr)); } diff --git a/boost/proto/context/detail/preprocessed/default_eval.hpp b/boost/proto/context/detail/preprocessed/default_eval.hpp index 8b7d249924..4efde73d5d 100644 --- a/boost/proto/context/detail/preprocessed/default_eval.hpp +++ b/boost/proto/context/detail/preprocessed/default_eval.hpp @@ -34,7 +34,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context)); } @@ -68,7 +68,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context)); } @@ -102,7 +102,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context)); } @@ -136,7 +136,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context)); } @@ -170,7 +170,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context)); } @@ -204,7 +204,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context)); } @@ -238,7 +238,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context) , proto::eval(proto::child_c< 8>( expr), context)); } @@ -272,7 +272,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, expr)) ->* + BOOST_PROTO_GET_POINTER(class_type, (proto::eval(proto::child_c< 1>( expr), context))) ->* proto::eval(proto::child_c< 0>( expr), context) )(proto::eval(proto::child_c< 2>( expr), context) , proto::eval(proto::child_c< 3>( expr), context) , proto::eval(proto::child_c< 4>( expr), context) , proto::eval(proto::child_c< 5>( expr), context) , proto::eval(proto::child_c< 6>( expr), context) , proto::eval(proto::child_c< 7>( expr), context) , proto::eval(proto::child_c< 8>( expr), context) , proto::eval(proto::child_c< 9>( expr), context)); } diff --git a/boost/proto/debug.hpp b/boost/proto/debug.hpp index 02b2c7b49a..f732bc2a99 100644 --- a/boost/proto/debug.hpp +++ b/boost/proto/debug.hpp @@ -91,6 +91,9 @@ namespace boost { namespace proto {} std::ostream &sout_; + + private: + ostream_wrapper &operator =(ostream_wrapper const &); }; struct named_any diff --git a/boost/proto/detail/as_expr.hpp b/boost/proto/detail/as_expr.hpp index 83769f20ba..fb46576b89 100644 --- a/boost/proto/detail/as_expr.hpp +++ b/boost/proto/detail/as_expr.hpp @@ -17,6 +17,11 @@ #include <boost/proto/proto_fwd.hpp> #include <boost/proto/args.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 { @@ -175,4 +180,8 @@ namespace boost { namespace proto { namespace detail }}} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/detail/as_lvalue.hpp b/boost/proto/detail/as_lvalue.hpp index 4ef375c407..8ff9091b28 100644 --- a/boost/proto/detail/as_lvalue.hpp +++ b/boost/proto/detail/as_lvalue.hpp @@ -11,6 +11,11 @@ #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 { namespace detail @@ -31,4 +36,8 @@ namespace boost { namespace proto } }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/detail/decltype.hpp b/boost/proto/detail/decltype.hpp index 6b7416b1b1..92679ab274 100644 --- a/boost/proto/detail/decltype.hpp +++ b/boost/proto/detail/decltype.hpp @@ -34,6 +34,11 @@ #include <boost/utility/result_of.hpp> #include <boost/utility/enable_if.hpp> +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(push) +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined +#endif + #ifndef BOOST_NO_DECLTYPE # define BOOST_PROTO_DECLTYPE_(EXPR, TYPE) typedef decltype(EXPR) TYPE; #else @@ -498,4 +503,8 @@ namespace boost { namespace proto } // namespace detail }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/detail/deduce_domain.hpp b/boost/proto/detail/deduce_domain.hpp index 5b56ee2bf3..630304f842 100644 --- a/boost/proto/detail/deduce_domain.hpp +++ b/boost/proto/detail/deduce_domain.hpp @@ -19,6 +19,7 @@ #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/facilities/intercept.hpp> #include <boost/preprocessor/iteration/local.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> #include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/repeat_from_to.hpp> diff --git a/boost/proto/detail/dont_care.hpp b/boost/proto/detail/dont_care.hpp index 44f9371f91..262340e2b4 100644 --- a/boost/proto/detail/dont_care.hpp +++ b/boost/proto/detail/dont_care.hpp @@ -11,6 +11,11 @@ #include <boost/config.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 @@ -22,4 +27,8 @@ namespace boost { namespace proto } }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/detail/ignore_unused.hpp b/boost/proto/detail/ignore_unused.hpp index dda1ca0fe2..6004b83d98 100644 --- a/boost/proto/detail/ignore_unused.hpp +++ b/boost/proto/detail/ignore_unused.hpp @@ -12,6 +12,11 @@ #include <boost/config.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 @@ -22,4 +27,8 @@ namespace boost { namespace proto } }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/domain.hpp b/boost/proto/domain.hpp index 471152a068..44bc45d36b 100644 --- a/boost/proto/domain.hpp +++ b/boost/proto/domain.hpp @@ -18,6 +18,11 @@ #include <boost/proto/detail/as_expr.hpp> #include <boost/proto/detail/deduce_domain.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 { @@ -325,4 +330,8 @@ namespace boost { namespace proto }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/expr.hpp b/boost/proto/expr.hpp index 410b7ebea1..cb8a28f6e9 100644 --- a/boost/proto/expr.hpp +++ b/boost/proto/expr.hpp @@ -31,6 +31,7 @@ # pragma warning(disable : 4510) // default constructor could not be generated # pragma warning(disable : 4512) // assignment operator could not be generated # pragma warning(disable : 4610) // user defined constructor required +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined #endif namespace boost { namespace proto diff --git a/boost/proto/extends.hpp b/boost/proto/extends.hpp index 7d5678a80d..3a8151964c 100644 --- a/boost/proto/extends.hpp +++ b/boost/proto/extends.hpp @@ -34,10 +34,9 @@ #include <boost/proto/generate.hpp> #include <boost/proto/detail/remove_typename.hpp> -#ifdef _MSC_VER -#define BOOST_PROTO_DISABLE_MSVC_C4522 __pragma(warning(disable: 4522)) -#else -#define BOOST_PROTO_DISABLE_MSVC_C4522 +#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 @@ -75,7 +74,7 @@ namespace boost { namespace proto /// #define BOOST_PROTO_DEFINE_FUN_OP_IMPL_(Z, N, DATA, Const) \ BOOST_PP_IF(N, BOOST_PROTO_TEMPLATE_YES_, BOOST_PROTO_TEMPLATE_NO_)(Z, N) \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename BOOST_PROTO_RESULT_OF< \ proto_generator( \ typename boost::proto::result_of::BOOST_PP_CAT(funop, N)< \ @@ -105,7 +104,7 @@ namespace boost { namespace proto /// #define BOOST_PROTO_DEFINE_FUN_OP_VARIADIC_IMPL_(Const) \ template<typename... A> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename BOOST_PROTO_RESULT_OF< \ proto_generator( \ typename boost::proto::result_of::funop< \ @@ -176,26 +175,26 @@ namespace boost { namespace proto typedef boost::proto::tag::proto_expr fusion_tag; \ BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_EXTENDS_CHILD, ~) \ \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ static proto_derived_expr const make(Expr const &e) \ { \ proto_derived_expr that = {e}; \ return that; \ } \ \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ proto_base_expr &proto_base() \ { \ return this->proto_expr_.proto_base(); \ } \ \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ proto_base_expr const &proto_base() const \ { \ return this->proto_expr_.proto_base(); \ } \ \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ operator proto_address_of_hack_type_() const \ { \ return boost::addressof(this->proto_base().child0); \ @@ -209,7 +208,7 @@ namespace boost { namespace proto #define BOOST_PROTO_EXTENDS_COPY_ASSIGN_IMPL_(This, Const, Typename) \ BOOST_PROTO_DISABLE_MSVC_C4522 \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ Typename() BOOST_PROTO_RESULT_OF< \ Typename() This::proto_generator( \ Typename() boost::proto::base_expr< \ @@ -259,7 +258,7 @@ namespace boost { namespace proto /// #define BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(ThisConst, ThatConst) \ template<typename A> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename BOOST_PROTO_RESULT_OF< \ proto_generator( \ typename boost::proto::base_expr< \ @@ -326,7 +325,7 @@ namespace boost { namespace proto /// #define BOOST_PROTO_EXTENDS_SUBSCRIPT_IMPL_(ThisConst, ThatConst) \ template<typename A> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename BOOST_PROTO_RESULT_OF< \ proto_generator( \ typename boost::proto::base_expr< \ @@ -641,4 +640,8 @@ namespace boost { namespace proto }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/fusion.hpp b/boost/proto/fusion.hpp index c35a0741a6..198a34503d 100644 --- a/boost/proto/fusion.hpp +++ b/boost/proto/fusion.hpp @@ -44,12 +44,11 @@ namespace boost { namespace proto : fusion::iterator_base<expr_iterator<Expr, Pos> > { typedef Expr expr_type; - typedef typename Expr::proto_tag proto_tag; static const long index = Pos; typedef fusion::random_access_traversal_tag category; typedef tag::proto_expr_iterator fusion_tag; - expr_iterator(Expr &e) + explicit expr_iterator(Expr &e) : expr(e) {} @@ -60,7 +59,6 @@ namespace boost { namespace proto struct flat_view { typedef Expr expr_type; - typedef typename Expr::proto_tag proto_tag; typedef fusion::forward_traversal_tag category; typedef tag::proto_flat_view fusion_tag; @@ -373,7 +371,7 @@ namespace boost { namespace fusion struct apply { typedef - typename proto::detail::expr_iterator< + proto::detail::expr_iterator< typename Iterator::expr_type , Iterator::index + N::value > @@ -583,12 +581,14 @@ namespace boost { namespace fusion template<typename Sequence> struct apply { - typedef typename Sequence::proto_tag proto_tag; + typedef typename Sequence::expr_type::proto_tag proto_tag; - typedef fusion::transform_view< - typename Sequence::expr_type - , proto::detail::as_element<proto_tag> - > type; + typedef + fusion::transform_view< + typename Sequence::expr_type + , proto::detail::as_element<proto_tag> + > + type; static type call(Sequence &sequence) { @@ -639,7 +639,6 @@ namespace boost { namespace fusion : mpl::false_ {}; } - }} namespace boost { namespace mpl @@ -655,7 +654,7 @@ namespace boost { namespace mpl { typedef fusion::fusion_sequence_tag type; }; -}} +}} #ifdef BOOST_MSVC #pragma warning(pop) diff --git a/boost/proto/generate.hpp b/boost/proto/generate.hpp index 87f3adfb50..f6eab4d966 100644 --- a/boost/proto/generate.hpp +++ b/boost/proto/generate.hpp @@ -24,6 +24,11 @@ #include <boost/proto/proto_fwd.hpp> #include <boost/proto/args.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 { @@ -440,4 +445,8 @@ namespace boost #endif } +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif // BOOST_PROTO_GENERATE_HPP_EAN_02_13_2007 diff --git a/boost/proto/make_expr.hpp b/boost/proto/make_expr.hpp index 9080a4f4a6..08ef2f5ce1 100644 --- a/boost/proto/make_expr.hpp +++ b/boost/proto/make_expr.hpp @@ -45,9 +45,10 @@ #include <boost/proto/detail/poly_function.hpp> #include <boost/proto/detail/deprecated.hpp> -#ifdef _MSC_VER +#if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma warning(push) -# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored +# pragma warning(disable : 4180) // qualifier applied to function type has no meaning; ignored +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined #endif namespace boost { namespace proto @@ -501,7 +502,7 @@ namespace boost { namespace proto }} -#ifdef _MSC_VER +#if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma warning(pop) #endif diff --git a/boost/proto/matches.hpp b/boost/proto/matches.hpp index 65815f3731..5136a5cc7b 100644 --- a/boost/proto/matches.hpp +++ b/boost/proto/matches.hpp @@ -351,18 +351,22 @@ namespace boost { namespace proto template<typename Expr, typename Tag, typename Args, long Arity, typename If, typename Then, typename Else> struct matches_<Expr, proto::basic_expr<Tag, Args, Arity>, proto::if_<If, Then, Else> > : mpl::eval_if_c< - remove_reference< - typename when<_, If>::template impl<Expr, int, int>::result_type - >::type::value + static_cast<bool>( + remove_reference< + typename when<_, If>::template impl<Expr, int, int>::result_type + >::type::value + ) , matches_<Expr, proto::basic_expr<Tag, Args, Arity>, typename Then::proto_grammar> , matches_<Expr, proto::basic_expr<Tag, Args, Arity>, typename Else::proto_grammar> >::type { typedef typename mpl::if_c< - remove_reference< - typename when<_, If>::template impl<Expr, int, int>::result_type - >::type::value + static_cast<bool>( + remove_reference< + typename when<_, If>::template impl<Expr, int, int>::result_type + >::type::value + ) , Then , Else >::type @@ -700,7 +704,7 @@ namespace boost { namespace proto typedef typename mpl::if_c< - remove_reference<condition>::type::value + static_cast<bool>(remove_reference<condition>::type::value) , when<_, Then> , when<_, Else> >::type diff --git a/boost/proto/operators.hpp b/boost/proto/operators.hpp index 540e85f637..1f2bad8c2b 100644 --- a/boost/proto/operators.hpp +++ b/boost/proto/operators.hpp @@ -21,6 +21,11 @@ #include <boost/proto/generate.hpp> #include <boost/proto/make_expr.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 @@ -100,7 +105,7 @@ namespace boost { namespace proto #define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, TRAIT, DOMAIN, POST) \ template<typename Arg> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_unary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -114,7 +119,7 @@ namespace boost { namespace proto } \ \ template<typename Arg> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_unary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -130,7 +135,7 @@ namespace boost { namespace proto #define BOOST_PROTO_DEFINE_BINARY_OPERATOR(OP, TAG, TRAIT, DOMAIN) \ template<typename Left, typename Right> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_binary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -145,7 +150,7 @@ namespace boost { namespace proto } \ \ template<typename Left, typename Right> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_binary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -160,7 +165,7 @@ namespace boost { namespace proto } \ \ template<typename Left, typename Right> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_binary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -175,7 +180,7 @@ namespace boost { namespace proto } \ \ template<typename Left, typename Right> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_binary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -194,7 +199,7 @@ namespace boost { namespace proto #define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, TRAIT, DOMAIN, POST) \ template<typename Arg> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_unary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -210,7 +215,7 @@ namespace boost { namespace proto #define BOOST_PROTO_DEFINE_BINARY_OPERATOR(OP, TAG, TRAIT, DOMAIN) \ template<typename Left, typename Right> \ - BOOST_FORCEINLINE \ + BOOST_PROTO_DISABLE_MSVC_C4714 BOOST_FORCEINLINE \ typename boost::proto::detail::enable_binary< \ DOMAIN \ , DOMAIN::proto_grammar \ @@ -366,4 +371,8 @@ namespace boost { namespace proto }} +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) +#endif + #endif diff --git a/boost/proto/proto_fwd.hpp b/boost/proto/proto_fwd.hpp index 841cd752bb..6fb25bfcf5 100644 --- a/boost/proto/proto_fwd.hpp +++ b/boost/proto/proto_fwd.hpp @@ -92,6 +92,22 @@ # endif #endif +#ifndef BOOST_NO_DECLTYPE_N3276 +# // Proto can only use the decltype-based result_of if N3276 has been +# // implemented by the compiler. +# // See http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2011/n3276.pdf +# ifndef BOOST_PROTO_USE_NORMAL_RESULT_OF +# define BOOST_PROTO_USE_NORMAL_RESULT_OF +# endif +# // If we're using the decltype-based result_of, we need to be a bit +# // stricter about the return types of some functions. +# ifndef BOOST_PROTO_STRICT_RESULT_OF +# define BOOST_PROTO_STRICT_RESULT_OF +# endif +#endif + +// Unless compiler support is there, use tr1_result_of instead of +// result_of to avoid the problems addressed by N3276. #ifdef BOOST_PROTO_USE_NORMAL_RESULT_OF # define BOOST_PROTO_RESULT_OF boost::result_of #else @@ -102,6 +118,14 @@ # define BOOST_PROTO_EXTENDED_TEMPLATE_PARAMETERS_MATCHING #endif +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# define BOOST_PROTO_DISABLE_MSVC_C4522 __pragma(warning(disable : 4522)) // 'class' : multiple assignment operators specified +# define BOOST_PROTO_DISABLE_MSVC_C4714 __pragma(warning(disable : 4714)) // function 'xxx' marked as __forceinline not inlined +#else +# define BOOST_PROTO_DISABLE_MSVC_C4522 +# define BOOST_PROTO_DISABLE_MSVC_C4714 +#endif + namespace boost { namespace proto { namespace detail @@ -380,6 +404,8 @@ namespace boost { namespace proto template<typename Grammar> struct vararg; + struct pack; + // Boost bug https://svn.boost.org/trac/boost/ticket/4602 //int const N = INT_MAX; int const N = (INT_MAX >> 10); diff --git a/boost/proto/traits.hpp b/boost/proto/traits.hpp index 59b06ea43e..05263b14d0 100644 --- a/boost/proto/traits.hpp +++ b/boost/proto/traits.hpp @@ -32,9 +32,12 @@ #include <boost/proto/domain.hpp> #include <boost/proto/transform/pass_through.hpp> -#if BOOST_WORKAROUND( BOOST_MSVC, >= 1400 ) - #pragma warning(push) - #pragma warning(disable: 4180) // warning C4180: qualifier applied to function type has no meaning; ignored +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(push) +# if BOOST_WORKAROUND( BOOST_MSVC, >= 1400 ) +# pragma warning(disable: 4180) // warning C4180: qualifier applied to function type has no meaning; ignored +# endif +# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined #endif namespace boost { namespace proto @@ -1256,8 +1259,8 @@ namespace boost { namespace proto }} -#if BOOST_WORKAROUND( BOOST_MSVC, >= 1400 ) - #pragma warning(pop) +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma warning(pop) #endif #endif 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 |