1 /*==============================================================================
2 Copyright (c) 2005-2010 Joel de Guzman
3 Copyright (c) 2011 Thomas Heller
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #ifndef BOOST_PHOENIX_FUNCTION_ADAPT_CALLABLE_HPP
9 #define BOOST_PHOENIX_FUNCTION_ADAPT_CALLABLE_HPP
11 #include <boost/phoenix/core/limits.hpp>
12 #include <boost/phoenix/core/detail/function_eval.hpp>
13 #include <boost/preprocessor/repetition/repeat.hpp>
15 #define BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(NAME, FUNC) \
17 boost::phoenix::detail::expression::function_eval<FUNC>::type const \
20 return boost::phoenix::detail::expression:: \
21 function_eval<FUNC>::make(FUNC()); \
26 #define BOOST_PHOENIX_ADAPT_CALLABLE(NAME, FUNC, N) \
27 template <BOOST_PHOENIX_typename_A(N)> \
30 boost::phoenix::detail::expression::function_eval< \
32 , BOOST_PHOENIX_A(N)>::type const \
33 NAME(BOOST_PHOENIX_A_const_ref_a(N)) \
35 return boost::phoenix::detail::expression:: \
36 function_eval<FUNC, BOOST_PHOENIX_A(N)>:: \
37 make(FUNC(), BOOST_PHOENIX_a(N)); \
42 #define BOOST_PHOENIX_ADAPT_CALLABLE_VARARG(NAME, FUNC) \
43 BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(NAME, FUNC) \
44 BOOST_PP_REPEAT_FROM_TO( \
46 , BOOST_PHOENIX_LIMIT \
47 , BOOST_PHOENIX_ADAPT_CALLABLE_VARARG_R \
52 #define BOOST_PHOENIX_ADAPT_CALLABLE_VARARG_R(Z, N, D) \
53 BOOST_PHOENIX_ADAPT_CALLABLE( \
54 BOOST_PP_TUPLE_ELEM(2, 0, D) \
55 , BOOST_PP_TUPLE_ELEM(2, 1, D) \