annotate DEPENDENCIES/generic/include/boost/python/detail/nullary_function_adaptor.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright David Abrahams 2003.
Chris@16 2 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 3 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5 #ifndef NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP
Chris@16 6 # define NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP
Chris@16 7
Chris@16 8 # include <boost/python/detail/prefix.hpp>
Chris@16 9 # include <boost/preprocessor/iteration/local.hpp>
Chris@16 10 # include <boost/preprocessor/facilities/intercept.hpp>
Chris@16 11 # include <boost/preprocessor/repetition/enum_params.hpp>
Chris@16 12 # include <boost/preprocessor/repetition/enum_binary_params.hpp>
Chris@16 13
Chris@16 14 namespace boost { namespace python { namespace detail {
Chris@16 15
Chris@16 16 // nullary_function_adaptor -- a class template which ignores its
Chris@16 17 // arguments and calls a nullary function instead. Used for building
Chris@16 18 // error-reporting functions, c.f. pure_virtual
Chris@16 19 template <class NullaryFunction>
Chris@16 20 struct nullary_function_adaptor
Chris@16 21 {
Chris@16 22 nullary_function_adaptor(NullaryFunction fn)
Chris@16 23 : m_fn(fn)
Chris@16 24 {}
Chris@16 25
Chris@16 26 void operator()() const { m_fn(); }
Chris@16 27
Chris@16 28 # define BOOST_PP_LOCAL_MACRO(i) \
Chris@16 29 template <BOOST_PP_ENUM_PARAMS_Z(1, i, class A)> \
Chris@16 30 void operator()( \
Chris@16 31 BOOST_PP_ENUM_BINARY_PARAMS_Z(1, i, A, const& BOOST_PP_INTERCEPT) \
Chris@16 32 ) const \
Chris@16 33 { \
Chris@16 34 m_fn(); \
Chris@16 35 }
Chris@16 36
Chris@16 37 # define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY)
Chris@16 38 # include BOOST_PP_LOCAL_ITERATE()
Chris@16 39
Chris@16 40 private:
Chris@16 41 NullaryFunction m_fn;
Chris@16 42 };
Chris@16 43
Chris@16 44 }}} // namespace boost::python::detail
Chris@16 45
Chris@16 46 #endif // NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP