diff --git a/include/boost/python/args.hpp b/include/boost/python/args.hpp index dc00c96c..7ad0265e 100644 --- a/include/boost/python/args.hpp +++ b/include/boost/python/args.hpp @@ -11,7 +11,8 @@ # include -# include +# include +# include # include # include @@ -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 > - , 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 > {}; @@ -86,14 +87,14 @@ struct size > # 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 -struct at > +struct at_c > { typedef BOOST_PP_CAT(A, N) type; }; diff --git a/include/boost/python/bases.hpp b/include/boost/python/bases.hpp index 468c6744..8ce3fd2a 100644 --- a/include/boost/python/bases.hpp +++ b/include/boost/python/bases.hpp @@ -6,14 +6,15 @@ #ifndef BASES_DWA2002321_HPP # define BASES_DWA2002321_HPP # include -# include -# include -# include +# include +# include +# include +# include 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 > struct select_bases - : mpl::select_type< + : mpl::if_c< specifies_bases::value , T , Prev diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp index 918cf4d2..5bb30268 100644 --- a/include/boost/python/class.hpp +++ b/include/boost/python/class.hpp @@ -20,7 +20,7 @@ # include # include # include -# include +# include # include # include # include @@ -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 + void operator()(T*) const + { + *(*p)++ = type_id(); + }; + + type_info** p; + }; template 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 - static inline void register_copy_constructor(mpl::bool_t const&, SelectHolder const& , T* = 0) + static inline void register_copy_constructor(mpl::bool_c const&, SelectHolder const& , T* = 0) { typedef typename SelectHolder::type holder; force_instantiate(objects::class_wrapper >()); @@ -65,7 +80,7 @@ namespace detail // Tag dispatched to have no effect. template - static inline void register_copy_constructor(mpl::bool_t const&, SelectHolder const&, T* = 0) + static inline void register_copy_constructor(mpl::bool_c 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::execute(&p); + mpl::for_each(detail::write_type_id(&p), (bases*)0, (add_pointer*)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_::register_() const objects::register_class_from_python(); detail::register_copy_constructor( - mpl::bool_t() + mpl::bool_c() , holder_selector::execute((held_type*)0) ); } @@ -445,28 +460,6 @@ inline class_::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 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(); - } - }; - }; - - template struct has_noncopyable : type_traits::ice_or< @@ -478,7 +471,7 @@ namespace detail template struct select_held_type - : mpl::select_type< + : mpl::if_c< type_traits::ice_or< specifies_bases::value , is_same::value diff --git a/include/boost/python/converter/arg_from_python.hpp b/include/boost/python/converter/arg_from_python.hpp index 585a30eb..1e3dfa26 100755 --- a/include/boost/python/converter/arg_from_python.hpp +++ b/include/boost/python/converter/arg_from_python.hpp @@ -12,7 +12,7 @@ # include # include # include -# include +# include # include # include # include @@ -165,22 +165,22 @@ struct select_arg_from_python bool, back_ref = boost::python::is_back_reference::value); - typedef typename mpl::select_type< + typedef typename mpl::if_c< obj_mgr , object_manager_value_arg_from_python - , typename mpl::select_type< + , typename mpl::if_c< obj_mgr_ref , object_manager_ref_arg_from_python - , typename mpl::select_type< + , typename mpl::if_c< ptr , pointer_arg_from_python - , typename mpl::select_type< + , typename mpl::if_c< ptr_cref , pointer_cref_arg_from_python - , typename mpl::select_type< + , typename mpl::if_c< ref , reference_arg_from_python - , typename mpl::select_type< + , typename mpl::if_c< back_ref , back_reference_arg_from_python , arg_rvalue_from_python diff --git a/include/boost/python/converter/arg_to_python.hpp b/include/boost/python/converter/arg_to_python.hpp index 7abb274c..deab7964 100755 --- a/include/boost/python/converter/arg_to_python.hpp +++ b/include/boost/python/converter/arg_to_python.hpp @@ -109,22 +109,22 @@ namespace detail typedef typename unwrap_reference::type unwrapped_referent; typedef typename unwrap_pointer::type unwrapped_ptr; - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_string , arg_to_python - , typename mpl::select_type< + , typename mpl::if_c< function , function_arg_to_python - , typename mpl::select_type< + , typename mpl::if_c< manager , object_manager_arg_to_python - , typename mpl::select_type< + , typename mpl::if_c< ptr , pointer_deep_arg_to_python - , typename mpl::select_type< + , typename mpl::if_c< ptr_wrapper , pointer_shallow_arg_to_python - , typename mpl::select_type< + , typename mpl::if_c< ref_wrapper , reference_arg_to_python , value_arg_to_python diff --git a/include/boost/python/converter/object_manager.hpp b/include/boost/python/converter/object_manager.hpp index 431ef708..974c149b 100755 --- a/include/boost/python/converter/object_manager.hpp +++ b/include/boost/python/converter/object_manager.hpp @@ -10,7 +10,7 @@ # include # include # include -# include +# include # include // Facilities for dealing with types which always manage Python @@ -102,7 +102,7 @@ struct default_object_manager_traits template struct object_manager_traits - : mpl::select_type< + : mpl::if_c< is_handle::value , handle_object_manager_traits , default_object_manager_traits @@ -164,7 +164,7 @@ namespace detail template struct is_object_manager_help { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_object_manager::value , yes_reference_to_object_manager , no_reference_to_object_manager @@ -217,7 +217,7 @@ namespace detail template struct is_reference_to_object_manager { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_reference::value , detail::is_reference_to_object_manager_ref , detail::is_reference_to_object_manager_nonref diff --git a/include/boost/python/converter/return_from_python.hpp b/include/boost/python/converter/return_from_python.hpp index f02f01d9..58d182f0 100755 --- a/include/boost/python/converter/return_from_python.hpp +++ b/include/boost/python/converter/return_from_python.hpp @@ -63,13 +63,13 @@ namespace detail BOOST_STATIC_CONSTANT( bool, ref = is_reference::value); - typedef typename mpl::select_type< + typedef typename mpl::if_c< obj_mgr , return_object_manager_from_python - , typename mpl::select_type< + , typename mpl::if_c< ptr , return_pointer_from_python - , typename mpl::select_type< + , typename mpl::if_c< ref , return_reference_from_python , return_rvalue_from_python diff --git a/include/boost/python/converter/rvalue_from_python_data.hpp b/include/boost/python/converter/rvalue_from_python_data.hpp index 72ea7bd7..16c9d44b 100644 --- a/include/boost/python/converter/rvalue_from_python_data.hpp +++ b/include/boost/python/converter/rvalue_from_python_data.hpp @@ -10,6 +10,8 @@ # include # include # include +# include +# include # include // Data management for potential rvalue conversions from Python to C++ diff --git a/include/boost/python/copy_const_reference.hpp b/include/boost/python/copy_const_reference.hpp index b2fdd61f..8eecd2ce 100644 --- a/include/boost/python/copy_const_reference.hpp +++ b/include/boost/python/copy_const_reference.hpp @@ -6,7 +6,7 @@ #ifndef COPY_CONST_REFERENCE_DWA2002131_HPP # define COPY_CONST_REFERENCE_DWA2002131_HPP # include -# include +# include # include namespace boost { namespace python { @@ -28,7 +28,7 @@ struct copy_const_reference template struct apply { - typedef typename mpl::select_type< + typedef typename mpl::if_c< detail::is_reference_to_const::value , to_python_value , detail::copy_const_reference_expects_a_const_reference_return_type diff --git a/include/boost/python/copy_non_const_reference.hpp b/include/boost/python/copy_non_const_reference.hpp index 6f53fbdc..53c576e0 100644 --- a/include/boost/python/copy_non_const_reference.hpp +++ b/include/boost/python/copy_non_const_reference.hpp @@ -6,7 +6,7 @@ #ifndef COPY_NON_CONST_REFERENCE_DWA2002131_HPP # define COPY_NON_CONST_REFERENCE_DWA2002131_HPP # include -# include +# include # include namespace boost { namespace python { @@ -28,7 +28,7 @@ struct copy_non_const_reference template struct apply { - typedef typename mpl::select_type< + typedef typename mpl::if_c< boost::python::detail::is_reference_to_non_const::value , to_python_value , detail::copy_non_const_reference_expects_a_non_const_reference_return_type diff --git a/include/boost/python/default_call_policies.hpp b/include/boost/python/default_call_policies.hpp index f0b69255..f964990f 100644 --- a/include/boost/python/default_call_policies.hpp +++ b/include/boost/python/default_call_policies.hpp @@ -6,7 +6,7 @@ #ifndef DEFAULT_CALL_POLICIES_DWA2002131_HPP # define DEFAULT_CALL_POLICIES_DWA2002131_HPP # include -# include +# include # include # include @@ -50,7 +50,7 @@ struct default_result_converter { BOOST_STATIC_CONSTANT(bool, is_illegal = is_reference::value || is_pointer::value); - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_illegal , detail::specify_a_result_policy_to_wrap_functions_returning , boost::python::to_python_value< diff --git a/include/boost/python/detail/borrowed_ptr.hpp b/include/boost/python/detail/borrowed_ptr.hpp index dc50c634..6b35c862 100755 --- a/include/boost/python/detail/borrowed_ptr.hpp +++ b/include/boost/python/detail/borrowed_ptr.hpp @@ -8,7 +8,7 @@ # include # include -# include +# include # include # include # include @@ -77,7 +77,7 @@ typedef char (&no_borrowed_ptr_t)[2]; no_borrowed_ptr_t is_borrowed_ptr_test(...); template -typename mpl::select_type< +typename mpl::if_c< is_pointer::value , T , int diff --git a/include/boost/python/detail/caller.hpp b/include/boost/python/detail/caller.hpp index 322e1342..2ade2a11 100644 --- a/include/boost/python/detail/caller.hpp +++ b/include/boost/python/detail/caller.hpp @@ -21,8 +21,6 @@ # include # include -# // temp: include - # include # include # include diff --git a/include/boost/python/detail/convertible.hpp b/include/boost/python/detail/convertible.hpp index 4ab58d94..74440090 100755 --- a/include/boost/python/detail/convertible.hpp +++ b/include/boost/python/detail/convertible.hpp @@ -7,7 +7,7 @@ # define CONVERTIBLE_DWA2002614_HPP # if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 241 -# include +# include # include # endif @@ -26,7 +26,7 @@ struct convertible static inline yes_convertible check(Target) { return 0; } # else template - static inline typename mpl::select_type< + static inline typename mpl::if_c< is_convertible::value , yes_convertible , no_convertible diff --git a/include/boost/python/detail/defaults_def.hpp b/include/boost/python/detail/defaults_def.hpp index 7efbcb70..4e442acb 100644 --- a/include/boost/python/detail/defaults_def.hpp +++ b/include/boost/python/detail/defaults_def.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include @@ -86,7 +86,7 @@ static void name_space_def( // template // inline void // define_stub_function( -// char const* name, StubsT s, NameSpaceT& name_space, boost::mpl::int_t) +// char const* name, StubsT s, NameSpaceT& name_space, mpl::int_c) // { // 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 -// void bar(int, int) mpl::type_list -// void C::foo(int) mpl::type_list +// int foo(int) mpl::list +// void bar(int, int) mpl::list +// void C::foo(int) mpl::list // /////////////////////////////////////////////////////////////////////////////// template @@ -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::value , v_type , nv_type diff --git a/include/boost/python/detail/defaults_gen.hpp b/include/boost/python/detail/defaults_gen.hpp index b1ed0125..f505bb54 100644 --- a/include/boost/python/detail/defaults_gen.hpp +++ b/include/boost/python/detail/defaults_gen.hpp @@ -224,11 +224,11 @@ struct func_stubs_base {}; // template // 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); } diff --git a/include/boost/python/detail/indirect_traits.hpp b/include/boost/python/detail/indirect_traits.hpp index faabecc2..c6f8bcc7 100644 --- a/include/boost/python/detail/indirect_traits.hpp +++ b/include/boost/python/detail/indirect_traits.hpp @@ -5,11 +5,17 @@ // to its suitability for any purpose. #ifndef INDIRECT_TRAITS_DWA2002131_HPP # define INDIRECT_TRAITS_DWA2002131_HPP -# include -# include -# include -# include -# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include namespace boost { namespace python { namespace detail { @@ -184,7 +190,7 @@ typedef char (&outer_no_type)[1]; template struct is_const_help { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_const::value , inner_yes_type , inner_no_type @@ -194,7 +200,7 @@ struct is_const_help template struct is_volatile_help { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_volatile::value , inner_yes_type , inner_no_type @@ -204,7 +210,7 @@ struct is_volatile_help template struct is_pointer_help { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_pointer::value , inner_yes_type , inner_no_type @@ -214,7 +220,7 @@ struct is_pointer_help template struct is_class_help { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_class::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 @@ -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 diff --git a/include/boost/python/detail/member_function_cast.hpp b/include/boost/python/detail/member_function_cast.hpp index 491e6711..f143abd0 100644 --- a/include/boost/python/detail/member_function_cast.hpp +++ b/include/boost/python/detail/member_function_cast.hpp @@ -11,7 +11,7 @@ # include -# include +# include # include # include @@ -71,7 +71,7 @@ struct member_function_cast # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING : member_function_cast_impl # else - : mpl::select_type< + : mpl::if_c< is_member_function_pointer::value , member_function_cast_impl , non_member_function_cast_impl diff --git a/include/boost/python/detail/msvc_typeinfo.hpp b/include/boost/python/detail/msvc_typeinfo.hpp index 21e47389..b50922b7 100644 --- a/include/boost/python/detail/msvc_typeinfo.hpp +++ b/include/boost/python/detail/msvc_typeinfo.hpp @@ -8,8 +8,10 @@ #include #include -#include -#include +#include +#include +#include +#include // // Fix for MSVC's broken typeid() implementation which doesn't strip // decoration. This fix doesn't handle cv-qualified array types. It diff --git a/include/boost/python/detail/preprocessor.hpp b/include/boost/python/detail/preprocessor.hpp index 89d1d26d..4d4baa57 100644 --- a/include/boost/python/detail/preprocessor.hpp +++ b/include/boost/python/detail/preprocessor.hpp @@ -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) \ diff --git a/include/boost/python/detail/referent_storage.hpp b/include/boost/python/detail/referent_storage.hpp index aebacf64..b93d888f 100644 --- a/include/boost/python/detail/referent_storage.hpp +++ b/include/boost/python/detail/referent_storage.hpp @@ -5,7 +5,7 @@ // to its suitability for any purpose. #ifndef REFERENT_STORAGE_DWA200278_HPP # define REFERENT_STORAGE_DWA200278_HPP -# include +# include # include 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 diff --git a/include/boost/python/detail/result.hpp b/include/boost/python/detail/result.hpp index 84f6a554..6ec95fb7 100755 --- a/include/boost/python/detail/result.hpp +++ b/include/boost/python/detail/result.hpp @@ -14,7 +14,7 @@ # include # include -# include +# include # include # include @@ -60,7 +60,7 @@ struct void_type template struct result_result { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_class::value , get_result_type , void_type diff --git a/include/boost/python/detail/type_list.hpp b/include/boost/python/detail/type_list.hpp index 66ac3857..b61e616a 100644 --- a/include/boost/python/detail/type_list.hpp +++ b/include/boost/python/detail/type_list.hpp @@ -5,11 +5,11 @@ // to its suitability for any purpose. #ifndef TYPE_LIST_DWA200222_HPP # define TYPE_LIST_DWA200222_HPP -# include +# include 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 diff --git a/include/boost/python/detail/type_list_utils.hpp b/include/boost/python/detail/type_list_utils.hpp index d03203b9..eeeed0fa 100644 --- a/include/boost/python/detail/type_list_utils.hpp +++ b/include/boost/python/detail/type_list_utils.hpp @@ -24,7 +24,7 @@ # include # include -# include +# include 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 - struct type_at : public boost::mpl::at {}; + struct type_at : mpl::at_c {}; template - struct type_list_size : public boost::mpl::size {}; + struct type_list_size : boost::mpl::size {}; // template // struct pop_front : public boost::mpl::pop_front {}; @@ -77,36 +77,36 @@ namespace boost { namespace python { namespace detail { # if (N < BOOST_PYTHON_MAX_ARITY-1) template - struct type_at > + struct type_at > { typedef BOOST_PP_CAT(A, N) type; }; // template -// struct push_back, T> +// struct push_back, T> // { -// typedef boost::mpl::type_list sequence; +// typedef mpl::list sequence; // }; # if (N > 0) // template -// struct pop_front > +// struct pop_front > // { -// typedef boost::mpl::type_list sequence; +// typedef mpl::list sequence; // }; // // template -// struct pop_back > +// struct pop_back > // { -// typedef boost::mpl::type_list sequence; +// typedef mpl::list sequence; // }; # endif # endif template - struct type_list_size > + struct type_list_size > { BOOST_STATIC_CONSTANT(long, value = N); }; diff --git a/include/boost/python/extract.hpp b/include/boost/python/extract.hpp index fdcaac28..598fe249 100644 --- a/include/boost/python/extract.hpp +++ b/include/boost/python/extract.hpp @@ -87,13 +87,13 @@ namespace converter BOOST_STATIC_CONSTANT( bool, ref = is_reference::value); - typedef typename mpl::select_type< + typedef typename mpl::if_c< obj_mgr , extract_object_manager - , typename mpl::select_type< + , typename mpl::if_c< ptr , extract_pointer - , typename mpl::select_type< + , typename mpl::if_c< ref , extract_reference , extract_rvalue diff --git a/include/boost/python/init.hpp b/include/boost/python/init.hpp index 03625a1b..1bb502a1 100644 --- a/include/boost/python/init.hpp +++ b/include/boost/python/init.hpp @@ -10,13 +10,15 @@ #ifndef INIT_JDG20020820_HPP #define INIT_JDG20020820_HPP -#include -#include -#include +#include +#include +#include #include #include +#include #include #include +#include #include #include @@ -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 - struct is_nil : public boost::is_same {}; + struct is_nil : public boost::is_same {}; /////////////////////////////////////////////////////////////////////////// // @@ -128,7 +130,7 @@ namespace detail { template struct apply { - typedef typename boost::mpl::push_back::sequence sequence; + typedef typename mpl::push_back::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 - >::state sequence; + mpl::push_front + >::type type; }; }; @@ -156,26 +157,24 @@ namespace detail { template struct apply { - typedef ListT sequence; + typedef ListT type; }; }; template struct append_to_init { - typedef typename boost::mpl::select_type - < - is_optional::value, // if - append_to_init_helper2, // then - typename boost::mpl::select_type // else - < - is_nil::value, // if - append_to_init_helper3, // then - append_to_init_helper1 // else + typedef typename mpl::if_c< + is_optional::value + , append_to_init_helper2 + , typename mpl::if_c< + is_nil::value + , append_to_init_helper3 + , append_to_init_helper1 >::type >::type helper; - typedef typename helper::template apply::sequence sequence; + typedef typename helper::template apply::type type; }; /////////////////////////////////////////////////////////////////////////// @@ -197,7 +196,7 @@ namespace detail { // case where size of sequence is not zero - typedef typename boost::mpl::pop_front::sequence rest; + typedef typename mpl::pop_front::type rest; enum { @@ -206,8 +205,8 @@ namespace detail { // the rest of the type list first_is_optional = - is_optional::type>::value, - size_of_rest = boost::mpl::size::value, + is_optional::type>::value, + size_of_rest = mpl::size::value, rest_is_nil = (size_of_rest == 0), is_ok = first_is_optional ? rest_is_nil : check_init_params_helper @@ -233,11 +232,11 @@ namespace detail { template struct check_init_params : init_base { - typedef boost::mpl::type_list params; + typedef mpl::list params; BOOST_STATIC_ASSERT ( - check_init_params_helper::value> + check_init_params_helper::value> ::template apply::is_ok ); }; @@ -262,16 +261,15 @@ namespace detail { struct count_optionals2 { BOOST_STATIC_CONSTANT( - int, value = boost::mpl::size::value + 1); + int, value = mpl::size::value + 1); }; template struct count_optionals - : boost::mpl::select_type - < - is_optional::value, // if - count_optionals2, // then - count_optionals1 // else + : mpl::if_c< + is_optional::value // if + , count_optionals2 // then + , count_optionals1 // else >::type { }; @@ -292,7 +290,7 @@ namespace detail { // // init // -// init::sequence returns a typelist. One of T0..TN +// init::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 struct init : detail::check_init_params { - typedef boost::mpl::type_list l0; + typedef mpl::list 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::value); + BOOST_STATIC_CONSTANT(int, n_arguments = mpl::size::value); BOOST_STATIC_CONSTANT(int, n_defaults = (detail::count_optional_types::value) @@ -326,13 +324,13 @@ struct init : detail::check_init_params // // optional // -// optional::sequence returns a typelist. +// optional::type returns a typelist. // /////////////////////////////////////////////////////////////////////////////// template struct optional { - typedef boost::mpl::type_list sequence; + typedef mpl::list 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::sequence next; + typename mpl::pop_back::type next; define_class_init_helper::apply(cl, policies, next, doc); } }; @@ -407,7 +405,7 @@ template 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::apply(cl, policies, args_t(), doc); } diff --git a/include/boost/python/manage_new_object.hpp b/include/boost/python/manage_new_object.hpp index e19035b7..0acbbec8 100644 --- a/include/boost/python/manage_new_object.hpp +++ b/include/boost/python/manage_new_object.hpp @@ -6,7 +6,7 @@ #ifndef MANAGE_NEW_OBJECT_DWA200222_HPP # define MANAGE_NEW_OBJECT_DWA200222_HPP # include -# include +# include # include # include @@ -27,7 +27,7 @@ struct manage_new_object template struct apply { - typedef typename mpl::select_type< + typedef typename mpl::if_c< boost::is_pointer::value , to_python_indirect , detail::manage_new_object_requires_a_pointer_return_type diff --git a/include/boost/python/object/class_converters.hpp b/include/boost/python/object/class_converters.hpp index 14e79a9d..79119ef7 100644 --- a/include/boost/python/object/class_converters.hpp +++ b/include/boost/python/object/class_converters.hpp @@ -13,6 +13,7 @@ # include # include # include +# include namespace boost { namespace python { namespace objects { @@ -45,29 +46,22 @@ struct do_nothing template 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 - struct apply + // Here's the runtime part: + template + void operator()(Base*) const { - typedef void type; // 'type' needs to be defined for the same reasons + // Register the Base class + register_dynamic_id(); + // Register the up-cast + register_conversion(false); - // Here's the runtime part: - static void execute() - { - // Register the Base class - register_dynamic_id(); - // Register the up-cast - register_conversion(false); - - // Register the down-cast, if appropriate. - mpl::select_type< - is_polymorphic::value - , register_downcast - , do_nothing - >::type::execute(); - } - }; + // Register the down-cast, if appropriate. + mpl::if_c< + is_polymorphic::value + , register_downcast + , 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(); // register each base in the sequence - mpl::for_each >::execute(); + mpl::for_each(register_base_of(), (Bases*)0, (add_pointer*)0); } }}} // namespace boost::python::object diff --git a/include/boost/python/object/forward.hpp b/include/boost/python/object/forward.hpp index cc23e94c..93c1ed21 100644 --- a/include/boost/python/object/forward.hpp +++ b/include/boost/python/object/forward.hpp @@ -6,10 +6,11 @@ #ifndef FORWARD_DWA20011215_HPP # define FORWARD_DWA20011215_HPP -# include +# include # include # include # include +# include # include namespace boost { namespace python { namespace objects { @@ -30,7 +31,7 @@ struct reference_to_value // is T. template struct forward - : mpl::select_type< + : mpl::if_c< is_scalar::value , T , reference_to_value > diff --git a/include/boost/python/object/inheritance.hpp b/include/boost/python/object/inheritance.hpp index 5129e35e..88b556ff 100644 --- a/include/boost/python/object/inheritance.hpp +++ b/include/boost/python/object/inheritance.hpp @@ -8,7 +8,7 @@ # include # include -# include +# include # include namespace boost { namespace python { namespace objects { @@ -80,7 +80,7 @@ struct non_polymorphic_id_generator template struct dynamic_id_generator { - typedef typename mpl::select_type< + typedef typename mpl::if_c< is_polymorphic::value , polymorphic_id_generator , non_polymorphic_id_generator >::type type; @@ -133,7 +133,7 @@ struct cast_generator is_base_and_derived::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 diff --git a/include/boost/python/object/make_holder.hpp b/include/boost/python/object/make_holder.hpp index 429704a3..6baf44a4 100644 --- a/include/boost/python/object/make_holder.hpp +++ b/include/boost/python/object/make_holder.hpp @@ -29,7 +29,7 @@ namespace boost { namespace python { namespace objects { template struct make_holder; # define BOOST_PYTHON_FORWARD_ARG(z, index, _) \ - typedef typename mpl::at::type t##index; \ + typedef typename mpl::at_c::type t##index; \ typedef typename forward::type f##index; # define BOOST_PYTHON_DO_FORWARD_ARG(z, index, _) , f##index(a##index) diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp index 9ead5d94..c714a291 100644 --- a/include/boost/python/object/pointer_holder.hpp +++ b/include/boost/python/object/pointer_holder.hpp @@ -22,7 +22,7 @@ # include # include -# include +# include # include # include diff --git a/include/boost/python/object/select_holder.hpp b/include/boost/python/object/select_holder.hpp index 6902f68d..3535fd29 100644 --- a/include/boost/python/object/select_holder.hpp +++ b/include/boost/python/object/select_holder.hpp @@ -15,10 +15,10 @@ # include # include # include -# include +# include # include # include -# include +# include # include namespace boost { namespace python { namespace objects { @@ -30,7 +30,7 @@ namespace detail { BOOST_STATIC_CONSTANT(bool, selector = (!is_same::value) | has_back_reference::value); - typedef typename mpl::select_type< + typedef typename mpl::if_c< selector , value_holder_back_reference , value_holder @@ -38,18 +38,18 @@ namespace detail static inline void register_() { - select_value_holder::register_(mpl::bool_t()); + select_value_holder::register_(mpl::bool_c()); } static type* get() { return 0; } private: - static inline void register_(mpl::bool_t) + static inline void register_(mpl::bool_c) { python::detail::force_instantiate(instance_finder::registration); } - static inline void register_(mpl::bool_t) + static inline void register_(mpl::bool_c) { } }; @@ -60,7 +60,7 @@ namespace detail typedef typename python::pointee::type pointee; BOOST_STATIC_CONSTANT(bool, selector = (!is_same::value) | has_back_reference::value); - typedef typename mpl::select_type< + typedef typename mpl::if_c< selector , pointer_holder_back_reference , pointer_holder @@ -68,13 +68,13 @@ namespace detail static inline void register_() { - select_pointer_holder::register_(mpl::bool_t()); + select_pointer_holder::register_(mpl::bool_c()); } static type* get() { return 0; } private: - static inline void register_(mpl::bool_t) + static inline void register_(mpl::bool_c) { // 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) + static inline void register_(mpl::bool_c) { python::detail::force_instantiate( objects::class_wrapper< diff --git a/include/boost/python/operators2.hpp b/include/boost/python/operators2.hpp index 8c56abf7..3f06eb46 100755 --- a/include/boost/python/operators2.hpp +++ b/include/boost/python/operators2.hpp @@ -11,7 +11,7 @@ # include # include # include -# include +# include # include # include # include @@ -120,15 +120,15 @@ namespace detail // self_t template struct operator_ - : mpl::select_type< - (is_same::value) - , typename mpl::select_type< - (is_same::value) + : mpl::if_< + is_same + , typename mpl::if_< + is_same , binary_op , binary_op_l::type> >::type - , typename mpl::select_type< - (is_same::value) + , typename mpl::if_< + is_same , unary_op , binary_op_r::type> >::type diff --git a/include/boost/python/pointee.hpp b/include/boost/python/pointee.hpp index 52d65d67..d62bab54 100644 --- a/include/boost/python/pointee.hpp +++ b/include/boost/python/pointee.hpp @@ -7,6 +7,7 @@ # define POINTEE_DWA2002323_HPP # include +# include namespace boost { namespace python { diff --git a/include/boost/python/reference_existing_object.hpp b/include/boost/python/reference_existing_object.hpp index 1f8a43d8..e16dcf18 100644 --- a/include/boost/python/reference_existing_object.hpp +++ b/include/boost/python/reference_existing_object.hpp @@ -6,7 +6,7 @@ #ifndef REFERENCE_EXISTING_OBJECT_DWA200222_HPP # define REFERENCE_EXISTING_OBJECT_DWA200222_HPP # include -# include +# include # include # include @@ -32,7 +32,7 @@ struct reference_existing_object BOOST_STATIC_CONSTANT( bool, ok = is_pointer::value || is_reference::value); - typedef typename mpl::select_type< + typedef typename mpl::if_c< ok , to_python_indirect , detail::reference_existing_object_requires_a_pointer_or_reference_return_type diff --git a/include/boost/python/return_internal_reference.hpp b/include/boost/python/return_internal_reference.hpp index 3a968f45..7e350d77 100644 --- a/include/boost/python/return_internal_reference.hpp +++ b/include/boost/python/return_internal_reference.hpp @@ -9,7 +9,7 @@ # include # include # include -# include +# include 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 diff --git a/include/boost/python/signature.hpp b/include/boost/python/signature.hpp index 3bef081e..5cd8eac8 100644 --- a/include/boost/python/signature.hpp +++ b/include/boost/python/signature.hpp @@ -19,7 +19,7 @@ # include # include # include -# include +# include # include /////////////////////////////////////////////////////////////////////////////// @@ -30,28 +30,28 @@ namespace boost { namespace python { namespace detail { // The following macros generate expansions for: // // template -// inline boost::mpl::type_list +// inline mpl::list // get_signature(RT(*)(T0...TN)) // { -// return boost::mpl::type_list(); +// return mpl::list(); // } // // template -// inline boost::mpl::type_list +// inline mpl::list // get_signature(RT(ClassT::*)(T0...TN))) // { -// return boost::mpl::type_list(); +// return mpl::list(); // } // // template -// inline boost::mpl::type_list +// inline mpl::list // get_signature(RT(ClassT::*)(T0...TN) const)) // { -// return boost::mpl::type_list(); +// return mpl::list(); // } // // 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)>(); diff --git a/include/boost/python/to_python_value.hpp b/include/boost/python/to_python_value.hpp index b85eaf68..3b9cd76c 100644 --- a/include/boost/python/to_python_value.hpp +++ b/include/boost/python/to_python_value.hpp @@ -11,7 +11,7 @@ # include # include # include -# include +# include # include # include # include @@ -46,7 +46,7 @@ namespace detail template struct to_python_value - : mpl::select_type< + : mpl::if_c< boost::type_traits::ice_or< converter::is_object_manager::value , converter::is_reference_to_object_manager::value