From 7631ae4160fa5ce02443ef70d796e17ddfe8a87d Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sat, 11 Apr 2015 10:14:10 +0900 Subject: [PATCH] Implement variadic based phx2_result. --- .../phoenix/core/detail/cpp03/phx2_result.hpp | 8 ++--- .../boost/phoenix/core/detail/phx2_result.hpp | 33 +++++++++++++++++-- include/boost/phoenix/core/limits.hpp | 1 + 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/include/boost/phoenix/core/detail/cpp03/phx2_result.hpp b/include/boost/phoenix/core/detail/cpp03/phx2_result.hpp index e5af19d..eb114df 100644 --- a/include/boost/phoenix/core/detail/cpp03/phx2_result.hpp +++ b/include/boost/phoenix/core/detail/cpp03/phx2_result.hpp @@ -30,10 +30,9 @@ #pragma wave option(preserve: 1) #endif - #define BOOST_PHOENIX_ITERATION_PARAMS \ (3, (1, BOOST_PP_DEC(BOOST_PHOENIX_COMPOSITE_LIMIT), \ - )) + )) #include BOOST_PHOENIX_ITERATE() #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) @@ -53,19 +52,18 @@ >::type {}; - template struct phx2_result { typedef typename F::template result::type type; }; - + template struct phx2_result { typedef typename F::template result::type type; }; - + template struct phx2_result { diff --git a/include/boost/phoenix/core/detail/phx2_result.hpp b/include/boost/phoenix/core/detail/phx2_result.hpp index 760f167..d95229d 100644 --- a/include/boost/phoenix/core/detail/phx2_result.hpp +++ b/include/boost/phoenix/core/detail/phx2_result.hpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace boost { namespace phoenix { namespace detail @@ -23,8 +24,7 @@ namespace boost { namespace phoenix { template static yes check_(typename A::type *); - - + template static no check_(...); @@ -32,7 +32,36 @@ namespace boost { namespace phoenix { typedef boost::mpl::bool_ type; }; +#ifdef BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT #include +#else + template + struct has_phx2_result + : mpl::eval_if< + has_result_type + , mpl::false_ + , has_phx2_result_impl > + >::type + {}; + + template + struct phx2_result + { + typedef typename F::template result::type type; + }; + + template + struct phx2_result + { + typedef typename F::template result::type type; + }; + + template + struct phx2_result + { + typedef typename F::template result::type type; + }; +#endif } }} diff --git a/include/boost/phoenix/core/limits.hpp b/include/boost/phoenix/core/limits.hpp index 5f760f3..b884308 100644 --- a/include/boost/phoenix/core/limits.hpp +++ b/include/boost/phoenix/core/limits.hpp @@ -38,6 +38,7 @@ # define BOOST_PHOENIX_NO_VARIADIC_ACTOR # define BOOST_PHOENIX_NO_VARIADIC_CALL # define BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EQUAL +# define BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT #endif #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES # define BOOST_PHOENIX_NO_VARIADIC_ACTOR