2020# include < boost/type_traits/same_traits.hpp>
2121# include < boost/mpl/size.hpp>
2222# include < boost/mpl/for_each.hpp>
23- # include < boost/mpl/bool_t .hpp>
23+ # include < boost/mpl/bool_c .hpp>
2424# include < boost/python/object/select_holder.hpp>
2525# include < boost/python/object/class_wrapper.hpp>
2626# include < boost/python/object/make_instance.hpp>
@@ -40,7 +40,22 @@ namespace boost { namespace python {
4040
4141namespace detail
4242{
43- struct write_type_id ;
43+ // This function object is used with mpl::for_each to write the id
44+ // of the type a pointer to which is passed as its 2nd compile-time
45+ // argument. into the iterator pointed to by its runtime argument
46+ struct write_type_id
47+ {
48+ write_type_id (type_info**p) : p(p) {}
49+
50+ // Here's the runtime behavior
51+ template <class T >
52+ void operator ()(T*) const
53+ {
54+ *(*p)++ = type_id<T>();
55+ };
56+
57+ type_info** p;
58+ };
4459
4560 template <class T , class Prev = detail::not_specified>
4661 struct select_held_type ;
@@ -56,7 +71,7 @@ namespace detail
5671 // to the type of holder that must be created. The 3rd argument is a
5772 // reference to the Python type object to be created.
5873 template <class T , class SelectHolder >
59- static inline void register_copy_constructor (mpl::bool_t <true > const &, SelectHolder const & , T* = 0 )
74+ static inline void register_copy_constructor (mpl::bool_c <true > const &, SelectHolder const & , T* = 0 )
6075 {
6176 typedef typename SelectHolder::type holder;
6277 force_instantiate (objects::class_wrapper<T,holder, objects::make_instance<T,holder> >());
@@ -65,7 +80,7 @@ namespace detail
6580
6681 // Tag dispatched to have no effect.
6782 template <class T , class SelectHolder >
68- static inline void register_copy_constructor (mpl::bool_t <false > const &, SelectHolder const &, T* = 0 )
83+ static inline void register_copy_constructor (mpl::bool_c <false > const &, SelectHolder const &, T* = 0 )
6984 {
7085 SelectHolder::register_ ();
7186 }
@@ -126,7 +141,7 @@ class class_ : public objects::class_base
126141
127142 // Write the rest of the elements into succeeding positions.
128143 type_info* p = ids + 1 ;
129- mpl::for_each<bases, void , detail::write_type_id>:: execute (&p);
144+ mpl::for_each ( detail::write_type_id (&p), (bases*) 0 , (add_pointer<mpl::_>*) 0 );
130145 }
131146
132147 BOOST_STATIC_CONSTANT (
@@ -274,7 +289,7 @@ class class_ : public objects::class_base
274289 self& def_init ()
275290 {
276291 detail::assert_default_constructible<T>::check ();
277- this ->def_init (mpl::type_list <>::type ());
292+ this ->def_init (mpl::list0 <>::type ());
278293 return *this ;
279294 }
280295
@@ -401,7 +416,7 @@ inline void class_<T,X1,X2,X3>::register_() const
401416 objects::register_class_from_python<T,bases>();
402417
403418 detail::register_copy_constructor<T>(
404- mpl::bool_t <is_copyable>()
419+ mpl::bool_c <is_copyable>()
405420 , holder_selector::execute ((held_type*)0 )
406421 );
407422}
@@ -452,28 +467,6 @@ inline class_<T,X1,X2,X3>::class_(char const* name, char const* doc, no_init_t)
452467
453468namespace detail
454469{
455- // This is an mpl BinaryMetaFunction object with a runtime behavior,
456- // which is to write the id of the type which is passed as its 2nd
457- // compile-time argument into the iterator pointed to by its runtime
458- // argument
459- struct write_type_id
460- {
461- // The first argument is Ignored because mpl::for_each is still
462- // currently an accumulate (reduce) implementation.
463- template <class Ignored , class T > struct apply
464- {
465- // also an artifact of accumulate-based for_each
466- typedef void type;
467-
468- // Here's the runtime behavior
469- static void execute (type_info** p)
470- {
471- *(*p)++ = type_id<T>();
472- }
473- };
474- };
475-
476-
477470 template <class T1 , class T2 , class T3 >
478471 struct has_noncopyable
479472 : type_traits::ice_or<
@@ -485,7 +478,7 @@ namespace detail
485478
486479 template <class T , class Prev >
487480 struct select_held_type
488- : mpl::select_type <
481+ : mpl::if_c <
489482 type_traits::ice_or<
490483 specifies_bases<T>::value
491484 , is_same<T,noncopyable>::value
0 commit comments