Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:38

0001 // Copyright David Abrahams 2002.
0002 // Distributed under the Boost Software License, Version 1.0. (See
0003 // accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 #ifndef MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP
0006 # define MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP
0007 
0008 # include <boost/python/make_function.hpp>
0009 # include <boost/python/args_fwd.hpp>
0010 
0011 # include <boost/python/object/make_holder.hpp>
0012 
0013 # include <boost/mpl/size.hpp>
0014 
0015 
0016 namespace boost { namespace python { namespace detail { 
0017 
0018 // Think of this as a version of make_function without a compile-time
0019 // check that the size of kw is no greater than the expected arity of
0020 // F. This version is needed when defining functions with default
0021 // arguments, because compile-time information about the number of
0022 // keywords is missing for all but the initial function definition.
0023 //
0024 // @group make_keyword_range_function {
0025 template <class F, class Policies>
0026 object make_keyword_range_function(
0027     F f
0028   , Policies const& policies
0029   , keyword_range const& kw)
0030 {
0031     return detail::make_function_aux(
0032         f, policies, detail::get_signature(f), kw, mpl::int_<0>());
0033 }
0034 
0035 template <class F, class Policies, class Signature>
0036 object make_keyword_range_function(
0037     F f
0038   , Policies const& policies
0039   , keyword_range const& kw
0040   , Signature const& sig)
0041 {
0042     return detail::make_function_aux(
0043         f, policies, sig, kw, mpl::int_<0>());
0044 }
0045 // }
0046 
0047 // Builds an '__init__' function which inserts the given Holder type
0048 // in a wrapped C++ class instance. ArgList is an MPL type sequence
0049 // describing the C++ argument types to be passed to Holder's
0050 // constructor.
0051 //
0052 // Holder and ArgList are intended to be explicitly specified. 
0053 template <class ArgList, class Arity, class Holder, class CallPolicies>
0054 object make_keyword_range_constructor(
0055     CallPolicies const& policies        // The CallPolicies with which to invoke the Holder's constructor
0056     , detail::keyword_range const& kw   // The (possibly empty) set of associated argument keywords
0057     , Holder* = 0                       
0058     , ArgList* = 0, Arity* = 0)
0059 {
0060 #if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE)
0061     python_class<BOOST_DEDUCED_TYPENAME Holder::value_type>::register_();
0062 #endif
0063     return detail::make_keyword_range_function(
0064         objects::make_holder<Arity::value>
0065             ::template apply<Holder,ArgList>::execute
0066         , policies
0067         , kw);
0068 }
0069 
0070 }}} // namespace boost::python::detail
0071 
0072 #endif // MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP