mirror of
https://github.com/boostorg/python.git
synced 2026-01-21 17:12:22 +00:00
Removed unused ConverterGenerators arguments.
Updated arg_from_python<T> so that its operator() is nullary -- it already gets everything it needs in its constructor. [SVN r19948]
This commit is contained in:
@@ -26,51 +26,25 @@ struct arg_from_python<PyObject*>
|
||||
{
|
||||
typedef PyObject* result_type;
|
||||
|
||||
arg_from_python(PyObject*) {}
|
||||
arg_from_python(PyObject* p) : m_source(p) {}
|
||||
bool convertible() const { return true; }
|
||||
PyObject* operator()(PyObject* source) const { return source; }
|
||||
PyObject* operator()() const { return m_source; }
|
||||
private:
|
||||
PyObject* m_source;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct arg_from_python<PyObject* const&>
|
||||
{
|
||||
typedef PyObject* const& result_type;
|
||||
arg_from_python(PyObject*) {}
|
||||
|
||||
arg_from_python(PyObject* p) : m_source(p) {}
|
||||
bool convertible() const { return true; }
|
||||
PyObject*const& operator()(PyObject*const& source) const { return source; }
|
||||
PyObject*const& operator()() const { return m_source; }
|
||||
private:
|
||||
PyObject* m_source;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
//
|
||||
// Meta-iterators for use with caller<>
|
||||
//
|
||||
|
||||
// temporary hack
|
||||
template <class T> struct nullary : T
|
||||
{
|
||||
nullary(PyObject* x) : T(x), m_p(x) {}
|
||||
typename T::result_type operator()() { return this->T::operator()(m_p); }
|
||||
PyObject* m_p;
|
||||
};
|
||||
|
||||
// An MPL metafunction class which returns arg_from_python<ArgType>
|
||||
struct gen_arg_from_python
|
||||
{
|
||||
template <class ArgType> struct apply
|
||||
{
|
||||
typedef nullary<arg_from_python<ArgType> > type;
|
||||
};
|
||||
};
|
||||
|
||||
// An MPL iterator over an endless sequence of gen_arg_from_python
|
||||
struct args_from_python
|
||||
{
|
||||
typedef gen_arg_from_python type;
|
||||
typedef args_from_python next;
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// implementations
|
||||
//
|
||||
|
||||
@@ -44,7 +44,7 @@ struct pointer_cref_arg_from_python
|
||||
typedef T result_type;
|
||||
|
||||
pointer_cref_arg_from_python(PyObject*);
|
||||
T operator()(PyObject*) const;
|
||||
T operator()() const;
|
||||
bool convertible() const;
|
||||
|
||||
private: // storage for a U*
|
||||
@@ -74,7 +74,7 @@ struct pointer_arg_from_python : arg_lvalue_from_python_base
|
||||
typedef T result_type;
|
||||
|
||||
pointer_arg_from_python(PyObject*);
|
||||
T operator()(PyObject*) const;
|
||||
T operator()() const;
|
||||
};
|
||||
|
||||
// Used when T == U& and (T != V const& or T == W volatile&)
|
||||
@@ -84,7 +84,7 @@ struct reference_arg_from_python : arg_lvalue_from_python_base
|
||||
typedef T result_type;
|
||||
|
||||
reference_arg_from_python(PyObject*);
|
||||
T operator()(PyObject*) const;
|
||||
T operator()() const;
|
||||
};
|
||||
|
||||
// ===================
|
||||
@@ -114,10 +114,11 @@ struct arg_rvalue_from_python
|
||||
# if BOOST_MSVC < 1301 || _MSC_FULL_VER > 13102196
|
||||
typename arg_rvalue_from_python<T>::
|
||||
# endif
|
||||
result_type operator()(PyObject*);
|
||||
result_type operator()();
|
||||
|
||||
private:
|
||||
rvalue_from_python_data<result_type> m_data;
|
||||
PyObject* m_source;
|
||||
};
|
||||
|
||||
|
||||
@@ -132,9 +133,10 @@ struct back_reference_arg_from_python
|
||||
typedef T result_type;
|
||||
|
||||
back_reference_arg_from_python(PyObject*);
|
||||
T operator()(PyObject*);
|
||||
T operator()();
|
||||
private:
|
||||
typedef boost::python::arg_from_python<typename T::type> base;
|
||||
PyObject* m_source;
|
||||
};
|
||||
|
||||
|
||||
@@ -259,9 +261,9 @@ inline bool pointer_cref_arg_from_python<T>::convertible() const
|
||||
return python::detail::void_ptr_to_reference(m_result.bytes, (T(*)())0) != 0;
|
||||
}
|
||||
template <class T>
|
||||
inline T pointer_cref_arg_from_python<T>::operator()(PyObject* p) const
|
||||
inline T pointer_cref_arg_from_python<T>::operator()() const
|
||||
{
|
||||
return (p == Py_None) // None ==> 0
|
||||
return (*(void**)m_result.bytes == Py_None) // None ==> 0
|
||||
? detail::null_ptr_reference((T(*)())0)
|
||||
// Otherwise, return a U*const& to the m_result storage.
|
||||
: python::detail::void_ptr_to_reference(m_result.bytes, (T(*)())0);
|
||||
@@ -277,9 +279,9 @@ inline pointer_arg_from_python<T>::pointer_arg_from_python(PyObject* p)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T pointer_arg_from_python<T>::operator()(PyObject* p) const
|
||||
inline T pointer_arg_from_python<T>::operator()() const
|
||||
{
|
||||
return (p == Py_None) ? 0 : T(result());
|
||||
return (result() == Py_None) ? 0 : T(result());
|
||||
}
|
||||
|
||||
// reference_arg_from_python
|
||||
@@ -291,7 +293,7 @@ inline reference_arg_from_python<T>::reference_arg_from_python(PyObject* p)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T reference_arg_from_python<T>::operator()(PyObject*) const
|
||||
inline T reference_arg_from_python<T>::operator()() const
|
||||
{
|
||||
return python::detail::void_ptr_to_reference(result(), (T(*)())0);
|
||||
}
|
||||
@@ -302,6 +304,7 @@ inline T reference_arg_from_python<T>::operator()(PyObject*) const
|
||||
template <class T>
|
||||
inline arg_rvalue_from_python<T>::arg_rvalue_from_python(PyObject* obj)
|
||||
: m_data(converter::rvalue_from_python_stage1(obj, registered<T>::converters))
|
||||
, m_source(obj)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -313,10 +316,10 @@ inline bool arg_rvalue_from_python<T>::convertible() const
|
||||
|
||||
template <class T>
|
||||
inline typename arg_rvalue_from_python<T>::result_type
|
||||
arg_rvalue_from_python<T>::operator()(PyObject* p)
|
||||
arg_rvalue_from_python<T>::operator()()
|
||||
{
|
||||
if (m_data.stage1.construct != 0)
|
||||
m_data.stage1.construct(p, &m_data.stage1);
|
||||
m_data.stage1.construct(m_source, &m_data.stage1);
|
||||
|
||||
return python::detail::void_ptr_to_reference(m_data.stage1.convertible, (result_type(*)())0);
|
||||
}
|
||||
@@ -325,15 +328,15 @@ arg_rvalue_from_python<T>::operator()(PyObject* p)
|
||||
//
|
||||
template <class T>
|
||||
back_reference_arg_from_python<T>::back_reference_arg_from_python(PyObject* x)
|
||||
: base(x)
|
||||
: base(x), m_source(x)
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T
|
||||
back_reference_arg_from_python<T>::operator()(PyObject* x)
|
||||
back_reference_arg_from_python<T>::operator()()
|
||||
{
|
||||
return T(x, base::operator()(x));
|
||||
return T(m_source, base::operator()());
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::converter
|
||||
|
||||
@@ -27,7 +27,7 @@ struct object_manager_value_arg_from_python
|
||||
|
||||
object_manager_value_arg_from_python(PyObject*);
|
||||
bool convertible() const;
|
||||
T operator()(PyObject*) const;
|
||||
T operator()() const;
|
||||
private:
|
||||
PyObject* m_source;
|
||||
};
|
||||
@@ -48,7 +48,7 @@ struct object_manager_ref_arg_from_python
|
||||
|
||||
object_manager_ref_arg_from_python(PyObject*);
|
||||
bool convertible() const;
|
||||
Ref operator()(PyObject*) const;
|
||||
Ref operator()() const;
|
||||
~object_manager_ref_arg_from_python();
|
||||
private:
|
||||
typename python::detail::referent_storage<Ref>::type m_result;
|
||||
@@ -71,9 +71,9 @@ inline bool object_manager_value_arg_from_python<T>::convertible() const
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T object_manager_value_arg_from_python<T>::operator()(PyObject* x) const
|
||||
inline T object_manager_value_arg_from_python<T>::operator()() const
|
||||
{
|
||||
return T(python::detail::borrowed_reference(x));
|
||||
return T(python::detail::borrowed_reference(m_source));
|
||||
}
|
||||
|
||||
template <class Ref>
|
||||
@@ -111,7 +111,7 @@ inline bool object_manager_ref_arg_from_python<Ref>::convertible() const
|
||||
}
|
||||
|
||||
template <class Ref>
|
||||
inline Ref object_manager_ref_arg_from_python<Ref>::operator()(PyObject*) const
|
||||
inline Ref object_manager_ref_arg_from_python<Ref>::operator()() const
|
||||
{
|
||||
return python::detail::void_ptr_to_reference(
|
||||
this->m_result.bytes, (Ref(*)())0);
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
// Copyright David Abrahams 2002. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#ifndef PYTYPE_ARG_FROM_PYTHON_DWA2002628_HPP
|
||||
# define PYTYPE_ARG_FROM_PYTHON_DWA2002628_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
//
|
||||
// arg_from_python converters for Python type wrappers, to be used as
|
||||
// base classes for specializations.
|
||||
//
|
||||
namespace boost { namespace python { namespace converter {
|
||||
|
||||
template <PyTypeObject* python_type>
|
||||
struct pytype_arg_from_python
|
||||
{
|
||||
pytype_arg_from_python(PyObject*);
|
||||
bool convertible() const;
|
||||
private:
|
||||
PyObject* m_src;
|
||||
};
|
||||
|
||||
// rvalue converter base
|
||||
template <class Wrapper, PyTypeObject* python_type>
|
||||
struct pytype_wrapper_value_arg_from_python
|
||||
: pytype_arg_from_python<python_type>
|
||||
{
|
||||
typedef Wrapper result_type;
|
||||
|
||||
pytype_wrapper_value_arg_from_python(PyObject*);
|
||||
Wrapper operator()(PyObject*) const;
|
||||
};
|
||||
|
||||
// Special case for Wrapper& - must store an lvalue internally. This
|
||||
// OK because the entire state of the object is actually in the Python
|
||||
// object.
|
||||
template <class Wrapper, PyTypeObject* python_type>
|
||||
struct pytype_wrapper_ref_arg_from_python
|
||||
: pytype_arg_from_python<python_type>
|
||||
{
|
||||
typedef Wrapper& result_type;
|
||||
|
||||
pytype_wrapper_ref_arg_from_python(PyObject*);
|
||||
Wrapper& operator()(PyObject*) const;
|
||||
private:
|
||||
mutable Wrapper m_result;
|
||||
};
|
||||
|
||||
//
|
||||
// implementations
|
||||
//
|
||||
|
||||
template <PyTypeObject* python_type>
|
||||
inline pytype_arg_from_python<python_type>::pytype_arg_from_python(PyObject* x)
|
||||
: m_src(x)
|
||||
{
|
||||
}
|
||||
|
||||
template <PyTypeObject* python_type>
|
||||
inline bool pytype_arg_from_python<python_type>::convertible() const
|
||||
{
|
||||
return PyObject_IsInstance(m_src, (PyObject*)python_type);
|
||||
}
|
||||
|
||||
template <class Wrapper, PyTypeObject* python_type>
|
||||
pytype_wrapper_value_arg_from_python<Wrapper,python_type>::pytype_wrapper_value_arg_from_python(
|
||||
PyObject* p)
|
||||
: pytype_arg_from_python<python_type>(p)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Wrapper, PyTypeObject* python_type>
|
||||
Wrapper pytype_wrapper_value_arg_from_python<Wrapper,python_type>::operator()(
|
||||
PyObject* x) const
|
||||
{
|
||||
return Wrapper(python::detail::borrowed_reference(x));
|
||||
}
|
||||
|
||||
template <class Wrapper, PyTypeObject* python_type>
|
||||
pytype_wrapper_ref_arg_from_python<Wrapper,python_type>::pytype_wrapper_ref_arg_from_python(
|
||||
PyObject* p)
|
||||
: pytype_arg_from_python<python_type>(p)
|
||||
, m_result(python::detail::borrowed_reference(p))
|
||||
{
|
||||
}
|
||||
|
||||
template <class Wrapper, PyTypeObject* python_type>
|
||||
Wrapper& pytype_wrapper_ref_arg_from_python<Wrapper,python_type>::operator()(
|
||||
PyObject* x) const
|
||||
{
|
||||
return m_result;
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::converter
|
||||
|
||||
#endif // PYTYPE_ARG_FROM_PYTHON_DWA2002628_HPP
|
||||
@@ -69,7 +69,7 @@ namespace detail
|
||||
|
||||
if (!policies.precall(args_)) return 0;
|
||||
|
||||
PyObject* result = cr( (c0(PyTuple_GET_ITEM(args_, 0)))->*pm );
|
||||
PyObject* result = cr( (c0())->*pm );
|
||||
|
||||
return policies.postcall(args_, result);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ namespace detail
|
||||
|
||||
if (!policies.precall(args_)) return 0;
|
||||
|
||||
(c0(PyTuple_GET_ITEM(args_, 0))).*pm = c1(PyTuple_GET_ITEM(args_, 1));
|
||||
(c0()).*pm = c1();
|
||||
|
||||
return policies.postcall(args_, detail::none());
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace detail
|
||||
|
||||
if (!policies.precall(args_)) return 0;
|
||||
|
||||
*p = c0(PyTuple_GET_ITEM(args_, 0));
|
||||
*p = c0();
|
||||
|
||||
return policies.postcall(args_, detail::none());
|
||||
}
|
||||
|
||||
@@ -17,18 +17,20 @@
|
||||
# include <boost/mpl/at.hpp>
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/iteration/local.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
# include <boost/preprocessor/repetition/repeat.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/dec.hpp>
|
||||
# include <boost/preprocessor/if.hpp>
|
||||
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/python/detail/invoke.hpp>
|
||||
# include <boost/python/detail/signature.hpp>
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
|
||||
# include <boost/python/arg_from_python.hpp>
|
||||
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/dec.hpp>
|
||||
# include <boost/preprocessor/if.hpp>
|
||||
# include <boost/preprocessor/iteration/local.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
# include <boost/preprocessor/repetition/repeat.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -37,14 +39,6 @@ namespace boost { namespace python { namespace detail {
|
||||
// implementation
|
||||
typedef int void_result_to_python;
|
||||
|
||||
// A metafunction taking an iterator FunctionIter to a metafunction
|
||||
// class and an iterator ArgIter to an argument, which applies the
|
||||
// result of dereferencing FunctionIter to the result of dereferencing
|
||||
// ArgIter
|
||||
template <class FunctionIter, class ArgIter>
|
||||
struct apply_iter1
|
||||
: mpl::apply1<typename FunctionIter::type, typename ArgIter::type> {};
|
||||
|
||||
// Given a model of CallPolicies and a C++ result type, this
|
||||
// metafunction selects the appropriate converter to use for
|
||||
// converting the result to python.
|
||||
@@ -61,18 +55,17 @@ struct select_result_converter
|
||||
|
||||
template <unsigned> struct caller_arity;
|
||||
|
||||
template <class F, class ConverterGenerators, class CallPolicies, class Sig>
|
||||
template <class F, class CallPolicies, class Sig>
|
||||
struct caller;
|
||||
|
||||
# define BOOST_PYTHON_NEXT(init,name,n) \
|
||||
typedef BOOST_PP_IF(n,typename BOOST_PP_CAT(name,BOOST_PP_DEC(n)) ::next, init) name##n;
|
||||
|
||||
# define BOOST_PYTHON_ARG_CONVERTER(n) \
|
||||
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
|
||||
BOOST_PYTHON_NEXT(ConverterGenerators, conv_iter,n) \
|
||||
typedef typename apply_iter1<conv_iter##n,arg_iter##n>::type c_t##n; \
|
||||
c_t##n c##n(PyTuple_GET_ITEM(args_, n)); \
|
||||
if (!c##n.convertible()) \
|
||||
# define BOOST_PYTHON_ARG_CONVERTER(n) \
|
||||
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
|
||||
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
|
||||
c_t##n c##n(PyTuple_GET_ITEM(args_, n)); \
|
||||
if (!c##n.convertible()) \
|
||||
return 0;
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
@@ -84,11 +77,11 @@ struct caller;
|
||||
|
||||
// A metafunction returning the base class used for caller<class F,
|
||||
// class ConverterGenerators, class CallPolicies, class Sig>.
|
||||
template <class F, class ConverterGenerators, class CallPolicies, class Sig>
|
||||
template <class F, class CallPolicies, class Sig>
|
||||
struct caller_base_select
|
||||
{
|
||||
enum { arity = mpl::size<Sig>::value - 1 };
|
||||
typedef typename caller_arity<arity>::template impl<F,ConverterGenerators,CallPolicies,Sig> type;
|
||||
typedef typename caller_arity<arity>::template impl<F,CallPolicies,Sig> type;
|
||||
};
|
||||
|
||||
// A function object type which wraps C++ objects as Python callable
|
||||
@@ -101,11 +94,6 @@ struct caller_base_select
|
||||
// actually be any data for which an appropriate invoke_tag() can
|
||||
// be generated. invoke(...) takes care of the actual invocation syntax.
|
||||
//
|
||||
// ConverterGenerators -
|
||||
// An MPL iterator type over a sequence of metafunction classes
|
||||
// that can be applied to element 1...N of Sig to produce
|
||||
// argument from_python converters for the arguments
|
||||
//
|
||||
// CallPolicies -
|
||||
// The precall, postcall, and what kind of resultconverter to
|
||||
// generate for mpl::front<Sig>::type
|
||||
@@ -114,12 +102,12 @@ struct caller_base_select
|
||||
// The `intended signature' of the function. An MPL sequence
|
||||
// beginning with a result type and continuing with a list of
|
||||
// argument types.
|
||||
template <class F, class ConverterGenerators, class CallPolicies, class Sig>
|
||||
template <class F, class CallPolicies, class Sig>
|
||||
struct caller
|
||||
: caller_base_select<F,ConverterGenerators,CallPolicies,Sig>::type
|
||||
: caller_base_select<F,CallPolicies,Sig>::type
|
||||
{
|
||||
typedef typename caller_base_select<
|
||||
F,ConverterGenerators,CallPolicies,Sig
|
||||
F,CallPolicies,Sig
|
||||
>::type base;
|
||||
|
||||
typedef PyObject* result_type;
|
||||
@@ -139,7 +127,7 @@ struct caller
|
||||
template <>
|
||||
struct caller_arity<N>
|
||||
{
|
||||
template <class F, class ConverterGenerators, class Policies, class Sig>
|
||||
template <class F, class Policies, class Sig>
|
||||
struct impl
|
||||
{
|
||||
impl(F f, Policies p) : m_data(f,p) {}
|
||||
|
||||
@@ -30,7 +30,7 @@ object make_keyword_range_function(
|
||||
, keyword_range const& kw)
|
||||
{
|
||||
return detail::make_function_aux(
|
||||
f, policies, args_from_python(), detail::get_signature(f), kw, mpl::int_<0>());
|
||||
f, policies, detail::get_signature(f), kw, mpl::int_<0>());
|
||||
}
|
||||
|
||||
template <class F, class Policies, class Signature>
|
||||
@@ -41,7 +41,7 @@ object make_keyword_range_function(
|
||||
, Signature const& sig)
|
||||
{
|
||||
return detail::make_function_aux(
|
||||
f, policies, args_from_python(), sig, kw, mpl::int_<0>());
|
||||
f, policies, sig, kw, mpl::int_<0>());
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
@@ -33,8 +33,10 @@ template <unsigned> struct signature_arity;
|
||||
(3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/signature.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
// A metafunction returning the base class used for signature<class F,
|
||||
// class ConverterGenerators, class CallPolicies, class Sig>.
|
||||
// A metafunction returning the base class used for
|
||||
//
|
||||
// signature<class F, class CallPolicies, class Sig>.
|
||||
//
|
||||
template <class Sig>
|
||||
struct signature_base_select
|
||||
{
|
||||
|
||||
@@ -26,17 +26,16 @@ namespace detail
|
||||
// These helper functions for make_function (below) do the raw work
|
||||
// of constructing a Python object from some invokable entity. See
|
||||
// <boost/python/detail/caller.hpp> for more information about how
|
||||
// the ConverterGenerators and Sig arguments are used.
|
||||
template <class F, class CallPolicies, class ConverterGenerators, class Sig>
|
||||
// the Sig arguments is used.
|
||||
template <class F, class CallPolicies, class Sig>
|
||||
object make_function_aux(
|
||||
F f // An object that can be invoked by detail::invoke()
|
||||
, CallPolicies const& p // CallPolicies to use in the invocation
|
||||
, ConverterGenerators const& // An MPL iterator over a sequence of arg_from_python generators
|
||||
, Sig const& // An MPL sequence of argument types expected by F
|
||||
)
|
||||
{
|
||||
return objects::function_object(
|
||||
detail::caller<F,ConverterGenerators,CallPolicies,Sig>(f, p)
|
||||
detail::caller<F,CallPolicies,Sig>(f, p)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,11 +43,10 @@ namespace detail
|
||||
// is used only for a compile-time assertion to make sure the user
|
||||
// doesn't pass more keywords than the function can accept. To
|
||||
// disable all checking, pass mpl::int_<0> for NumKeywords.
|
||||
template <class F, class CallPolicies, class ConverterGenerators, class Sig, class NumKeywords>
|
||||
template <class F, class CallPolicies, class Sig, class NumKeywords>
|
||||
object make_function_aux(
|
||||
F f
|
||||
, CallPolicies const& p
|
||||
, ConverterGenerators const&
|
||||
, Sig const&
|
||||
, detail::keyword_range const& kw // a [begin,end) pair of iterators over keyword names
|
||||
, NumKeywords // An MPL integral type wrapper: the size of kw
|
||||
@@ -61,7 +59,7 @@ namespace detail
|
||||
>::too_many_keywords assertion;
|
||||
|
||||
return objects::function_object(
|
||||
detail::caller<F,ConverterGenerators,CallPolicies,Sig>(f, p)
|
||||
detail::caller<F,CallPolicies,Sig>(f, p)
|
||||
, kw);
|
||||
}
|
||||
|
||||
@@ -75,7 +73,6 @@ namespace detail
|
||||
return detail::make_function_aux(
|
||||
f
|
||||
, policies
|
||||
, detail::args_from_python()
|
||||
, detail::get_signature(f)
|
||||
, kw.range()
|
||||
, mpl::int_<Keywords::size>()
|
||||
@@ -88,7 +85,6 @@ namespace detail
|
||||
return detail::make_function_aux(
|
||||
f
|
||||
, policies
|
||||
, detail::args_from_python()
|
||||
, sig
|
||||
);
|
||||
}
|
||||
@@ -103,14 +99,14 @@ template <class F>
|
||||
object make_function(F f)
|
||||
{
|
||||
return detail::make_function_aux(
|
||||
f,default_call_policies(),detail::args_from_python(), detail::get_signature(f));
|
||||
f,default_call_policies(), detail::get_signature(f));
|
||||
}
|
||||
|
||||
template <class F, class CallPolicies>
|
||||
object make_function(F f, CallPolicies const& policies)
|
||||
{
|
||||
return detail::make_function_aux(
|
||||
f,policies,detail::args_from_python(), detail::get_signature(f));
|
||||
f, policies, detail::get_signature(f));
|
||||
}
|
||||
|
||||
template <class F, class CallPolicies, class KeywordsOrSignature>
|
||||
@@ -142,7 +138,6 @@ object make_function(
|
||||
return detail::make_function_aux(
|
||||
f
|
||||
, policies
|
||||
, detail::args_from_python()
|
||||
, sig
|
||||
, kw.range()
|
||||
, mpl::int_<Keywords::size>()
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
# include <boost/python/default_call_policies.hpp>
|
||||
# include <boost/python/object/py_function.hpp>
|
||||
# include <boost/python/signature.hpp>
|
||||
# include <boost/python/arg_from_python.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
@@ -26,7 +25,7 @@ inline handle<> function_handle(F const& f, Signature)
|
||||
|
||||
return objects::function_handle_impl(
|
||||
python::detail::caller<
|
||||
F,python::detail::args_from_python,default_call_policies,Signature
|
||||
F,default_call_policies,Signature
|
||||
>(
|
||||
f, default_call_policies()
|
||||
)
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace detail
|
||||
|
||||
PyObject* py_self = PyTuple_GET_ITEM(args_, 0);
|
||||
arg_from_python<range_*> c0(py_self);
|
||||
range_* self = c0(py_self);
|
||||
range_* self = c0();
|
||||
|
||||
// Done iterating?
|
||||
if (self->m_start == self->m_finish)
|
||||
@@ -165,7 +165,7 @@ namespace detail
|
||||
PyObject* arg0 = PyTuple_GET_ITEM(args_, 0);
|
||||
arg_from_python<Target> c0(arg0);
|
||||
if (!c0.convertible()) return 0;
|
||||
typename arg_from_python<Target>::result_type x = c0(arg0);
|
||||
typename arg_from_python<Target>::result_type x = c0();
|
||||
|
||||
// Build and convert the iterator_range<>.
|
||||
return cr(
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
# include <boost/python/def_visitor.hpp>
|
||||
# include <boost/python/default_call_policies.hpp>
|
||||
# include <boost/python/arg_from_python.hpp>
|
||||
# include <boost/mpl/push_front.hpp>
|
||||
# include <boost/mpl/pop_front.hpp>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user