Warning, file /include/boost/phoenix/function/adapt_function.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_PHOENIX_FUNCTION_ADAPT_FUNCTION_HPP
0010 #define BOOST_PHOENIX_FUNCTION_ADAPT_FUNCTION_HPP
0011
0012 #include <boost/phoenix/core/limits.hpp>
0013 #include <boost/phoenix/core/detail/function_eval.hpp>
0014 #include <boost/preprocessor/repetition/repeat.hpp>
0015
0016 #define BOOST_PHOENIX_ADAPT_FUNCTION_NULLARY(RESULT, NAME, FUNC) \
0017 namespace detail0 \
0018 { \
0019 struct BOOST_PP_CAT(NAME, _impl_nullary) \
0020 { \
0021 typedef RESULT result_type; \
0022 \
0023 result_type \
0024 operator()() const \
0025 { \
0026 return FUNC(); \
0027 } \
0028 }; \
0029 } \
0030 \
0031 inline \
0032 boost::phoenix::detail::expression::function_eval< \
0033 detail0:: BOOST_PP_CAT(NAME, _impl_nullary) \
0034 >::type const \
0035 NAME() \
0036 { \
0037 return boost::phoenix::detail::expression:: \
0038 function_eval<detail0:: BOOST_PP_CAT(NAME, _impl_nullary)> \
0039 ::make(detail0:: BOOST_PP_CAT(NAME, _impl_nullary)()); \
0040 } \
0041
0042
0043 #define BOOST_PHOENIX_ADAPT_FUNCTION(RESULT, NAME, FUNC, N) \
0044 namespace detail1 \
0045 { \
0046 struct BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N) \
0047 { \
0048 template <typename Sig> \
0049 struct result; \
0050 \
0051 template <typename This, BOOST_PHOENIX_typename_A(N)> \
0052 struct result<This(BOOST_PHOENIX_A(N))> \
0053 {typedef RESULT type;}; \
0054 \
0055 template <BOOST_PHOENIX_typename_A(N)> \
0056 RESULT \
0057 operator()(BOOST_PHOENIX_A_ref_a(N)) const \
0058 { \
0059 return FUNC(BOOST_PHOENIX_a(N)); \
0060 } \
0061 }; \
0062 } \
0063 \
0064 template <BOOST_PHOENIX_typename_A(N)> \
0065 inline \
0066 typename \
0067 boost::phoenix::detail::expression::function_eval< \
0068 detail1:: BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N) \
0069 , BOOST_PHOENIX_A(N)>::type const \
0070 NAME(BOOST_PHOENIX_A_const_ref_a(N)) \
0071 { \
0072 return boost::phoenix::detail::expression:: \
0073 function_eval< \
0074 detail1:: BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N) \
0075 , BOOST_PHOENIX_A(N) \
0076 >::make( \
0077 detail1:: BOOST_PP_CAT(BOOST_PP_CAT(NAME, _impl_), N)() \
0078 , BOOST_PHOENIX_a(N) \
0079 ); \
0080 } \
0081
0082
0083 #define BOOST_PHOENIX_ADAPT_FUNCTION_VARARG(RESULT, NAME, FUNC) \
0084 BOOST_PHOENIX_ADAPT_FUNCTION_NULLARY(NAME, FUNC) \
0085 BOOST_PP_REPEAT_FROM_TO( \
0086 1 \
0087 , BOOST_PHOENIX_LIMIT \
0088 , BOOST_PHOENIX_ADAPT_FUNCTION_VARARG_R \
0089 , (RESULT, NAME, FUNC) \
0090 ) \
0091
0092
0093 #define BOOST_PHOENIX_ADAPT_FUNCTION_VARARG_R(Z, N, D) \
0094 BOOST_PHOENIX_ADAPT_FUNCTION( \
0095 BOOST_PP_TUPLE_ELEM(3, 0, D) \
0096 , BOOST_PP_TUPLE_ELEM(3, 1, D) \
0097 , BOOST_PP_TUPLE_ELEM(3, 2, D) \
0098 , N \
0099 ) \
0100
0101
0102 #endif