2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

mpl_v2 branch checkin

[SVN r15258]
This commit is contained in:
Dave Abrahams
2002-09-11 05:35:41 +00:00
parent 17f0899211
commit e5d4e14a2d
39 changed files with 238 additions and 236 deletions

View File

@@ -11,7 +11,8 @@
# include <boost/python/detail/preprocessor.hpp>
# include <boost/mpl/type_list.hpp>
# include <boost/mpl/list.hpp>
# include <boost/mpl/at.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/iterate.hpp>
@@ -33,22 +34,22 @@ namespace detail
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
, mpl::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
// mpl::at_c<>. 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) >
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)> >
{};
@@ -86,14 +87,14 @@ struct size<boost::python::args<BOOST_PYTHON_UNARY_ENUM(N, A)> >
# undef N
/* ---------- at ---------- */
/* ---------- at_c ---------- */
#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)> >
struct at_c<N, boost::python::args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
{
typedef BOOST_PP_CAT(A, N) type;
};

View File

@@ -6,14 +6,15 @@
#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/mpl/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_MPL_LIMIT_LIST_SIZE, typename B, mpl::void_) >
struct bases : mpl::list< BOOST_PP_ENUM_PARAMS(BOOST_MPL_LIMIT_LIST_SIZE, B) >::type
{};
namespace detail
@@ -23,14 +24,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_MPL_LIMIT_LIST_SIZE, class B) >
struct specifies_bases< bases< BOOST_PP_ENUM_PARAMS(BOOST_MPL_LIMIT_LIST_SIZE, 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_MPL_LIMIT_LIST_SIZE, class B) >
static char is_bases_helper(bases< BOOST_PP_ENUM_PARAMS(BOOST_MPL_LIMIT_LIST_SIZE, B) > const&);
static char (& is_bases_helper(...) )[256];
@@ -45,7 +46,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

View File

@@ -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_();
}
@@ -118,7 +133,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(
@@ -265,7 +280,7 @@ class class_ : public objects::class_base
// Define the default constructor.
self& def_init()
{
this->def_init(mpl::type_list<>::type());
this->def_init(mpl::list<>::type());
return *this;
}
@@ -392,7 +407,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)
);
}
@@ -445,28 +460,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<
@@ -478,7 +471,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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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++

View File

@@ -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>

View File

@@ -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>

View File

@@ -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<

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -14,7 +14,7 @@
#include <boost/python/detail/defaults_gen.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/int_t.hpp>
#include <boost/mpl/int_c.hpp>
#include <boost/static_assert.hpp>
#include <boost/preprocessor/iterate.hpp>
#include <boost/python/detail/type_list_utils.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>
@@ -205,7 +205,7 @@ struct define_stub_function {};
typedef typename StubsT::v_type v_type;
typedef typename StubsT::nv_type nv_type;
typedef typename mpl::select_type<
typedef typename mpl::if_c<
boost::is_same<void, nth_type>::value
, v_type
, nv_type

View File

