File indexing completed on 2025-01-18 09:31:06
0001
0002
0003
0004
0005
0006
0007
0008 #if !BOOST_PP_IS_ITERATING
0009 # ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
0010 # define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
0011
0012 # include <boost/functional/overloaded_function/config.hpp>
0013 # include <boost/function.hpp>
0014 # include <boost/preprocessor/iteration/iterate.hpp>
0015 # include <boost/preprocessor/repetition/enum.hpp>
0016 # include <boost/preprocessor/cat.hpp>
0017 # include <boost/preprocessor/comma_if.hpp>
0018
0019 #define BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
0020 BOOST_PP_CAT(A, n)
0021
0022 #define BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) \
0023 BOOST_PP_CAT(a, n)
0024
0025 #define BOOST_FUNCTIONAL_DETAIL_arg_tparam(z, n, unused) \
0026 typename BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused)
0027
0028 #define BOOST_FUNCTIONAL_DETAIL_arg(z, n, unused) \
0029 BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
0030 BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused)
0031
0032 #define BOOST_FUNCTIONAL_DETAIL_f \
0033 R (BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, \
0034 BOOST_FUNCTIONAL_DETAIL_arg_type, ~))
0035
0036
0037 namespace boost { namespace overloaded_function_detail {
0038
0039 template<typename F>
0040 class base {};
0041
0042 # define BOOST_PP_ITERATION_PARAMS_1 \
0043 (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \
0044 "boost/functional/overloaded_function/detail/base.hpp"))
0045 # include BOOST_PP_ITERATE()
0046
0047 } }
0048
0049 #undef BOOST_FUNCTIONAL_DETAIL_arg_type
0050 #undef BOOST_FUNCTIONAL_DETAIL_arg_name
0051 #undef BOOST_FUNCTIONAL_DETAIL_arg_tparam
0052 #undef BOOST_FUNCTIONAL_DETAIL_arg
0053 #undef BOOST_FUNCTIONAL_DETAIL_f
0054
0055 # endif
0056
0057 #elif BOOST_PP_ITERATION_DEPTH() == 1
0058 # define BOOST_FUNCTIONAL_DETAIL_arity BOOST_PP_FRAME_ITERATION(1)
0059
0060 template<
0061 typename R
0062 BOOST_PP_COMMA_IF(BOOST_FUNCTIONAL_DETAIL_arity)
0063 BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
0064 BOOST_FUNCTIONAL_DETAIL_arg_tparam, ~)
0065 >
0066 class base< BOOST_FUNCTIONAL_DETAIL_f > {
0067 public:
0068 inline base(
0069
0070
0071 boost::function< BOOST_FUNCTIONAL_DETAIL_f > const& f): f_(f)
0072 {}
0073
0074 inline R operator()(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
0075 BOOST_FUNCTIONAL_DETAIL_arg, ~)) const {
0076 return f_(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
0077 BOOST_FUNCTIONAL_DETAIL_arg_name, ~));
0078 }
0079
0080 private:
0081 boost::function< BOOST_FUNCTIONAL_DETAIL_f > const f_;
0082 };
0083
0084 # undef BOOST_FUNCTIONAL_DETAIL_arity
0085 #endif
0086