blob: 8cd83617ab86584adef83f0889d45ad8f185f6a5 [file] [log] [blame]
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
Copyright (c) 2011 Thomas Heller
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_FUNCTION_ADAPT_CALLABLE_HPP
#define BOOST_PHOENIX_FUNCTION_ADAPT_CALLABLE_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/detail/function_eval.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#define BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(NAME, FUNC) \
boost::phoenix::detail::expression::function_eval<FUNC>::type const \
inline NAME() \
{ \
return boost::phoenix::detail::expression:: \
function_eval<FUNC>::make(FUNC()); \
} \
/**/
#define BOOST_PHOENIX_ADAPT_CALLABLE(NAME, FUNC, N) \
template <BOOST_PHOENIX_typename_A(N)> \
typename \
boost::phoenix::detail::expression::function_eval< \
FUNC \
, BOOST_PHOENIX_A(N)>::type const \
inline NAME(BOOST_PHOENIX_A_const_ref_a(N)) \
{ \
return boost::phoenix::detail::expression:: \
function_eval<FUNC, BOOST_PHOENIX_A(N)>:: \
make(FUNC(), BOOST_PHOENIX_a(N)); \
} \
/**/
#define BOOST_PHOENIX_ADAPT_CALLABLE_VARARG(NAME, FUNC) \
BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(NAME, FUNC) \
BOOST_PP_REPEAT_FROM_TO( \
1 \
, BOOST_PHOENIX_LIMIT \
, BOOST_PHOENIX_ADAPT_CALLABLE_VARARG_R \
, (NAME, FUNC) \
) \
/**/
#define BOOST_PHOENIX_ADAPT_CALLABLE_VARARG_R(Z, N, D) \
BOOST_PHOENIX_ADAPT_CALLABLE( \
BOOST_PP_TUPLE_ELEM(2, 0, D) \
, BOOST_PP_TUPLE_ELEM(2, 1, D) \
, N \
) \
/**/
#endif