@@ -224,11 +224,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 mpl::at_c<0, SigT>::type RT;
// typedef typename mpl::at_c<1, SigT>::type T0;
// typedef typename mpl::at_c<2, SigT>::type T1;
// typedef typename mpl::at_c<3, SigT>::type T2;
// typedef typename mpl::at_c<4, SigT>::type T3;
//
// static RT func_0(T0 arg0)
// { return foo(arg0); }

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -27,9 +27,14 @@
# endif
# ifndef BOOST_PYTHON_MAX_ARITY
# define BOOST_PYTHON_MAX_ARITY 15
# define BOOST_PYTHON_MAX_ARITY 10 // 15
# endif
// Temporary!
# ifndef BOOST_MPL_LIMIT_LIST_SIZE
# define BOOST_MPL_LIMIT_LIST_SIZE BOOST_PYTHON_MAX_ARITY
# endif
# define BOOST_PYTHON_CV_QUALIFIER(i) \
BOOST_PYTHON_APPLY( \
BOOST_PP_TUPLE_ELEM(4, i, BOOST_PYTHON_CV_QUALIFIER_I) \

View File

@@ -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

View File

@@ -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

View File

@@ -5,11 +5,11 @@
// to its suitability for any purpose.
#ifndef TYPE_LIST_DWA200222_HPP
# define TYPE_LIST_DWA200222_HPP
# include <boost/mpl/type_list.hpp>
# include <boost/mpl/list.hpp>
namespace boost { namespace python { namespace detail {
struct empty_list : boost::mpl::type_list<>::type {};
struct empty_list : boost::mpl::list<>::type {};
}}} // namespace boost::python::detail

View File

@@ -24,7 +24,7 @@
# include <boost/preprocessor/dec.hpp>
# include <boost/preprocessor/debug/line.hpp>
# include <boost/mpl/type_list.hpp>
# include <boost/mpl/list.hpp>
namespace boost { namespace python { namespace detail {
@@ -32,10 +32,10 @@ namespace boost { namespace python { namespace detail {
&& (!defined(BOOST_INTEL_CXX_VERSION) || BOOST_INTEL_CXX_VERSION > 600)
template <int N, class L>
struct type_at : public boost::mpl::at<N, L> {};
struct type_at : mpl::at_c<N, L> {};
template <class L>
struct type_list_size : public boost::mpl::size<L> {};
struct type_list_size : boost::mpl::size<L> {};
// template <class L>
// struct pop_front : public boost::mpl::pop_front<L> {};
@@ -77,36 +77,36 @@ namespace boost { namespace python { namespace detail {
# 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)> >
struct type_at<N, mpl::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>
// struct push_back<mpl::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;
// typedef mpl::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)> >
// struct pop_front<mpl::list<BOOST_PP_ENUM_PARAMS(N, A)> >
// {
// typedef boost::mpl::type_list<BOOST_PP_ENUM_SHIFTED_PARAMS(N, A)> sequence;
// typedef mpl::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)> >
// struct pop_back<mpl::list<BOOST_PP_ENUM_PARAMS(N, A)> >
// {
// typedef boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), A)> sequence;
// typedef mpl::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)> >
struct type_list_size<mpl::list<BOOST_PP_ENUM_PARAMS(N, A)> >
{
BOOST_STATIC_CONSTANT(long, value = N);
};

View File

@@ -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>

View File

@@ -10,13 +10,15 @@
#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/mpl/list.hpp>
#include <boost/mpl/fold_backward.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/pop_front.hpp>
#include <boost/mpl/pop_back.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/static_assert.hpp>
#include <boost/preprocessor/enum_params_with_a_default.hpp>
@@ -32,7 +34,7 @@
( \
BOOST_PYTHON_MAX_ARITY, \
class T, \
boost::mpl::null_argument \
mpl::void_ \
) \
#define BOOST_PYTHON_TEMPLATE_TYPES \
@@ -69,7 +71,7 @@ namespace detail {
//
///////////////////////////////////////////////////////////////////////////
template <class T>
struct is_nil : public boost::is_same<T, boost::mpl::null_argument> {};
struct is_nil : public boost::is_same<T, mpl::void_> {};
///////////////////////////////////////////////////////////////////////////
//
@@ -128,7 +130,7 @@ namespace detail {
template <class ListT, class T>
struct apply {
typedef typename boost::mpl::push_back<ListT, T>::sequence sequence;
typedef typename mpl::push_back<ListT, T>::type type;
};
};
@@ -140,12 +142,11 @@ namespace detail {
// 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,
typedef typename mpl::fold_backward<
typename T::type,
ListT,
boost::mpl::push_back<boost::mpl::_1, boost::mpl::_2>
>::state sequence;
mpl::push_front<mpl::_1, mpl::_2>
>::type type;
};
};
@@ -156,26 +157,24 @@ namespace detail {
template <class ListT, class T>
struct apply {
typedef ListT sequence;
typedef ListT type;
};
};
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
typedef typename mpl::if_c<
is_optional<T>::value
, append_to_init_helper2
, typename mpl::if_c<
is_nil<T>::value
, append_to_init_helper3
, append_to_init_helper1
>::type
>::type helper;
typedef typename helper::template apply<ListT, T>::sequence sequence;
typedef typename helper::template apply<ListT, T>::type type;
};
///////////////////////////////////////////////////////////////////////////
@@ -197,7 +196,7 @@ namespace detail {
// case where size of sequence is not zero
typedef typename boost::mpl::pop_front<ListT>::sequence rest;
typedef typename mpl::pop_front<ListT>::type rest;
enum {
@@ -206,8 +205,8 @@ namespace detail {
// 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,
is_optional<typename mpl::at_c<0, ListT>::type>::value,
size_of_rest = 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>
@@ -233,11 +232,11 @@ namespace detail {
template <BOOST_PYTHON_TEMPLATE_TYPES>
struct check_init_params : init_base {
typedef boost::mpl::type_list<BOOST_PYTHON_TEMPLATE_ARGS> params;
typedef mpl::list<BOOST_PYTHON_TEMPLATE_ARGS> params;
BOOST_STATIC_ASSERT
(
check_init_params_helper<boost::mpl::size<params>::value>
check_init_params_helper<mpl::size<params>::value>
::template apply<params>::is_ok
);
};
@@ -262,16 +261,15 @@ namespace detail {
struct count_optionals2 {
BOOST_STATIC_CONSTANT(
int, value = boost::mpl::size<typename T::sequence>::value + 1);
int, value = mpl::size<typename T::type>::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
: mpl::if_c<
is_optional<T>::value // if
, count_optionals2<T> // then
, count_optionals1<T> // else
>::type
{
};
@@ -292,7 +290,7 @@ namespace detail {
//
// init
//
// init<T0...TN>::sequence returns a typelist. One of T0..TN
// init<T0...TN>::type 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.
@@ -303,19 +301,19 @@ namespace detail {
< \
BOOST_PP_CAT(l, INDEX), \
BOOST_PP_CAT(T, BOOST_PP_INC(INDEX)) \
>::sequence BOOST_PP_CAT(l, BOOST_PP_INC(INDEX)); \
>::type BOOST_PP_CAT(l, BOOST_PP_INC(INDEX)); \
template <BOOST_PYTHON_TEMPLATE_TYPES>
struct init : detail::check_init_params<BOOST_PYTHON_TEMPLATE_ARGS>
{
typedef boost::mpl::type_list<T0> l0;
typedef mpl::list<T0> l0;
BOOST_PP_REPEAT
(BOOST_PP_DEC(BOOST_PYTHON_MAX_ARITY), BOOST_PYTHON_APPEND_TO_INIT, 0)
typedef BOOST_PP_CAT(l, BOOST_PP_DEC(BOOST_PYTHON_MAX_ARITY)) sequence;
typedef BOOST_PP_CAT(l, BOOST_PP_DEC(BOOST_PYTHON_MAX_ARITY)) type;
BOOST_STATIC_CONSTANT(int, n_arguments = boost::mpl::size<sequence>::value);
BOOST_STATIC_CONSTANT(int, n_arguments = mpl::size<type>::value);
BOOST_STATIC_CONSTANT(int, n_defaults =
(detail::count_optional_types<BOOST_PYTHON_TEMPLATE_ARGS>::value)
@@ -326,13 +324,13 @@ struct init : detail::check_init_params<BOOST_PYTHON_TEMPLATE_ARGS>
//
// 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;
typedef mpl::list<BOOST_PYTHON_TEMPLATE_ARGS> type;
};
namespace detail {
@@ -356,7 +354,7 @@ namespace detail {
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;
typename mpl::pop_back<ArgsT>::type next;
define_class_init_helper<N-1>::apply(cl, policies, next, doc);
}
};
@@ -407,7 +405,7 @@ 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;
typedef typename InitT::type args_t;
detail::define_class_init_helper<InitT::n_defaults>::apply(cl, policies, args_t(), doc);
}

View File

@@ -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>

View File

@@ -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

View File

@@ -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> >

View File

@@ -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

View File

@@ -29,7 +29,7 @@ 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 mpl::at_c<index,ArgList>::type t##index; \
typedef typename forward<t##index>::type f##index;
# define BOOST_PYTHON_DO_FORWARD_ARG(z, index, _) , f##index(a##index)

View File

@@ -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>

View File

@@ -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<

View File

@@ -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

View File

@@ -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 {

View File

@@ -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>

View File

@@ -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>

View File

@@ -19,7 +19,7 @@
# include <boost/preprocessor/empty.hpp>
# include <boost/preprocessor/arithmetic/sub.hpp>
# include <boost/preprocessor/iterate.hpp>
# include <boost/mpl/type_list.hpp>
# include <boost/mpl/list.hpp>
# include <boost/preprocessor/debug/line.hpp>
///////////////////////////////////////////////////////////////////////////////
@@ -30,28 +30,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.
//
///////////////////////////////////////////////////////////////////////////////
@@ -75,12 +75,12 @@ namespace boost { namespace python { namespace detail {
template <
class RT BOOST_PP_COMMA_IF(N)
BOOST_PYTHON_UNARY_ENUM(N, class T)>
inline boost::mpl::type_list<
inline mpl::list<
RT BOOST_PP_COMMA_IF(N)
BOOST_PP_ENUM_PARAMS(N, T)>
get_signature(RT(*)(BOOST_PP_ENUM_PARAMS(N, T)))
{
return boost::mpl::type_list<
return mpl::list<
RT BOOST_PP_COMMA_IF(N)
BOOST_PP_ENUM_PARAMS(N, T)>();
}
@@ -91,12 +91,12 @@ get_signature(RT(*)(BOOST_PP_ENUM_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<
inline mpl::list<
RT, ClassT BOOST_PP_COMMA_IF(N)
BOOST_PP_ENUM_PARAMS(N, T)>
get_signature(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)))
{
return boost::mpl::type_list<
return mpl::list<
RT, ClassT BOOST_PP_COMMA_IF(N)
BOOST_PP_ENUM_PARAMS(N, T)>();
}
@@ -105,12 +105,12 @@ get_signature(RT(ClassT::*)(BOOST_PP_ENUM_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<
inline mpl::list<
RT, ClassT const BOOST_PP_COMMA_IF(N)
BOOST_PP_ENUM_PARAMS(N, T)>
get_signature(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(N, T)) const)
{
return boost::mpl::type_list<
return mpl::list<
RT, ClassT const
BOOST_PP_COMMA_IF(N)
BOOST_PP_ENUM_PARAMS(N, T)>();

View File

@@ -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