2
0
mirror of https://github.com/boostorg/phoenix.git synced 2026-02-03 09:22:15 +00:00

Implement variadic based phx2_result.

This commit is contained in:
Kohei Takahashi
2015-04-11 10:14:10 +09:00
parent 661ae3a3fb
commit 7631ae4160
3 changed files with 35 additions and 7 deletions

View File

@@ -30,10 +30,9 @@
#pragma wave option(preserve: 1)
#endif
#define BOOST_PHOENIX_ITERATION_PARAMS \
(3, (1, BOOST_PP_DEC(BOOST_PHOENIX_COMPOSITE_LIMIT), \
<boost/phoenix/core/detail/cpp03/preprocessed/phx2_result.hpp>))
<boost/phoenix/core/detail/cpp03/phx2_result.hpp>))
#include BOOST_PHOENIX_ITERATE()
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
@@ -53,19 +52,18 @@
>::type
{};
template <typename F, BOOST_PHOENIX_typename_A>
struct phx2_result<F, BOOST_PHOENIX_A>
{
typedef typename F::template result<BOOST_PHOENIX_A>::type type;
};
template <typename F, BOOST_PHOENIX_typename_A>
struct phx2_result<F, BOOST_PHOENIX_A_ref>
{
typedef typename F::template result<BOOST_PHOENIX_A>::type type;
};
template <typename F, BOOST_PHOENIX_typename_A>
struct phx2_result<F, BOOST_PHOENIX_A_const_ref>
{

View File

@@ -9,6 +9,7 @@
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/support/iterate.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace phoenix {
namespace detail
@@ -23,8 +24,7 @@ namespace boost { namespace phoenix {
template <typename A>
static yes check_(typename A::type *);
template <typename A>
static no check_(...);
@@ -32,7 +32,36 @@ namespace boost { namespace phoenix {
typedef boost::mpl::bool_<value> type;
};
#ifdef BOOST_PHOENIX_NO_VARIADIC_PHX2_RESULT
#include <boost/phoenix/core/detail/cpp03/phx2_result.hpp>
#else
template <typename F, typename... A>
struct has_phx2_result
: mpl::eval_if<
has_result_type<F>
, mpl::false_
, has_phx2_result_impl<typename F::template result<F(A...)> >
>::type
{};
template <typename F, typename... A>
struct phx2_result
{
typedef typename F::template result<A...>::type type;
};
template <typename F, typename... A>
struct phx2_result<F, A &...>
{
typedef typename F::template result<A...>::type type;
};
template <typename F, typename... A>
struct phx2_result<F, A const &...>
{
typedef typename F::template result<A...>::type type;
};
#endif
}
}}

View File

@@ -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