annotate DEPENDENCIES/generic/include/boost/functional/overloaded_function/detail/base.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1
Chris@16 2 // Copyright (C) 2009-2012 Lorenzo Caminiti
Chris@16 3 // Distributed under the Boost Software License, Version 1.0
Chris@16 4 // (see accompanying file LICENSE_1_0.txt or a copy at
Chris@16 5 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 // Home at http://www.boost.org/libs/functional/overloaded_function
Chris@16 7
Chris@16 8 #if !BOOST_PP_IS_ITERATING
Chris@16 9 # ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
Chris@16 10 # define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_
Chris@16 11
Chris@16 12 # include <boost/functional/overloaded_function/config.hpp>
Chris@16 13 # include <boost/function.hpp>
Chris@16 14 # include <boost/preprocessor/iteration/iterate.hpp>
Chris@16 15 # include <boost/preprocessor/repetition/enum.hpp>
Chris@16 16 # include <boost/preprocessor/cat.hpp>
Chris@16 17 # include <boost/preprocessor/comma_if.hpp>
Chris@16 18
Chris@16 19 #define BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
Chris@16 20 BOOST_PP_CAT(A, n)
Chris@16 21
Chris@16 22 #define BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused) \
Chris@16 23 BOOST_PP_CAT(a, n)
Chris@16 24
Chris@16 25 #define BOOST_FUNCTIONAL_DETAIL_arg_tparam(z, n, unused) \
Chris@16 26 typename BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused)
Chris@16 27
Chris@16 28 #define BOOST_FUNCTIONAL_DETAIL_arg(z, n, unused) \
Chris@16 29 BOOST_FUNCTIONAL_DETAIL_arg_type(z, n, unused) \
Chris@16 30 BOOST_FUNCTIONAL_DETAIL_arg_name(z, n, unused)
Chris@16 31
Chris@16 32 #define BOOST_FUNCTIONAL_DETAIL_f \
Chris@16 33 R (BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity, \
Chris@16 34 BOOST_FUNCTIONAL_DETAIL_arg_type, ~))
Chris@16 35
Chris@16 36 // Do not use namespace ::detail because overloaded_function is already a class.
Chris@16 37 namespace boost { namespace overloaded_function_detail {
Chris@16 38
Chris@16 39 template<typename F>
Chris@16 40 class base {}; // Empty template cannot be used directly (only its spec).
Chris@16 41
Chris@16 42 # define BOOST_PP_ITERATION_PARAMS_1 \
Chris@16 43 (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \
Chris@16 44 "boost/functional/overloaded_function/detail/base.hpp"))
Chris@16 45 # include BOOST_PP_ITERATE() // Iterate over funciton arity.
Chris@16 46
Chris@16 47 } } // namespace
Chris@16 48
Chris@16 49 #undef BOOST_FUNCTIONAL_DETAIL_arg_type
Chris@16 50 #undef BOOST_FUNCTIONAL_DETAIL_arg_name
Chris@16 51 #undef BOOST_FUNCTIONAL_DETAIL_arg_tparam
Chris@16 52 #undef BOOST_FUNCTIONAL_DETAIL_arg
Chris@16 53 #undef BOOST_FUNCTIONAL_DETAIL_f
Chris@16 54
Chris@16 55 # endif // #include guard
Chris@16 56
Chris@16 57 #elif BOOST_PP_ITERATION_DEPTH() == 1
Chris@16 58 # define BOOST_FUNCTIONAL_DETAIL_arity BOOST_PP_FRAME_ITERATION(1)
Chris@16 59
Chris@16 60 template<
Chris@16 61 typename R
Chris@16 62 BOOST_PP_COMMA_IF(BOOST_FUNCTIONAL_DETAIL_arity)
Chris@16 63 BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
Chris@16 64 BOOST_FUNCTIONAL_DETAIL_arg_tparam, ~)
Chris@16 65 >
Chris@16 66 class base< BOOST_FUNCTIONAL_DETAIL_f > {
Chris@16 67 public:
Chris@16 68 /* implicit */ inline base(
Chris@16 69 // This requires specified type to be implicitly convertible to
Chris@16 70 // a boost::function<> functor.
Chris@16 71 boost::function< BOOST_FUNCTIONAL_DETAIL_f > const& f): f_(f)
Chris@16 72 {}
Chris@16 73
Chris@16 74 inline R operator()(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
Chris@16 75 BOOST_FUNCTIONAL_DETAIL_arg, ~)) const {
Chris@16 76 return f_(BOOST_PP_ENUM(BOOST_FUNCTIONAL_DETAIL_arity,
Chris@16 77 BOOST_FUNCTIONAL_DETAIL_arg_name, ~));
Chris@16 78 }
Chris@16 79
Chris@16 80 private:
Chris@16 81 boost::function< BOOST_FUNCTIONAL_DETAIL_f > const f_;
Chris@16 82 };
Chris@16 83
Chris@16 84 # undef BOOST_FUNCTIONAL_DETAIL_arity
Chris@16 85 #endif // iteration
Chris@16 86