File indexing completed on 2025-01-18 09:43:29
0001
0002
0003
0004
0005 #ifndef BOOST_PARAMETER_INVOKER_051210_HPP
0006 # define BOOST_PARAMETER_INVOKER_051210_HPP
0007
0008 # include <boost/mpl/begin.hpp>
0009 # include <boost/mpl/next.hpp>
0010 # include <boost/mpl/deref.hpp>
0011 # include <boost/mpl/size.hpp>
0012 # include <boost/parameter/keyword.hpp>
0013 # include <boost/preprocessor/iteration/iterate.hpp>
0014
0015 namespace boost { namespace parameter { namespace python { namespace aux {
0016
0017 template <long Arity, class M, class R, class Args>
0018 struct invoker;
0019
0020 template <class M, class R>
0021 struct make_invoker
0022 {
0023 template <class Args>
0024 struct apply
0025 {
0026 typedef invoker<
0027 mpl::size<Args>::value, M, R, Args
0028 > type;
0029 };
0030 };
0031
0032 template <long Arity, class M, class R, class T, class Args>
0033 struct member_invoker;
0034
0035 template <class M, class R, class T>
0036 struct make_member_invoker
0037 {
0038 template <class Args>
0039 struct apply
0040 {
0041 typedef member_invoker<
0042 mpl::size<Args>::value, M, R, T, Args
0043 > type;
0044 };
0045 };
0046
0047 template <long Arity, class T, class R, class Args>
0048 struct call_invoker;
0049
0050 template <class T, class R>
0051 struct make_call_invoker
0052 {
0053 template <class Args>
0054 struct apply
0055 {
0056 typedef call_invoker<
0057 mpl::size<Args>::value, T, R, Args
0058 > type;
0059 };
0060 };
0061
0062 template <long Arity, class T, class Args>
0063 struct init_invoker;
0064
0065 template <class T>
0066 struct make_init_invoker
0067 {
0068 template <class Args>
0069 struct apply
0070 {
0071 typedef init_invoker<
0072 mpl::size<Args>::value, T, Args
0073 > type;
0074 };
0075 };
0076
0077 template <class M, class R, class Args>
0078 struct invoker<0, M, R, Args>
0079 {
0080 static R execute()
0081 {
0082 return M()(boost::type<R>());
0083 }
0084 };
0085
0086 template <class M, class R, class T, class Args>
0087 struct member_invoker<0, M, R, T, Args>
0088 {
0089 static R execute(T& self)
0090 {
0091 return M()(boost::type<R>(), self);
0092 }
0093 };
0094
0095 template <class T, class R, class Args>
0096 struct call_invoker<0, T, R, Args>
0097 {
0098 static R execute(T& self)
0099 {
0100 return self();
0101 }
0102 };
0103
0104 template <class T, class Args>
0105 struct init_invoker<0, T, Args>
0106 {
0107 static T* execute(T& self)
0108 {
0109 return new T;
0110 }
0111 };
0112
0113 # define BOOST_PP_ITERATION_PARAMS_1 (4, \
0114 (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 1))
0115 # include BOOST_PP_ITERATE()
0116
0117 # define BOOST_PP_ITERATION_PARAMS_1 (4, \
0118 (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 2))
0119 # include BOOST_PP_ITERATE()
0120
0121 # define BOOST_PP_ITERATION_PARAMS_1 (4, \
0122 (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 3))
0123 # include BOOST_PP_ITERATE()
0124
0125 # define BOOST_PP_ITERATION_PARAMS_1 (4, \
0126 (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 4))
0127 # include BOOST_PP_ITERATE()
0128
0129 }}}}
0130
0131 #endif
0132