/usr/include/boost/phoenix/core/detail
Edit: /usr/include/boost/phoenix/core/detail/function_eval.hpp (5275B)
/*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Copyright (c) 2015 Kohei Takahashi
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_PHOENIX_CORE_DETAIL_FUNCTION_EVAL_HPP
#define BOOST_PHOENIX_CORE_DETAIL_FUNCTION_EVAL_HPP
#include
#include
#include
#include
#include
#include
#ifndef BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
# include
# include
#endif
#ifdef BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
# include
#else
BOOST_PHOENIX_DEFINE_EXPRESSION_VARARG(
(boost)(phoenix)(detail)(function_eval)
, (meta_grammar)(meta_grammar)
, _
)
#endif
namespace boost { namespace phoenix {
namespace detail
{
template
T& help_rvalue_deduction(T& x)
{
return x;
}
template
T const& help_rvalue_deduction(T const& x)
{
return x;
}
struct function_eval
{
template
struct result;
#ifdef BOOST_PHOENIX_NO_VARIADIC_FUNCTION_EVAL
template
struct result
{
typedef typename
remove_reference<
typename boost::result_of::type
>::type
fn;
typedef typename boost::result_of::type type;
};
template
typename result::type
operator()(F const & f, Context const & ctx) const
{
return boost::phoenix::eval(f, ctx)();
}
template
typename result::type
operator()(F & f, Context const & ctx) const
{
return boost::phoenix::eval(f, ctx)();
}
#include
#else
template struct result_impl;
template
struct result_impl
: result_impl
{
};
template
struct result_impl
{
typedef typename
remove_reference<
typename boost::result_of::type
>::type
fn;
template
struct result_of_evaluator
{
typedef typename boost::add_reference<
typename boost::add_const<
typename boost::result_of<
boost::phoenix::evaluator(T, Context)
>::type
>::type
>::type type;
};
typedef typename
boost::result_of<
fn(typename result_of_evaluator::type...)
>::type
type;
static type call(F f, A... a, Context ctx)
{
return boost::phoenix::eval(f, ctx)(help_rvalue_deduction(boost::phoenix::eval(a, ctx))...);
}
};
template
struct result
: result_impl
{
};
template
typename result<
function_eval(
F const &
, typename mpl::if_, A, A const &>::type...
)
>::type
// 'A &... a, Context const &ctx' doesn't work as intended: type deduction always fail.
operator()(F && f, A &&... a) const
{
return
result<
function_eval(
typename mpl::if_, F, F const &>::type
, typename mpl::if_, A, A const &>::type...
)
>::call(f, a...);
}
#endif
};
}
template
struct default_actions::when
: phoenix::call
{};
}}
#endif