Chris@16: // Copyright David Abrahams 2003. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP Chris@16: # define NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP Chris@16: Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: Chris@16: namespace boost { namespace python { namespace detail { Chris@16: Chris@16: // nullary_function_adaptor -- a class template which ignores its Chris@16: // arguments and calls a nullary function instead. Used for building Chris@16: // error-reporting functions, c.f. pure_virtual Chris@16: template Chris@16: struct nullary_function_adaptor Chris@16: { Chris@16: nullary_function_adaptor(NullaryFunction fn) Chris@16: : m_fn(fn) Chris@16: {} Chris@16: Chris@16: void operator()() const { m_fn(); } Chris@16: Chris@16: # define BOOST_PP_LOCAL_MACRO(i) \ Chris@16: template \ Chris@16: void operator()( \ Chris@16: BOOST_PP_ENUM_BINARY_PARAMS_Z(1, i, A, const& BOOST_PP_INTERCEPT) \ Chris@16: ) const \ Chris@16: { \ Chris@16: m_fn(); \ Chris@16: } Chris@16: Chris@16: # define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY) Chris@16: # include BOOST_PP_LOCAL_ITERATE() Chris@16: Chris@16: private: Chris@16: NullaryFunction m_fn; Chris@16: }; Chris@16: Chris@16: }}} // namespace boost::python::detail Chris@16: Chris@16: #endif // NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP