mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 18:12:43 +00:00
Restore main trunk to health
[SVN r15378]
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
// 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
|
||||
@@ -8,14 +6,8 @@
|
||||
#ifndef ARGS_DWA2002323_HPP
|
||||
# define ARGS_DWA2002323_HPP
|
||||
# include <boost/config.hpp>
|
||||
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
|
||||
# include <boost/mpl/type_list.hpp>
|
||||
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/debug/line.hpp>
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -28,76 +20,15 @@ namespace detail
|
||||
}
|
||||
}}
|
||||
|
||||
# if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 245
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
// A type list for specifying arguments
|
||||
template < BOOST_PYTHON_ENUM_WITH_DEFAULT(BOOST_PYTHON_MAX_ARITY, typename A, boost::mpl::null_argument) >
|
||||
template < BOOST_PYTHON_ENUM_WITH_DEFAULT(BOOST_PYTHON_MAX_ARITY, typename A, mpl::void_) >
|
||||
struct args : detail::args_base<args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
|
||||
, boost::mpl::type_list< BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A) >::type
|
||||
, detail::type_list< BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A) >::type
|
||||
{};
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
# else // slow template instantiators need this other version with
|
||||
// explicit specializations of mpl::size<> and
|
||||
// mpl::at<>. Eventually, however, inheritance from mpl::list
|
||||
// *should* be eliminated and the two versions unified, just in
|
||||
// order to get true arity independence
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
template < BOOST_PYTHON_ENUM_WITH_DEFAULT(BOOST_PYTHON_MAX_ARITY, typename A, boost::mpl::null_argument) >
|
||||
struct args : detail::args_base<args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
|
||||
{};
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template <class T> struct size;
|
||||
template <long N, class Seq> struct at;
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/args.hpp>, 1))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY - 1, <boost/python/args.hpp>, 2))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
|
||||
}} // namespace boost::mpl
|
||||
|
||||
# endif // __EDG_VERSION__
|
||||
|
||||
# endif // ARGS_DWA2002323_HPP
|
||||
|
||||
/* ---------- size ---------- */
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1
|
||||
# line BOOST_PP_LINE(__LINE__, args.hpp(size))
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PYTHON_UNARY_ENUM(N, class A)>
|
||||
struct size<boost::python::args<BOOST_PYTHON_UNARY_ENUM(N, A)> >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(long, value = N);
|
||||
};
|
||||
|
||||
# undef N
|
||||
|
||||
/* ---------- at ---------- */
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2
|
||||
# line BOOST_PP_LINE(__LINE__, args.hpp(at))
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, class A)>
|
||||
struct at<N, boost::python::args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
|
||||
{
|
||||
typedef BOOST_PP_CAT(A, N) type;
|
||||
};
|
||||
|
||||
# undef N
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,14 +6,16 @@
|
||||
#ifndef BASES_DWA2002321_HPP
|
||||
# define BASES_DWA2002321_HPP
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/mpl/type_list.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/identity/identity.hpp>
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
// A type list for specifying bases
|
||||
template < BOOST_MPL_LIST_DEFAULT_PARAMETERS(typename B, ::boost::mpl::null_argument) >
|
||||
struct bases : ::boost::mpl::type_list< BOOST_MPL_LIST_PARAMETERS(B) >::type
|
||||
template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_MAX_BASES, typename B, mpl::void_) >
|
||||
struct bases : detail::type_list< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, B) >::type
|
||||
{};
|
||||
|
||||
namespace detail
|
||||
@@ -23,14 +25,14 @@ namespace boost { namespace python {
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
template < BOOST_MPL_LIST_PARAMETERS(class B) >
|
||||
struct specifies_bases< bases< BOOST_MPL_LIST_PARAMETERS(B) > >
|
||||
template < BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, class B) >
|
||||
struct specifies_bases< bases< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, B) > >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
# else
|
||||
template < BOOST_MPL_LIST_PARAMETERS(class B) >
|
||||
static char is_bases_helper(bases< BOOST_MPL_LIST_PARAMETERS(B) > const&);
|
||||
template < BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, class B) >
|
||||
static char is_bases_helper(bases< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, B) > const&);
|
||||
|
||||
static char (& is_bases_helper(...) )[256];
|
||||
|
||||
@@ -45,7 +47,7 @@ namespace boost { namespace python {
|
||||
# endif
|
||||
template <class T, class Prev = bases<> >
|
||||
struct select_bases
|
||||
: mpl::select_type<
|
||||
: mpl::if_c<
|
||||
specifies_bases<T>::value
|
||||
, T
|
||||
, Prev
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
# include <boost/mpl/size.hpp>
|
||||
# include <boost/mpl/for_each.hpp>
|
||||
# include <boost/mpl/bool_t.hpp>
|
||||
# include <boost/mpl/bool_c.hpp>
|
||||
# include <boost/python/object/select_holder.hpp>
|
||||
# include <boost/python/object/class_wrapper.hpp>
|
||||
# include <boost/python/object/make_instance.hpp>
|
||||
@@ -40,7 +40,22 @@ namespace boost { namespace python {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct write_type_id;
|
||||
// This function object is used with mpl::for_each to write the id
|
||||
// of the type a pointer to which is passed as its 2nd compile-time
|
||||
// argument. into the iterator pointed to by its runtime argument
|
||||
struct write_type_id
|
||||
{
|
||||
write_type_id(type_info**p) : p(p) {}
|
||||
|
||||
// Here's the runtime behavior
|
||||
template <class T>
|
||||
void operator()(T*) const
|
||||
{
|
||||
*(*p)++ = type_id<T>();
|
||||
};
|
||||
|
||||
type_info** p;
|
||||
};
|
||||
|
||||
template <class T, class Prev = detail::not_specified>
|
||||
struct select_held_type;
|
||||
@@ -56,7 +71,7 @@ namespace detail
|
||||
// to the type of holder that must be created. The 3rd argument is a
|
||||
// reference to the Python type object to be created.
|
||||
template <class T, class SelectHolder>
|
||||
static inline void register_copy_constructor(mpl::bool_t<true> const&, SelectHolder const& , T* = 0)
|
||||
static inline void register_copy_constructor(mpl::bool_c<true> const&, SelectHolder const& , T* = 0)
|
||||
{
|
||||
typedef typename SelectHolder::type holder;
|
||||
force_instantiate(objects::class_wrapper<T,holder, objects::make_instance<T,holder> >());
|
||||
@@ -65,7 +80,7 @@ namespace detail
|
||||
|
||||
// Tag dispatched to have no effect.
|
||||
template <class T, class SelectHolder>
|
||||
static inline void register_copy_constructor(mpl::bool_t<false> const&, SelectHolder const&, T* = 0)
|
||||
static inline void register_copy_constructor(mpl::bool_c<false> const&, SelectHolder const&, T* = 0)
|
||||
{
|
||||
SelectHolder::register_();
|
||||
}
|
||||
@@ -126,7 +141,7 @@ class class_ : public objects::class_base
|
||||
|
||||
// Write the rest of the elements into succeeding positions.
|
||||
type_info* p = ids + 1;
|
||||
mpl::for_each<bases, void, detail::write_type_id>::execute(&p);
|
||||
mpl::for_each(detail::write_type_id(&p), (bases*)0, (add_pointer<mpl::_>*)0);
|
||||
}
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
@@ -274,7 +289,7 @@ class class_ : public objects::class_base
|
||||
self& def_init()
|
||||
{
|
||||
detail::assert_default_constructible<T>::check();
|
||||
this->def_init(mpl::type_list<>::type());
|
||||
this->def_init(mpl::list0<>::type());
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -401,7 +416,7 @@ inline void class_<T,X1,X2,X3>::register_() const
|
||||
objects::register_class_from_python<T,bases>();
|
||||
|
||||
detail::register_copy_constructor<T>(
|
||||
mpl::bool_t<is_copyable>()
|
||||
mpl::bool_c<is_copyable>()
|
||||
, holder_selector::execute((held_type*)0)
|
||||
);
|
||||
}
|
||||
@@ -452,28 +467,6 @@ inline class_<T,X1,X2,X3>::class_(char const* name, char const* doc, no_init_t)
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// This is an mpl BinaryMetaFunction object with a runtime behavior,
|
||||
// which is to write the id of the type which is passed as its 2nd
|
||||
// compile-time argument into the iterator pointed to by its runtime
|
||||
// argument
|
||||
struct write_type_id
|
||||
{
|
||||
// The first argument is Ignored because mpl::for_each is still
|
||||
// currently an accumulate (reduce) implementation.
|
||||
template <class Ignored, class T> struct apply
|
||||
{
|
||||
// also an artifact of accumulate-based for_each
|
||||
typedef void type;
|
||||
|
||||
// Here's the runtime behavior
|
||||
static void execute(type_info** p)
|
||||
{
|
||||
*(*p)++ = type_id<T>();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <class T1, class T2, class T3>
|
||||
struct has_noncopyable
|
||||
: type_traits::ice_or<
|
||||
@@ -485,7 +478,7 @@ namespace detail
|
||||
|
||||
template <class T, class Prev>
|
||||
struct select_held_type
|
||||
: mpl::select_type<
|
||||
: mpl::if_c<
|
||||
type_traits::ice_or<
|
||||
specifies_bases<T>::value
|
||||
, is_same<T,noncopyable>::value
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/converter/rvalue_from_python_data.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/converter/registry.hpp>
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/converter/registered_pointee.hpp>
|
||||
@@ -165,22 +165,22 @@ struct select_arg_from_python
|
||||
bool, back_ref =
|
||||
boost::python::is_back_reference<T>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
obj_mgr
|
||||
, object_manager_value_arg_from_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
obj_mgr_ref
|
||||
, object_manager_ref_arg_from_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ptr
|
||||
, pointer_arg_from_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ptr_cref
|
||||
, pointer_cref_arg_from_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ref
|
||||
, reference_arg_from_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
back_ref
|
||||
, back_reference_arg_from_python<T>
|
||||
, arg_rvalue_from_python<T>
|
||||
|
||||
@@ -109,22 +109,22 @@ namespace detail
|
||||
typedef typename unwrap_reference<T>::type unwrapped_referent;
|
||||
typedef typename unwrap_pointer<T>::type unwrapped_ptr;
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_string
|
||||
, arg_to_python<char const*>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
function
|
||||
, function_arg_to_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
manager
|
||||
, object_manager_arg_to_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ptr
|
||||
, pointer_deep_arg_to_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ptr_wrapper
|
||||
, pointer_shallow_arg_to_python<unwrapped_ptr>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ref_wrapper
|
||||
, reference_arg_to_python<unwrapped_referent>
|
||||
, value_arg_to_python<T>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# include <boost/python/cast.hpp>
|
||||
# include <boost/python/converter/pyobject_traits.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
|
||||
// Facilities for dealing with types which always manage Python
|
||||
@@ -102,7 +102,7 @@ struct default_object_manager_traits
|
||||
|
||||
template <class T>
|
||||
struct object_manager_traits
|
||||
: mpl::select_type<
|
||||
: mpl::if_c<
|
||||
is_handle<T>::value
|
||||
, handle_object_manager_traits<T>
|
||||
, default_object_manager_traits<T>
|
||||
@@ -164,7 +164,7 @@ namespace detail
|
||||
template <class T>
|
||||
struct is_object_manager_help
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_object_manager<T>::value
|
||||
, yes_reference_to_object_manager
|
||||
, no_reference_to_object_manager
|
||||
@@ -217,7 +217,7 @@ namespace detail
|
||||
template <class T>
|
||||
struct is_reference_to_object_manager
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_reference<T>::value
|
||||
, detail::is_reference_to_object_manager_ref<T>
|
||||
, detail::is_reference_to_object_manager_nonref<T>
|
||||
|
||||
@@ -63,13 +63,13 @@ namespace detail
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, ref = is_reference<T>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
obj_mgr
|
||||
, return_object_manager_from_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ptr
|
||||
, return_pointer_from_python<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ref
|
||||
, return_reference_from_python<T>
|
||||
, return_rvalue_from_python<T>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
# include <boost/python/detail/referent_storage.hpp>
|
||||
# include <boost/python/detail/destroy.hpp>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_cv.hpp>
|
||||
# include <cstddef>
|
||||
|
||||
// Data management for potential rvalue conversions from Python to C++
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef COPY_CONST_REFERENCE_DWA2002131_HPP
|
||||
# define COPY_CONST_REFERENCE_DWA2002131_HPP
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
@@ -28,7 +28,7 @@ struct copy_const_reference
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
detail::is_reference_to_const<T>::value
|
||||
, to_python_value<T>
|
||||
, detail::copy_const_reference_expects_a_const_reference_return_type<T>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef COPY_NON_CONST_REFERENCE_DWA2002131_HPP
|
||||
# define COPY_NON_CONST_REFERENCE_DWA2002131_HPP
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
@@ -28,7 +28,7 @@ struct copy_non_const_reference
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
boost::python::detail::is_reference_to_non_const<T>::value
|
||||
, to_python_value<T>
|
||||
, detail::copy_non_const_reference_expects_a_non_const_reference_return_type<T>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef DEFAULT_CALL_POLICIES_DWA2002131_HPP
|
||||
# define DEFAULT_CALL_POLICIES_DWA2002131_HPP
|
||||
# include <boost/python/detail/wrap_python.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
|
||||
@@ -50,7 +50,7 @@ struct default_result_converter
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, is_illegal = is_reference<R>::value || is_pointer<R>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_illegal
|
||||
, detail::specify_a_result_policy_to_wrap_functions_returning<R>
|
||||
, boost::python::to_python_value<
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/tag.hpp>
|
||||
@@ -77,7 +77,7 @@ typedef char (&no_borrowed_ptr_t)[2];
|
||||
no_borrowed_ptr_t is_borrowed_ptr_test(...);
|
||||
|
||||
template <class T>
|
||||
typename mpl::select_type<
|
||||
typename mpl::if_c<
|
||||
is_pointer<T>::value
|
||||
, T
|
||||
, int
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
|
||||
# // temp: include <boost/mpl/select_type.hpp>
|
||||
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/debug/line.hpp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# define CONVERTIBLE_DWA2002614_HPP
|
||||
|
||||
# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 241
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/conversion_traits.hpp>
|
||||
# endif
|
||||
|
||||
@@ -26,7 +26,7 @@ struct convertible
|
||||
static inline yes_convertible check(Target) { return 0; }
|
||||
# else
|
||||
template <class X>
|
||||
static inline typename mpl::select_type<
|
||||
static inline typename mpl::if_c<
|
||||
is_convertible<X,Target>::value
|
||||
, yes_convertible
|
||||
, no_convertible
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
#include <boost/python/detail/defaults_gen.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/mpl/int_t.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/python/detail/type_list_utils.hpp>
|
||||
#include <boost/python/class_fwd.hpp>
|
||||
#include <boost/python/object/function.hpp>
|
||||
#include <boost/python/scope.hpp>
|
||||
@@ -86,7 +86,7 @@ static void name_space_def(
|
||||
// template <typename StubsT, typename NameSpaceT>
|
||||
// inline void
|
||||
// define_stub_function(
|
||||
// char const* name, StubsT s, NameSpaceT& name_space, boost::mpl::int_t<N>)
|
||||
// char const* name, StubsT s, NameSpaceT& name_space, mpl::int_c<N>)
|
||||
// {
|
||||
// name_space.def(name, &StubsT::func_N);
|
||||
// }
|
||||
@@ -186,9 +186,9 @@ struct define_stub_function {};
|
||||
// is a typelist that specifies the return type, the class (for member
|
||||
// functions, and the arguments. Here are some SigT examples:
|
||||
//
|
||||
// int foo(int) mpl::type_list<int, int>
|
||||
// void bar(int, int) mpl::type_list<void, int, int>
|
||||
// void C::foo(int) mpl::type_list<void, C, int>
|
||||
// int foo(int) mpl::list<int, int>
|
||||
// void bar(int, int) mpl::list<void, int, int>
|
||||
// void C::foo(int) mpl::list<void, C, int>
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <class StubsT, class CallPolicies, class NameSpaceT, class SigT>
|
||||
@@ -201,19 +201,18 @@ struct define_stub_function {};
|
||||
SigT sig,
|
||||
char const* doc)
|
||||
{
|
||||
typedef typename boost::python::detail::type_at<0, SigT>::type nth_type;
|
||||
typedef typename mpl::front<SigT>::type return_type;
|
||||
typedef typename StubsT::v_type v_type;
|
||||
typedef typename StubsT::nv_type nv_type;
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
boost::is_same<void, nth_type>::value
|
||||
typedef typename mpl::if_c<
|
||||
boost::is_same<void, return_type>::value
|
||||
, v_type
|
||||
, nv_type
|
||||
>::type stubs_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(stubs_type::max_args) <=
|
||||
boost::python::detail::type_list_size<SigT>::value);
|
||||
(stubs_type::max_args) <= mpl::size<SigT>::value);
|
||||
|
||||
typedef typename stubs_type::template gen<SigT> gen_type;
|
||||
define_with_defaults_helper<stubs_type::n_funcs-1>::def
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/comma_if.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/python/detail/type_list_utils.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -39,7 +40,7 @@ struct func_stubs_base {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define BPL_IMPL_TYPEDEF_GEN(z, INDEX, DATA) \
|
||||
typedef typename boost::python::detail::type_at \
|
||||
typedef typename ::boost::mpl::at_c \
|
||||
< \
|
||||
BOOST_PP_ADD_D(1, INDEX, DATA), \
|
||||
SigT \
|
||||
@@ -70,7 +71,7 @@ struct func_stubs_base {};
|
||||
template <typename SigT> \
|
||||
struct gen { \
|
||||
\
|
||||
typedef typename boost::python::detail::type_at<0, SigT>::type RT; \
|
||||
typedef typename ::boost::mpl::front<SigT>::type RT; \
|
||||
\
|
||||
BOOST_PP_REPEAT_2ND \
|
||||
( \
|
||||
@@ -113,8 +114,8 @@ struct func_stubs_base {};
|
||||
template <typename SigT> \
|
||||
struct gen { \
|
||||
\
|
||||
typedef typename boost::python::detail::type_at<0, SigT>::type RT; \
|
||||
typedef typename boost::python::detail::type_at<1, SigT>::type ClassT; \
|
||||
typedef typename ::boost::mpl::front<SigT>::type RT; \
|
||||
typedef typename ::boost::mpl::at_c<1, SigT>::type ClassT; \
|
||||
\
|
||||
BOOST_PP_REPEAT_2ND \
|
||||
( \
|
||||
@@ -224,11 +225,11 @@ struct func_stubs_base {};
|
||||
// template <typename SigT>
|
||||
// struct gen {
|
||||
//
|
||||
// typedef typename mpl::at<0, SigT>::type RT;
|
||||
// typedef typename mpl::at<1, SigT>::type T0;
|
||||
// typedef typename mpl::at<2, SigT>::type T1;
|
||||
// typedef typename mpl::at<3, SigT>::type T2;
|
||||
// typedef typename mpl::at<4, SigT>::type T3;
|
||||
// typedef typename ::boost::mpl::at_c<0, SigT>::type RT;
|
||||
// typedef typename ::boost::mpl::at_c<1, SigT>::type T0;
|
||||
// typedef typename ::boost::mpl::at_c<2, SigT>::type T1;
|
||||
// typedef typename ::boost::mpl::at_c<3, SigT>::type T2;
|
||||
// typedef typename ::boost::mpl::at_c<4, SigT>::type T3;
|
||||
//
|
||||
// static RT func_0(T0 arg0)
|
||||
// { return foo(arg0); }
|
||||
|
||||
@@ -67,8 +67,8 @@ inline void destroy_referent_impl(void* p, T& (*)())
|
||||
// note: cv-qualification needed for MSVC6
|
||||
// must come *before* T for metrowerks
|
||||
value_destroyer<
|
||||
(boost::is_array<T>::value)
|
||||
, (boost::has_trivial_destructor<T>::value)
|
||||
(boost::is_array<T>::value)
|
||||
,(boost::has_trivial_destructor<T>::value)
|
||||
>::execute((const volatile T*)p);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,17 @@
|
||||
// to its suitability for any purpose.
|
||||
#ifndef INDIRECT_TRAITS_DWA2002131_HPP
|
||||
# define INDIRECT_TRAITS_DWA2002131_HPP
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/type_traits/function_traits.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/type_traits/is_function.hpp>
|
||||
# include <boost/type_traits/detail/ice_and.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/type_traits/is_class.hpp>
|
||||
# include <boost/type_traits/is_const.hpp>
|
||||
# include <boost/type_traits/is_volatile.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -184,7 +190,7 @@ typedef char (&outer_no_type)[1];
|
||||
template <typename V>
|
||||
struct is_const_help
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_const<V>::value
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
@@ -194,7 +200,7 @@ struct is_const_help
|
||||
template <typename V>
|
||||
struct is_volatile_help
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_volatile<V>::value
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
@@ -204,7 +210,7 @@ struct is_volatile_help
|
||||
template <typename V>
|
||||
struct is_pointer_help
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_pointer<V>::value
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
@@ -214,7 +220,7 @@ struct is_pointer_help
|
||||
template <typename V>
|
||||
struct is_class_help
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_class<V>::value
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
@@ -228,7 +234,7 @@ struct is_reference_to_function
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(::boost::detail::is_function_tester(t)) == sizeof(::boost::type_traits::yes_type));
|
||||
= sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type));
|
||||
# endif
|
||||
|
||||
template <class T>
|
||||
@@ -237,7 +243,7 @@ struct is_pointer_to_function
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(::boost::detail::is_function_tester(t)) == sizeof(::boost::type_traits::yes_type));
|
||||
= sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type));
|
||||
};
|
||||
|
||||
struct false_helper1
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
@@ -71,7 +71,7 @@ struct member_function_cast
|
||||
# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
: member_function_cast_impl<T>
|
||||
# else
|
||||
: mpl::select_type<
|
||||
: mpl::if_c<
|
||||
is_member_function_pointer<SF>::value
|
||||
, member_function_cast_impl<T>
|
||||
, non_member_function_cast_impl
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
|
||||
#include <boost/type.hpp>
|
||||
#include <typeinfo>
|
||||
#include <boost/type_traits/array_traits.hpp>
|
||||
#include <boost/type_traits/reference_traits.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_volatile.hpp>
|
||||
//
|
||||
// Fix for MSVC's broken typeid() implementation which doesn't strip
|
||||
// decoration. This fix doesn't handle cv-qualified array types. It
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
# define BOOST_PYTHON_MAX_ARITY 15
|
||||
# endif
|
||||
|
||||
# ifndef BOOST_PYTHON_MAX_BASES
|
||||
# define BOOST_PYTHON_MAX_BASES 10
|
||||
# endif
|
||||
|
||||
# define BOOST_PYTHON_CV_QUALIFIER(i) \
|
||||
BOOST_PYTHON_APPLY( \
|
||||
BOOST_PP_TUPLE_ELEM(4, i, BOOST_PYTHON_CV_QUALIFIER_I) \
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// to its suitability for any purpose.
|
||||
#ifndef REFERENT_STORAGE_DWA200278_HPP
|
||||
# define REFERENT_STORAGE_DWA200278_HPP
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <cstddef>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
@@ -16,7 +16,7 @@ typedef int (alignment_dummy::*member_ptr);
|
||||
typedef int (alignment_dummy::*member_function_ptr)();
|
||||
|
||||
# define BOOST_PYTHON_ALIGNER(T, n) \
|
||||
typename mpl::select_type< \
|
||||
typename mpl::if_c< \
|
||||
sizeof(T) <= size, T, char>::type t##n
|
||||
|
||||
// Storage for size bytes, aligned to all fundamental types no larger than size
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
@@ -60,7 +60,7 @@ struct void_type
|
||||
template <class T>
|
||||
struct result_result
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_class<T>::value
|
||||
, get_result_type<T>
|
||||
, void_type
|
||||
|
||||
@@ -3,14 +3,38 @@
|
||||
// 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 TYPE_LIST_DWA200222_HPP
|
||||
# define TYPE_LIST_DWA200222_HPP
|
||||
# include <boost/mpl/type_list.hpp>
|
||||
#ifndef TYPE_LIST_DWA2002913_HPP
|
||||
# define TYPE_LIST_DWA2002913_HPP
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
|
||||
struct empty_list : boost::mpl::type_list<>::type {};
|
||||
# if BOOST_PYTHON_MAX_ARITY + 2 > BOOST_PYTHON_MAX_BASES
|
||||
# define BOOST_PYTHON_LIST_SIZE BOOST_PP_INC(BOOST_PP_INC(BOOST_PYTHON_MAX_ARITY))
|
||||
# else
|
||||
# define BOOST_PYTHON_BASE_LIST_SIZE BOOST_PYTHON_MAX_BASES
|
||||
# endif
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
// Compute the MPL list header to use for lists up to BOOST_PYTHON_LIST_SIZE in length
|
||||
# if BOOST_PYTHON_LIST_SIZE > 48
|
||||
# error Arities above 48 not supported by Boost.Python due to MPL internal limit
|
||||
# elif BOOST_PYTHON_LIST_SIZE > 38
|
||||
# include <boost/mpl/list/list50.hpp>
|
||||
# elif BOOST_PYTHON_LIST_SIZE > 28
|
||||
# include <boost/mpl/list/list40.hpp>
|
||||
# elif BOOST_PYTHON_LIST_SIZE > 18
|
||||
# include <boost/mpl/list/list30.hpp>
|
||||
# elif BOOST_PYTHON_LIST_SIZE > 8
|
||||
# include <boost/mpl/list/list20.hpp>
|
||||
# else
|
||||
# include <boost/mpl/list/list10.hpp>
|
||||
# endif
|
||||
|
||||
#endif // TYPE_LIST_DWA200222_HPP
|
||||
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# include <boost/python/detail/type_list_impl.hpp>
|
||||
# else
|
||||
# include <boost/python/detail/type_list_impl_no_pts.hpp>
|
||||
# endif
|
||||
|
||||
#endif // TYPE_LIST_DWA2002913_HPP
|
||||
|
||||
55
include/boost/python/detail/type_list_impl.hpp
Normal file
55
include/boost/python/detail/type_list_impl.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
// 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 TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
# define TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
# include <boost/preprocessor/repetition/enum.hpp>
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_LIST_SIZE, class T, mpl::void_)>
|
||||
struct type_list
|
||||
: BOOST_PP_CAT(mpl::list,BOOST_PYTHON_LIST_SIZE)<BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE, T)>
|
||||
{
|
||||
};
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PP_DEC(BOOST_PYTHON_LIST_SIZE), <boost/python/detail/type_list_impl.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
# endif // TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
# define BOOST_PYTHON_VOID_ARGS BOOST_PP_SUB_D(1,BOOST_PYTHON_LIST_SIZE,N)
|
||||
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS(N, class T)
|
||||
>
|
||||
struct type_list<
|
||||
BOOST_PP_ENUM_PARAMS(N, T)
|
||||
BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM(
|
||||
BOOST_PYTHON_VOID_ARGS, BOOST_PYTHON_FIXED, mpl::void_)
|
||||
>
|
||||
: BOOST_PP_CAT(mpl::list,N)<BOOST_PP_ENUM_PARAMS(N, T)>
|
||||
{
|
||||
};
|
||||
|
||||
# undef BOOST_PYTHON_VOID_ARGS
|
||||
# undef N
|
||||
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
101
include/boost/python/detail/type_list_impl_no_pts.hpp
Normal file
101
include/boost/python/detail/type_list_impl_no_pts.hpp
Normal file
@@ -0,0 +1,101 @@
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
// 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 TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP
|
||||
# define TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP
|
||||
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/repeat.hpp>
|
||||
# include <boost/preprocessor/empty.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/mpl/void.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template< typename T >
|
||||
struct is_list_arg
|
||||
{
|
||||
enum { value = true };
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_list_arg<mpl::void_>
|
||||
{
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
template<int> struct type_list_impl_chooser;
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PYTHON_LIST_SIZE, <boost/python/detail/type_list_impl_no_pts.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# define BOOST_PYTHON_PLUS() +
|
||||
# define BOOST_PYTHON_IS_LIST_ARG(z, n, data) \
|
||||
BOOST_PP_IF(n, BOOST_PYTHON_PLUS, BOOST_PP_EMPTY)() \
|
||||
is_list_arg< BOOST_PP_CAT(T,n) >::value
|
||||
|
||||
template<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE, class T)
|
||||
>
|
||||
struct type_list_count_args
|
||||
{
|
||||
enum { value =
|
||||
BOOST_PP_REPEAT_1(BOOST_PYTHON_LIST_SIZE, BOOST_PYTHON_IS_LIST_ARG, _)
|
||||
};
|
||||
};
|
||||
|
||||
# undef BOOST_PYTHON_IS_LIST_ARG
|
||||
# undef BOOST_PYTHON_PLUS
|
||||
|
||||
template<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE, class T)
|
||||
>
|
||||
struct type_list_impl
|
||||
{
|
||||
typedef type_list_count_args< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE,T) > arg_num_;
|
||||
typedef typename detail::type_list_impl_chooser< arg_num_::value >
|
||||
::template result_< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE,T) >::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_LIST_SIZE, class T, mpl::void_)
|
||||
>
|
||||
struct type_list
|
||||
: detail::type_list_impl< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE,T) >::type
|
||||
{
|
||||
typedef typename detail::type_list_impl<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE,T)
|
||||
>::type type;
|
||||
};
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
# endif // TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
template<>
|
||||
struct type_list_impl_chooser<N>
|
||||
{
|
||||
template<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_LIST_SIZE, class T)
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef BOOST_PP_CAT(mpl::list,N)<
|
||||
BOOST_PP_ENUM_PARAMS(N, T)
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
# undef N
|
||||
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
@@ -1,116 +1,28 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#error obsolete
|
||||
// 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#ifndef TYPE_LIST_UTILS_JDG20020826_HPP
|
||||
#define TYPE_LIST_UTILS_JDG20020826_HPP
|
||||
# define TYPE_LIST_UTILS_JDG20020826_HPP
|
||||
|
||||
# include <boost/mpl/at.hpp>
|
||||
# include <boost/mpl/size.hpp>
|
||||
//# include <boost/mpl/pop_front.hpp>
|
||||
//# include <boost/mpl/pop_back.hpp>
|
||||
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/enum_shifted_params.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/dec.hpp>
|
||||
# include <boost/preprocessor/debug/line.hpp>
|
||||
|
||||
# include <boost/mpl/type_list.hpp>
|
||||
|
||||
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
# if (!defined(__EDG_VERSION__) || __EDG_VERSION__ > 245) \
|
||||
&& (!defined(BOOST_INTEL_CXX_VERSION) || BOOST_INTEL_CXX_VERSION > 600)
|
||||
template< typename T >
|
||||
struct is_list_arg
|
||||
{
|
||||
enum { value = true };
|
||||
};
|
||||
|
||||
template <int N, class L>
|
||||
struct type_at : public boost::mpl::at<N, L> {};
|
||||
|
||||
template <class L>
|
||||
struct type_list_size : public boost::mpl::size<L> {};
|
||||
|
||||
// template <class L>
|
||||
// struct pop_front : public boost::mpl::pop_front<L> {};
|
||||
//
|
||||
// template <class L>
|
||||
// struct pop_back : public boost::mpl::pop_back<L> {};
|
||||
|
||||
# else
|
||||
|
||||
template <int N, class L>
|
||||
struct type_at {};
|
||||
|
||||
template <class L>
|
||||
struct type_list_size {};
|
||||
|
||||
// template <class L>
|
||||
// struct pop_front {};
|
||||
//
|
||||
// template <class L>
|
||||
// struct pop_back {};
|
||||
|
||||
// template <class L, class T>
|
||||
// struct push_back {};
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/type_list_utils.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# endif
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
template<>
|
||||
struct is_list_arg<mpl::void_>
|
||||
{
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
}}}
|
||||
# endif
|
||||
#endif // TYPE_LIST_UTILS_JDG20020826_HPP
|
||||
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
# if (N < BOOST_PYTHON_MAX_ARITY-1)
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_ARITY, class A)>
|
||||
struct type_at<N, boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_ARITY, A)> >
|
||||
{
|
||||
typedef BOOST_PP_CAT(A, N) type;
|
||||
};
|
||||
|
||||
// template <BOOST_PP_ENUM_PARAMS(N, class A) BOOST_PP_COMMA_IF(N) class T>
|
||||
// struct push_back<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)>, T>
|
||||
// {
|
||||
// typedef boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A) BOOST_PP_COMMA_IF(N) T> sequence;
|
||||
// };
|
||||
|
||||
# if (N > 0)
|
||||
|
||||
// template <BOOST_PP_ENUM_PARAMS(N, class A)>
|
||||
// struct pop_front<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)> >
|
||||
// {
|
||||
// typedef boost::mpl::type_list<BOOST_PP_ENUM_SHIFTED_PARAMS(N, A)> sequence;
|
||||
// };
|
||||
//
|
||||
// template <BOOST_PP_ENUM_PARAMS(N, class A)>
|
||||
// struct pop_back<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)> >
|
||||
// {
|
||||
// typedef boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), A)> sequence;
|
||||
// };
|
||||
|
||||
# endif
|
||||
# endif
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, class A)>
|
||||
struct type_list_size<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)> >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(long, value = N);
|
||||
};
|
||||
|
||||
# undef N
|
||||
|
||||
#endif // !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
@@ -87,13 +87,13 @@ namespace converter
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, ref = is_reference<T>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
obj_mgr
|
||||
, extract_object_manager<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ptr
|
||||
, extract_pointer<T>
|
||||
, typename mpl::select_type<
|
||||
, typename mpl::if_c<
|
||||
ref
|
||||
, extract_reference<T>
|
||||
, extract_rvalue<T>
|
||||
|
||||
@@ -10,21 +10,29 @@
|
||||
#ifndef INIT_JDG20020820_HPP
|
||||
#define INIT_JDG20020820_HPP
|
||||
|
||||
#include <boost/mpl/type_list.hpp>
|
||||
#include <boost/mpl/for_each.hpp>
|
||||
#include <boost/mpl/select_type.hpp>
|
||||
#include <boost/python/detail/type_list.hpp>
|
||||
#include <boost/mpl/fold_backward.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/apply_if.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
#include <boost/mpl/iterator_range.hpp>
|
||||
#include <boost/mpl/logical/not.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/find_if.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/pop_front.hpp>
|
||||
#include <boost/mpl/pop_back.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/enum_params.hpp>
|
||||
#include <boost/preprocessor/enum_params.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/inc.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define BOOST_PYTHON_TEMPLATE_TYPES_WITH_DEFAULT \
|
||||
@@ -32,7 +40,7 @@
|
||||
( \
|
||||
BOOST_PYTHON_MAX_ARITY, \
|
||||
class T, \
|
||||
boost::mpl::null_argument \
|
||||
mpl::void_ \
|
||||
) \
|
||||
|
||||
#define BOOST_PYTHON_TEMPLATE_TYPES \
|
||||
@@ -61,16 +69,6 @@ struct optional; // forward declaration
|
||||
|
||||
namespace detail {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// is_nil<T>::value
|
||||
//
|
||||
// This metaprogram checks if T is nil
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <class T>
|
||||
struct is_nil : public boost::is_same<T, boost::mpl::null_argument> {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// is_optional<T>::value
|
||||
@@ -95,291 +93,159 @@ namespace detail {
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value =
|
||||
sizeof(f(t())) == sizeof(::boost::type_traits::yes_type));
|
||||
typedef mpl::bool_c<value> type;
|
||||
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_optional,(T)) // needed for MSVC & Borland
|
||||
};
|
||||
|
||||
///////////////////////////////////////
|
||||
#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <class T>
|
||||
struct is_optional {
|
||||
struct is_optional_impl {
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <BOOST_PYTHON_TEMPLATE_TYPES>
|
||||
struct is_optional<optional<BOOST_PYTHON_TEMPLATE_ARGS> > {
|
||||
struct is_optional_impl<optional<BOOST_PYTHON_TEMPLATE_ARGS> > {
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
#endif // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// append_to_init<ListT, T> [ and helpers ]
|
||||
//
|
||||
// A metaprogram appends T to the initializer type list
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct append_to_init_helper1 {
|
||||
|
||||
// Case 1: default case, just push T to the back of ListT
|
||||
|
||||
template <class ListT, class T>
|
||||
struct apply {
|
||||
|
||||
typedef typename boost::mpl::push_back<ListT, T>::sequence sequence;
|
||||
};
|
||||
};
|
||||
|
||||
struct append_to_init_helper2 {
|
||||
|
||||
template <class ListT, class T>
|
||||
struct apply {
|
||||
|
||||
// Case 2: optional case, T is an optional, append all
|
||||
// the contents of the optional T into back of ListT
|
||||
|
||||
typedef typename boost::mpl::for_each
|
||||
<
|
||||
typename T::sequence,
|
||||
ListT,
|
||||
boost::mpl::push_back<boost::mpl::_1, boost::mpl::_2>
|
||||
>::state sequence;
|
||||
};
|
||||
};
|
||||
|
||||
struct append_to_init_helper3 {
|
||||
|
||||
// Case 3: nil case, we found a nil, do nothing
|
||||
|
||||
template <class ListT, class T>
|
||||
struct apply {
|
||||
|
||||
typedef ListT sequence;
|
||||
};
|
||||
};
|
||||
|
||||
template <class ListT, class T>
|
||||
struct append_to_init {
|
||||
|
||||
typedef typename boost::mpl::select_type
|
||||
<
|
||||
is_optional<T>::value, // if
|
||||
append_to_init_helper2, // then
|
||||
typename boost::mpl::select_type // else
|
||||
<
|
||||
is_nil<T>::value, // if
|
||||
append_to_init_helper3, // then
|
||||
append_to_init_helper1 // else
|
||||
>::type
|
||||
>::type helper;
|
||||
|
||||
typedef typename helper::template apply<ListT, T>::sequence sequence;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// check_init_params [ and helpers ]
|
||||
//
|
||||
// Check the init template parameters. Detect illegal
|
||||
// arguments such as:
|
||||
//
|
||||
// init<int, optional<char, long>, int> // BAD trailing int
|
||||
// init<optional<char, long>, optional<char> > // BAD optional used twice
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <int N>
|
||||
struct check_init_params_helper {
|
||||
|
||||
template <class ListT>
|
||||
struct apply {
|
||||
|
||||
// case where size of sequence is not zero
|
||||
|
||||
typedef typename boost::mpl::pop_front<ListT>::sequence rest;
|
||||
|
||||
enum {
|
||||
|
||||
// if first is optional then there must be no more
|
||||
// elements to its right. if not then recurse and check
|
||||
// the rest of the type list
|
||||
|
||||
first_is_optional =
|
||||
is_optional<typename boost::mpl::at<0, ListT>::type>::value,
|
||||
size_of_rest = boost::mpl::size<rest>::value,
|
||||
rest_is_nil = (size_of_rest == 0),
|
||||
is_ok = first_is_optional ? rest_is_nil :
|
||||
check_init_params_helper<size_of_rest>
|
||||
::template apply<rest>::is_ok
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct check_init_params_helper<0> {
|
||||
|
||||
// case where size of sequence is zero
|
||||
|
||||
template <class ListT>
|
||||
struct apply {
|
||||
|
||||
enum { is_ok = true };
|
||||
};
|
||||
};
|
||||
|
||||
struct init_base {};
|
||||
|
||||
template <BOOST_PYTHON_TEMPLATE_TYPES>
|
||||
struct check_init_params : init_base {
|
||||
|
||||
typedef boost::mpl::type_list<BOOST_PYTHON_TEMPLATE_ARGS> params;
|
||||
|
||||
BOOST_STATIC_ASSERT
|
||||
(
|
||||
check_init_params_helper<boost::mpl::size<params>::value>
|
||||
::template apply<params>::is_ok
|
||||
);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// count_optional_types [ and helpers ]
|
||||
//
|
||||
// count_optional_types<T0..TN>::value computes the number of
|
||||
// optional types (see init and optional below). For example:
|
||||
//
|
||||
// init<int, string, optional<char, long, double> >::value == 3
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <class T>
|
||||
struct count_optionals1 {
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct count_optionals2 {
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
int, value = boost::mpl::size<typename T::sequence>::value + 1);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct count_optionals
|
||||
: boost::mpl::select_type
|
||||
<
|
||||
is_optional<T>::value, // if
|
||||
count_optionals2<T>, // then
|
||||
count_optionals1<T> // else
|
||||
>::type
|
||||
struct is_optional : is_optional_impl<T>
|
||||
{
|
||||
typedef mpl::bool_c<is_optional_impl<T>::value> type;
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_optional,(T)) // needed for MSVC & Borland
|
||||
};
|
||||
|
||||
template <BOOST_PYTHON_TEMPLATE_TYPES>
|
||||
struct count_optional_types {
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, value =
|
||||
count_optionals<T0>::value +
|
||||
count_optionals<T1>::value +
|
||||
count_optionals<T2>::value
|
||||
);
|
||||
};
|
||||
#endif // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
} // namespace detail
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// init
|
||||
//
|
||||
// init<T0...TN>::sequence returns a typelist. One of T0..TN
|
||||
// mat be an optional<...> see below. There should be only one
|
||||
// optional in the input types and an optional should be the
|
||||
// last in the list.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define BOOST_PYTHON_APPEND_TO_INIT(z, INDEX, D) \
|
||||
typedef typename detail::append_to_init \
|
||||
< \
|
||||
BOOST_PP_CAT(l, INDEX), \
|
||||
BOOST_PP_CAT(T, BOOST_PP_INC(INDEX)) \
|
||||
>::sequence BOOST_PP_CAT(l, BOOST_PP_INC(INDEX)); \
|
||||
|
||||
|
||||
template <BOOST_PYTHON_TEMPLATE_TYPES>
|
||||
struct init : detail::check_init_params<BOOST_PYTHON_TEMPLATE_ARGS>
|
||||
struct init //: detail::check_init_params<BOOST_PYTHON_TEMPLATE_ARGS>
|
||||
{
|
||||
typedef boost::mpl::type_list<T0> l0;
|
||||
BOOST_PP_REPEAT_1ST(
|
||||
BOOST_PP_DEC(BOOST_PYTHON_MAX_ARITY), BOOST_PYTHON_APPEND_TO_INIT, 0)
|
||||
typedef detail::type_list<BOOST_PYTHON_TEMPLATE_ARGS> signature_;
|
||||
typedef typename mpl::end<signature_>::type finish;
|
||||
|
||||
typedef BOOST_PP_CAT(l, BOOST_PP_DEC(BOOST_PYTHON_MAX_ARITY)) sequence;
|
||||
// Find the optional<> element, if any
|
||||
typedef typename mpl::find_if<
|
||||
signature_, detail::is_optional<mpl::_>
|
||||
>::type opt;
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, n_arguments = boost::mpl::size<sequence>::value);
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, n_defaults =
|
||||
(detail::count_optional_types<BOOST_PYTHON_TEMPLATE_ARGS>::value)
|
||||
);
|
||||
// Check to make sure the optional<> element, if any, is the last one
|
||||
typedef typename mpl::apply_if<
|
||||
is_same<opt,finish>
|
||||
, mpl::identity<opt>
|
||||
, mpl::next<opt>
|
||||
>::type expected_finish;
|
||||
BOOST_STATIC_ASSERT((is_same<expected_finish, finish>::value));
|
||||
|
||||
typedef typename mpl::apply_if<
|
||||
is_same<opt,finish>
|
||||
, mpl::list0<>
|
||||
, opt
|
||||
>::type optional_args;
|
||||
|
||||
// Count the number of default args
|
||||
BOOST_STATIC_CONSTANT(int, n_defaults = mpl::size<optional_args>::value);
|
||||
|
||||
typedef typename mpl::iterator_range<
|
||||
typename mpl::begin<signature_>::type
|
||||
, opt
|
||||
>::type required_args;
|
||||
|
||||
// Build a reverse image of all the args, including optionals
|
||||
typedef typename mpl::fold<
|
||||
required_args
|
||||
, mpl::list0<>
|
||||
, mpl::push_front<mpl::_1, mpl::_2>
|
||||
>::type reversed_required;
|
||||
|
||||
typedef typename mpl::fold<
|
||||
optional_args
|
||||
, reversed_required
|
||||
, mpl::push_front<mpl::_1, mpl::_2>
|
||||
>::type reversed_args;
|
||||
|
||||
// Count the maximum number of arguments
|
||||
BOOST_STATIC_CONSTANT(int, n_arguments = mpl::size<reversed_args>::value);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// optional
|
||||
//
|
||||
// optional<T0...TN>::sequence returns a typelist.
|
||||
// optional<T0...TN>::type returns a typelist.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <BOOST_PYTHON_TEMPLATE_TYPES>
|
||||
struct optional {
|
||||
|
||||
typedef boost::mpl::type_list<BOOST_PYTHON_TEMPLATE_ARGS> sequence;
|
||||
struct optional
|
||||
: detail::type_list<BOOST_PYTHON_TEMPLATE_ARGS>
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
namespace detail
|
||||
{
|
||||
template <class ClassT, class CallPoliciesT, class ReversedArgs>
|
||||
void def_init_reversed(ClassT& cl, ReversedArgs const&, CallPoliciesT const& policies, char const* doc)
|
||||
{
|
||||
typedef typename mpl::fold<
|
||||
ReversedArgs
|
||||
, mpl::list0<>
|
||||
, mpl::push_front<mpl::_1,mpl::_2>
|
||||
>::type args;
|
||||
|
||||
cl.def_init(args(), policies, doc);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// define_class_init_helper<N>::apply
|
||||
//
|
||||
// General case
|
||||
//
|
||||
// Accepts a class_ and an arguments list. Defines a constructor
|
||||
// for the class given the arguments and recursively calls
|
||||
// define_class_init_helper<N-1>::apply with one less arguments (the
|
||||
// rightmost argument is shaved off)
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <int N>
|
||||
struct define_class_init_helper {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// define_class_init_helper<N>::apply
|
||||
//
|
||||
// General case
|
||||
//
|
||||
// Accepts a class_ and an arguments list. Defines a constructor
|
||||
// for the class given the arguments and recursively calls
|
||||
// define_class_init_helper<N-1>::apply with one less arguments (the
|
||||
// rightmost argument is shaved off)
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <int N>
|
||||
struct define_class_init_helper {
|
||||
template <class ClassT, class CallPoliciesT, class ReversedArgs>
|
||||
static void apply(ClassT& cl, CallPoliciesT const& policies, ReversedArgs const& args, char const* doc)
|
||||
{
|
||||
def_init_reversed(cl, args, policies, doc);
|
||||
|
||||
template <class ClassT, class CallPoliciesT, class ArgsT>
|
||||
static void apply(ClassT& cl, CallPoliciesT const& policies, ArgsT const& args, char const* doc)
|
||||
{
|
||||
cl.def_init(args, policies, doc);
|
||||
typename boost::mpl::pop_back<ArgsT>::sequence next;
|
||||
define_class_init_helper<N-1>::apply(cl, policies, next, doc);
|
||||
}
|
||||
};
|
||||
typename mpl::pop_front<ReversedArgs>::type next;
|
||||
define_class_init_helper<N-1>::apply(cl, policies, next, doc);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// define_class_init_helper<0>::apply
|
||||
//
|
||||
// Terminal case
|
||||
//
|
||||
// Accepts a class_ and an arguments list. Defines a constructor
|
||||
// for the class given the arguments.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <>
|
||||
struct define_class_init_helper<0> {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// define_class_init_helper<0>::apply
|
||||
//
|
||||
// Terminal case
|
||||
//
|
||||
// Accepts a class_ and an arguments list. Defines a constructor
|
||||
// for the class given the arguments.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <>
|
||||
struct define_class_init_helper<0> {
|
||||
|
||||
template <class ClassT, class CallPoliciesT, class ArgsT>
|
||||
static void apply(ClassT& cl, CallPoliciesT const& policies, ArgsT const& args, char const* doc)
|
||||
{
|
||||
cl.def_init(args, policies, doc);
|
||||
}
|
||||
};
|
||||
template <class ClassT, class CallPoliciesT, class ReversedArgs>
|
||||
static void apply(ClassT& cl, CallPoliciesT const& policies, ReversedArgs const& args, char const* doc)
|
||||
{
|
||||
def_init_reversed(cl, args, policies, doc);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -407,8 +273,8 @@ template <class ClassT, class CallPoliciesT, class InitT>
|
||||
void
|
||||
define_init(ClassT& cl, InitT const& i, CallPoliciesT const& policies, char const* doc)
|
||||
{
|
||||
typedef typename InitT::sequence args_t;
|
||||
detail::define_class_init_helper<InitT::n_defaults>::apply(cl, policies, args_t(), doc);
|
||||
typedef typename InitT::reversed_args reversed_args;
|
||||
detail::define_class_init_helper<InitT::n_defaults>::apply(cl, policies, reversed_args(), doc);
|
||||
}
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef MANAGE_NEW_OBJECT_DWA200222_HPP
|
||||
# define MANAGE_NEW_OBJECT_DWA200222_HPP
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_indirect.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
|
||||
@@ -27,7 +27,7 @@ struct manage_new_object
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
boost::is_pointer<T>::value
|
||||
, to_python_indirect<T, detail::make_owning_holder>
|
||||
, detail::manage_new_object_requires_a_pointer_return_type<T>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# include <boost/python/object/find_instance.hpp>
|
||||
# include <boost/python/object/inheritance.hpp>
|
||||
# include <boost/python/detail/force_instantiate.hpp>
|
||||
# include <boost/type_traits/add_pointer.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
@@ -45,29 +46,22 @@ struct do_nothing
|
||||
template <class Derived>
|
||||
struct register_base_of
|
||||
{
|
||||
// Ignored is needed because mpl::for_each is still actually
|
||||
// accumulate. We're not using any state so it just sits there.
|
||||
template <class Ignored, class Base>
|
||||
struct apply
|
||||
// Here's the runtime part:
|
||||
template <class Base>
|
||||
void operator()(Base*) const
|
||||
{
|
||||
typedef void type; // 'type' needs to be defined for the same reasons
|
||||
// Register the Base class
|
||||
register_dynamic_id<Base>();
|
||||
// Register the up-cast
|
||||
register_conversion<Derived,Base>(false);
|
||||
|
||||
// Here's the runtime part:
|
||||
static void execute()
|
||||
{
|
||||
// Register the Base class
|
||||
register_dynamic_id<Base>();
|
||||
// Register the up-cast
|
||||
register_conversion<Derived,Base>(false);
|
||||
|
||||
// Register the down-cast, if appropriate.
|
||||
mpl::select_type<
|
||||
is_polymorphic<Base>::value
|
||||
, register_downcast<Base,Derived>
|
||||
, do_nothing
|
||||
>::type::execute();
|
||||
}
|
||||
};
|
||||
// Register the down-cast, if appropriate.
|
||||
mpl::if_c<
|
||||
is_polymorphic<Base>::value
|
||||
, register_downcast<Base,Derived>
|
||||
, do_nothing
|
||||
>::type::execute();
|
||||
}
|
||||
};
|
||||
|
||||
// Brings into existence all converters associated with a class Bases
|
||||
@@ -82,7 +76,7 @@ inline void register_class_from_python(Derived* = 0, Bases* = 0)
|
||||
register_dynamic_id<Derived>();
|
||||
|
||||
// register each base in the sequence
|
||||
mpl::for_each<Bases, void, register_base_of<Derived> >::execute();
|
||||
mpl::for_each(register_base_of<Derived>(), (Bases*)0, (add_pointer<mpl::_>*)0);
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::object
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
#ifndef FORWARD_DWA20011215_HPP
|
||||
# define FORWARD_DWA20011215_HPP
|
||||
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/ref.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
@@ -30,7 +31,7 @@ struct reference_to_value
|
||||
// is T.
|
||||
template <class T>
|
||||
struct forward
|
||||
: mpl::select_type<
|
||||
: mpl::if_c<
|
||||
is_scalar<T>::value
|
||||
, T
|
||||
, reference_to_value<T> >
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/shared_ptr.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
@@ -80,7 +80,7 @@ struct non_polymorphic_id_generator
|
||||
template <class T>
|
||||
struct dynamic_id_generator
|
||||
{
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_polymorphic<T>::value
|
||||
, polymorphic_id_generator<T>
|
||||
, non_polymorphic_id_generator<T> >::type type;
|
||||
@@ -133,7 +133,7 @@ struct cast_generator
|
||||
is_base_and_derived<Target,Source>::value
|
||||
));
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
is_upcast
|
||||
# if defined(__MWERKS__) && __MWERKS__ <= 0x2406
|
||||
// grab a few more implicit_cast cases for CodeWarrior
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
# include <boost/python/detail/wrap_python.hpp>
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
|
||||
# include <boost/mpl/at.hpp>
|
||||
# include <boost/mpl/next.hpp>
|
||||
# include <boost/mpl/begin_end.hpp>
|
||||
# include <boost/mpl/apply.hpp>
|
||||
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
@@ -29,8 +31,10 @@ namespace boost { namespace python { namespace objects {
|
||||
template <int nargs> struct make_holder;
|
||||
|
||||
# define BOOST_PYTHON_FORWARD_ARG(z, index, _) \
|
||||
typedef typename mpl::at<index,ArgList>::type t##index; \
|
||||
typedef typename forward<t##index>::type f##index;
|
||||
typedef typename iter##index::type t##index; \
|
||||
typedef typename forward<t##index>::type f##index; \
|
||||
typedef typename mpl::next<iter##index>::type \
|
||||
BOOST_PP_CAT(iter,BOOST_PP_INC(index));
|
||||
|
||||
# define BOOST_PYTHON_DO_FORWARD_ARG(z, index, _) , f##index(a##index)
|
||||
|
||||
@@ -56,6 +60,7 @@ struct make_holder<N>
|
||||
template <class Holder, class ArgList>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::begin<ArgList>::type iter0;
|
||||
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FORWARD_ARG, nil)
|
||||
static void execute(
|
||||
PyObject* p
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/preprocessor/debug/line.hpp>
|
||||
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/apply.hpp>
|
||||
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
# include <boost/python/object/make_instance.hpp>
|
||||
# include <boost/python/object/instance.hpp>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
# include <boost/type_traits/alignment_traits.hpp>
|
||||
# include <boost/mpl/bool_t.hpp>
|
||||
# include <boost/mpl/bool_c.hpp>
|
||||
# include <cstddef>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
@@ -30,7 +30,7 @@ namespace detail
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, selector = (!is_same<T,Held>::value) | has_back_reference<T>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
selector
|
||||
, value_holder_back_reference<T,Held>
|
||||
, value_holder<T>
|
||||
@@ -38,18 +38,18 @@ namespace detail
|
||||
|
||||
static inline void register_()
|
||||
{
|
||||
select_value_holder::register_(mpl::bool_t<selector>());
|
||||
select_value_holder::register_(mpl::bool_c<selector>());
|
||||
}
|
||||
|
||||
static type* get() { return 0; }
|
||||
|
||||
private:
|
||||
static inline void register_(mpl::bool_t<true>)
|
||||
static inline void register_(mpl::bool_c<true>)
|
||||
{
|
||||
python::detail::force_instantiate(instance_finder<Held>::registration);
|
||||
}
|
||||
|
||||
static inline void register_(mpl::bool_t<false>)
|
||||
static inline void register_(mpl::bool_c<false>)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -60,7 +60,7 @@ namespace detail
|
||||
typedef typename python::pointee<Ptr>::type pointee;
|
||||
BOOST_STATIC_CONSTANT(bool, selector = (!is_same<T,pointee>::value) | has_back_reference<T>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
selector
|
||||
, pointer_holder_back_reference<Ptr,T>
|
||||
, pointer_holder<Ptr,T>
|
||||
@@ -68,13 +68,13 @@ namespace detail
|
||||
|
||||
static inline void register_()
|
||||
{
|
||||
select_pointer_holder::register_(mpl::bool_t<selector>());
|
||||
select_pointer_holder::register_(mpl::bool_c<selector>());
|
||||
}
|
||||
|
||||
static type* get() { return 0; }
|
||||
|
||||
private:
|
||||
static inline void register_(mpl::bool_t<true>)
|
||||
static inline void register_(mpl::bool_c<true>)
|
||||
{
|
||||
// not implemented at least until we solve the back
|
||||
// reference issue mentioned in pointer_holder.hpp.
|
||||
@@ -94,7 +94,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
static inline void register_(mpl::bool_t<false>)
|
||||
static inline void register_(mpl::bool_c<false>)
|
||||
{
|
||||
python::detail::force_instantiate(
|
||||
objects::class_wrapper<
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# include <boost/python/detail/operator_id.hpp>
|
||||
# include <boost/python/detail/not_specified.hpp>
|
||||
# include <boost/python/back_reference.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/self.hpp>
|
||||
# include <boost/python/other.hpp>
|
||||
# include <boost/lexical_cast.hpp>
|
||||
@@ -120,15 +120,15 @@ namespace detail
|
||||
// self_t
|
||||
template <operator_id id, class L = not_specified, class R = not_specified>
|
||||
struct operator_
|
||||
: mpl::select_type<
|
||||
(is_same<L,self_t>::value)
|
||||
, typename mpl::select_type<
|
||||
(is_same<R,self_t>::value)
|
||||
: mpl::if_<
|
||||
is_same<L,self_t>
|
||||
, typename mpl::if_<
|
||||
is_same<R,self_t>
|
||||
, binary_op<id>
|
||||
, binary_op_l<id,typename unwrap_other<R>::type>
|
||||
>::type
|
||||
, typename mpl::select_type<
|
||||
(is_same<L,not_specified>::value)
|
||||
, typename mpl::if_<
|
||||
is_same<L,not_specified>
|
||||
, unary_op<id>
|
||||
, binary_op_r<id,typename unwrap_other<L>::type>
|
||||
>::type
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
# define POINTEE_DWA2002323_HPP
|
||||
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef REFERENCE_EXISTING_OBJECT_DWA200222_HPP
|
||||
# define REFERENCE_EXISTING_OBJECT_DWA200222_HPP
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_indirect.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
|
||||
@@ -32,7 +32,7 @@ struct reference_existing_object
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, ok = is_pointer<T>::value || is_reference<T>::value);
|
||||
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
ok
|
||||
, to_python_indirect<T, detail::make_reference_holder>
|
||||
, detail::reference_existing_object_requires_a_pointer_or_reference_return_type<T>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# include <boost/python/default_call_policies.hpp>
|
||||
# include <boost/python/reference_existing_object.hpp>
|
||||
# include <boost/python/with_custodian_and_ward.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -30,7 +30,7 @@ struct return_internal_reference
|
||||
private:
|
||||
BOOST_STATIC_CONSTANT(bool, legal = owner_arg > 0);
|
||||
public:
|
||||
typedef typename mpl::select_type<
|
||||
typedef typename mpl::if_c<
|
||||
legal
|
||||
, reference_existing_object
|
||||
, detail::return_internal_reference_owner_arg_must_be_greater_than_zero<owner_arg>
|
||||
|
||||
@@ -19,8 +19,19 @@
|
||||
# include <boost/preprocessor/empty.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/mpl/type_list.hpp>
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
|
||||
# include <boost/preprocessor/debug/line.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
|
||||
# define BOOST_PYTHON_FUNCTION_SIGNATURE_LIST(n) \
|
||||
BOOST_PP_CAT(mpl::list, BOOST_PP_INC(n))
|
||||
|
||||
# define BOOST_PYTHON_MEMBER_FUNCTION_SIGNATURE_LIST(n) \
|
||||
BOOST_PP_CAT(mpl::list, BOOST_PP_INC(BOOST_PP_INC(n)))
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace python { namespace detail {
|
||||
@@ -30,28 +41,28 @@ namespace boost { namespace python { namespace detail {
|
||||
// The following macros generate expansions for:
|
||||
//
|
||||
// template <class RT, class T0... class TN>
|
||||
// inline boost::mpl::type_list<RT, T0...TN>
|
||||
// inline mpl::list<RT, T0...TN>
|
||||
// get_signature(RT(*)(T0...TN))
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, T0...TN>();
|
||||
// return mpl::list<RT, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// template <class RT, class ClassT, class T0... class TN>
|
||||
// inline boost::mpl::type_list<RT, ClassT, T0...TN>
|
||||
// inline mpl::list<RT, ClassT, T0...TN>
|
||||
// get_signature(RT(ClassT::*)(T0...TN)))
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, ClassT, T0...TN>();
|
||||
// return mpl::list<RT, ClassT, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// template <class RT, class ClassT, class T0... class TN>
|
||||
// inline boost::mpl::type_list<RT, ClassT, T0...TN>
|
||||
// inline mpl::list<RT, ClassT, T0...TN>
|
||||
// get_signature(RT(ClassT::*)(T0...TN) const))
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, ClassT const, T0...TN>();
|
||||
// return mpl::list<RT, ClassT const, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// These functions extract the return type, class (for member functions)
|
||||
// and arguments of the input signature and stuffs them in an mpl::type_list.
|
||||
// and arguments of the input signature and stuffs them in an mpl::list.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -65,6 +76,10 @@ namespace boost { namespace python { namespace detail {
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
|
||||
# undef BOOST_PYTHON_FUNCTION_SIGNATURE_LIST
|
||||
# undef BOOST_PYTHON_MEMBER_FUNCTION_SIGNATURE_LIST
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
# endif // SIGNATURE_JDG20020813_HPP
|
||||
|
||||
@@ -73,47 +88,38 @@ namespace boost { namespace python { namespace detail {
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
template <
|
||||
class RT BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PYTHON_UNARY_ENUM(N, class T)>
|
||||
inline boost::mpl::type_list<
|
||||
RT BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM_PARAMS(N, T)>
|
||||
class RT BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)>
|
||||
inline BOOST_PYTHON_FUNCTION_SIGNATURE_LIST(N)<
|
||||
RT BOOST_PP_ENUM_TRAILING_PARAMS(N, T)>
|
||||
get_signature(RT(*)(BOOST_PP_ENUM_PARAMS(N, T)))
|
||||
{
|
||||
return boost::mpl::type_list<
|
||||
RT BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM_PARAMS(N, T)>();
|
||||
return BOOST_PYTHON_FUNCTION_SIGNATURE_LIST(N)<
|
||||
RT BOOST_PP_ENUM_TRAILING_PARAMS(N, T)
|
||||
>();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if N <= (BOOST_PYTHON_MAX_ARITY - 2)
|
||||
|
||||
template <
|
||||
class RT, class ClassT BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PYTHON_UNARY_ENUM(N, class T)>
|
||||
inline boost::mpl::type_list<
|
||||
RT, ClassT BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM_PARAMS(N, T)>
|
||||
class RT, class ClassT BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)>
|
||||
inline BOOST_PYTHON_MEMBER_FUNCTION_SIGNATURE_LIST(N)<
|
||||
RT, ClassT BOOST_PP_ENUM_TRAILING_PARAMS(N, T)>
|
||||
get_signature(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)))
|
||||
{
|
||||
return boost::mpl::type_list<
|
||||
RT, ClassT BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM_PARAMS(N, T)>();
|
||||
return BOOST_PYTHON_MEMBER_FUNCTION_SIGNATURE_LIST(N)<
|
||||
RT, ClassT BOOST_PP_ENUM_TRAILING_PARAMS(N, T)>();
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
template <
|
||||
class RT, class ClassT BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PYTHON_UNARY_ENUM(N, class T)>
|
||||
inline boost::mpl::type_list<
|
||||
RT, ClassT const BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM_PARAMS(N, T)>
|
||||
class RT, class ClassT BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)>
|
||||
inline BOOST_PYTHON_MEMBER_FUNCTION_SIGNATURE_LIST(N)<
|
||||
RT, ClassT const BOOST_PP_ENUM_TRAILING_PARAMS(N, T)>
|
||||
get_signature(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)) const)
|
||||
{
|
||||
return boost::mpl::type_list<
|
||||
RT, ClassT const
|
||||
BOOST_PP_COMMA_IF(N)
|
||||
BOOST_PP_ENUM_PARAMS(N, T)>();
|
||||
return BOOST_PYTHON_MEMBER_FUNCTION_SIGNATURE_LIST(N)<
|
||||
RT, ClassT const BOOST_PP_ENUM_TRAILING_PARAMS(N, T)>();
|
||||
}
|
||||
|
||||
#endif // N < (BOOST_PYTHON_MAX_ARITY - 2)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/converter/builtin_converters.hpp>
|
||||
# include <boost/python/converter/object_manager.hpp>
|
||||
# include <boost/mpl/select_type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/ice.hpp>
|
||||
# include <boost/python/refcount.hpp>
|
||||
# include <boost/python/tag.hpp>
|
||||
@@ -46,7 +46,7 @@ namespace detail
|
||||
|
||||
template <class T>
|
||||
struct to_python_value
|
||||
: mpl::select_type<
|
||||
: mpl::if_c<
|
||||
boost::type_traits::ice_or<
|
||||
converter::is_object_manager<T>::value
|
||||
, converter::is_reference_to_object_manager<T>::value
|
||||
|
||||
Reference in New Issue
Block a user