1 // Copyright David Abrahams 2002.
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 MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP
6 # define MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP
8 # include <boost/python/make_function.hpp>
9 # include <boost/python/args_fwd.hpp>
11 # include <boost/python/object/make_holder.hpp>
13 # include <boost/mpl/size.hpp>
16 namespace boost { namespace python { namespace detail {
18 // Think of this as a version of make_function without a compile-time
19 // check that the size of kw is no greater than the expected arity of
20 // F. This version is needed when defining functions with default
21 // arguments, because compile-time information about the number of
22 // keywords is missing for all but the initial function definition.
24 // @group make_keyword_range_function {
25 template <class F, class Policies>
26 object make_keyword_range_function(
28 , Policies const& policies
29 , keyword_range const& kw)
31 return detail::make_function_aux(
32 f, policies, detail::get_signature(f), kw, mpl::int_<0>());
35 template <class F, class Policies, class Signature>
36 object make_keyword_range_function(
38 , Policies const& policies
39 , keyword_range const& kw
40 , Signature const& sig)
42 return detail::make_function_aux(
43 f, policies, sig, kw, mpl::int_<0>());
47 // Builds an '__init__' function which inserts the given Holder type
48 // in a wrapped C++ class instance. ArgList is an MPL type sequence
49 // describing the C++ argument types to be passed to Holder's
52 // Holder and ArgList are intended to be explicitly specified.
53 template <class ArgList, class Arity, class Holder, class CallPolicies>
54 object make_keyword_range_constructor(
55 CallPolicies const& policies // The CallPolicies with which to invoke the Holder's constructor
56 , detail::keyword_range const& kw // The (possibly empty) set of associated argument keywords
58 , ArgList* = 0, Arity* = 0)
60 #if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE)
61 python_class<BOOST_DEDUCED_TYPENAME Holder::value_type>::register_();
63 return detail::make_keyword_range_function(
64 objects::make_holder<Arity::value>
65 ::template apply<Holder,ArgList>::execute
70 }}} // namespace boost::python::detail
72 #endif // MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP