1 // Copyright David Abrahams 2003.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP
6 # define NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP
8 # include <boost/python/detail/prefix.hpp>
9 # include <boost/preprocessor/iteration/local.hpp>
10 # include <boost/preprocessor/facilities/intercept.hpp>
11 # include <boost/preprocessor/repetition/enum_params.hpp>
12 # include <boost/preprocessor/repetition/enum_binary_params.hpp>
14 namespace boost { namespace python { namespace detail {
16 // nullary_function_adaptor -- a class template which ignores its
17 // arguments and calls a nullary function instead. Used for building
18 // error-reporting functions, c.f. pure_virtual
19 template <class NullaryFunction>
20 struct nullary_function_adaptor
22 nullary_function_adaptor(NullaryFunction fn)
26 void operator()() const { m_fn(); }
28 # define BOOST_PP_LOCAL_MACRO(i) \
29 template <BOOST_PP_ENUM_PARAMS_Z(1, i, class A)> \
31 BOOST_PP_ENUM_BINARY_PARAMS_Z(1, i, A, const& BOOST_PP_INTERCEPT) \
37 # define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY)
38 # include BOOST_PP_LOCAL_ITERATE()
44 }}} // namespace boost::python::detail
46 #endif // NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP