Skip to content

Commit b084f8a

Browse files
committed
Restore main trunk to health
[SVN r15378]
1 parent 802a2f3 commit b084f8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+561
-658
lines changed

include/boost/python/args.hpp

Lines changed: 3 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if !defined(BOOST_PP_IS_ITERATING)
2-
31
// Copyright David Abrahams 2002. Permission to copy, use,
42
// modify, sell and distribute this software is granted provided this
53
// copyright notice appears in all copies. This software is provided
@@ -8,14 +6,8 @@
86
#ifndef ARGS_DWA2002323_HPP
97
# define ARGS_DWA2002323_HPP
108
# include <boost/config.hpp>
11-
129
# include <boost/python/detail/preprocessor.hpp>
13-
14-
# include <boost/mpl/type_list.hpp>
15-
16-
# include <boost/preprocessor/cat.hpp>
17-
# include <boost/preprocessor/iterate.hpp>
18-
# include <boost/preprocessor/debug/line.hpp>
10+
# include <boost/python/detail/type_list.hpp>
1911

2012
namespace boost { namespace python {
2113

@@ -28,76 +20,15 @@ namespace detail
2820
}
2921
}}
3022

31-
# if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 245
32-
3323
namespace boost { namespace python {
3424

3525
// A type list for specifying arguments
36-
template < BOOST_PYTHON_ENUM_WITH_DEFAULT(BOOST_PYTHON_MAX_ARITY, typename A, boost::mpl::null_argument) >
26+
template < BOOST_PYTHON_ENUM_WITH_DEFAULT(BOOST_PYTHON_MAX_ARITY, typename A, mpl::void_) >
3727
struct args : detail::args_base<args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
38-
, boost::mpl::type_list< BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A) >::type
28+
, detail::type_list< BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A) >::type
3929
{};
4030

4131
}} // namespace boost::python
4232

43-
# else // slow template instantiators need this other version with
44-
// explicit specializations of mpl::size<> and
45-
// mpl::at<>. Eventually, however, inheritance from mpl::list
46-
// *should* be eliminated and the two versions unified, just in
47-
// order to get true arity independence
48-
49-
namespace boost { namespace python {
50-
51-
template < BOOST_PYTHON_ENUM_WITH_DEFAULT(BOOST_PYTHON_MAX_ARITY, typename A, boost::mpl::null_argument) >
52-
struct args : detail::args_base<args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
53-
{};
54-
55-
}} // namespace boost::python
56-
57-
namespace boost { namespace mpl {
58-
59-
template <class T> struct size;
60-
template <long N, class Seq> struct at;
61-
62-
# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/args.hpp>, 1))
63-
# include BOOST_PP_ITERATE()
64-
65-
# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY - 1, <boost/python/args.hpp>, 2))
66-
# include BOOST_PP_ITERATE()
67-
68-
69-
}} // namespace boost::mpl
70-
71-
# endif // __EDG_VERSION__
7233

7334
# endif // ARGS_DWA2002323_HPP
74-
75-
/* ---------- size ---------- */
76-
#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1
77-
# line BOOST_PP_LINE(__LINE__, args.hpp(size))
78-
79-
# define N BOOST_PP_ITERATION()
80-
81-
template <BOOST_PYTHON_UNARY_ENUM(N, class A)>
82-
struct size<boost::python::args<BOOST_PYTHON_UNARY_ENUM(N, A)> >
83-
{
84-
BOOST_STATIC_CONSTANT(long, value = N);
85-
};
86-
87-
# undef N
88-
89-
/* ---------- at ---------- */
90-
#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2
91-
# line BOOST_PP_LINE(__LINE__, args.hpp(at))
92-
93-
# define N BOOST_PP_ITERATION()
94-
95-
template <BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, class A)>
96-
struct at<N, boost::python::args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
97-
{
98-
typedef BOOST_PP_CAT(A, N) type;
99-
};
100-
101-
# undef N
102-
103-
#endif

include/boost/python/bases.hpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
#ifndef BASES_DWA2002321_HPP
77
# define BASES_DWA2002321_HPP
88
# include <boost/type_traits/object_traits.hpp>
9-
# include <boost/mpl/type_list.hpp>
10-
# include <boost/mpl/select_type.hpp>
11-
# include <boost/mpl/identity/identity.hpp>
9+
# include <boost/python/detail/type_list.hpp>
10+
# include <boost/mpl/if.hpp>
11+
# include <boost/preprocessor/enum_params_with_a_default.hpp>
12+
# include <boost/preprocessor/enum_params.hpp>
1213

1314
namespace boost { namespace python {
15+
1416
// A type list for specifying bases
15-
template < BOOST_MPL_LIST_DEFAULT_PARAMETERS(typename B, ::boost::mpl::null_argument) >
16-
struct bases : ::boost::mpl::type_list< BOOST_MPL_LIST_PARAMETERS(B) >::type
17+
template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_MAX_BASES, typename B, mpl::void_) >
18+
struct bases : detail::type_list< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, B) >::type
1719
{};
1820

1921
namespace detail
@@ -23,14 +25,14 @@ namespace boost { namespace python {
2325
{
2426
BOOST_STATIC_CONSTANT(bool, value = false);
2527
};
26-
template < BOOST_MPL_LIST_PARAMETERS(class B) >
27-
struct specifies_bases< bases< BOOST_MPL_LIST_PARAMETERS(B) > >
28+
template < BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, class B) >
29+
struct specifies_bases< bases< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, B) > >
2830
{
2931
BOOST_STATIC_CONSTANT(bool, value = true);
3032
};
3133
# else
32-
template < BOOST_MPL_LIST_PARAMETERS(class B) >
33-
static char is_bases_helper(bases< BOOST_MPL_LIST_PARAMETERS(B) > const&);
34+
template < BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, class B) >
35+
static char is_bases_helper(bases< BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, B) > const&);
3436

3537
static char (& is_bases_helper(...) )[256];
3638

@@ -45,7 +47,7 @@ namespace boost { namespace python {
4547
# endif
4648
template <class T, class Prev = bases<> >
4749
struct select_bases
48-
: mpl::select_type<
50+
: mpl::if_c<
4951
specifies_bases<T>::value
5052
, T
5153
, Prev

include/boost/python/class.hpp

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
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

4141
namespace 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

453468
namespace 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

include/boost/python/converter/arg_from_python.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# include <boost/type_traits/transform_traits.hpp>
1313
# include <boost/type_traits/cv_traits.hpp>
1414
# include <boost/python/converter/rvalue_from_python_data.hpp>
15-
# include <boost/mpl/select_type.hpp>
15+
# include <boost/mpl/if.hpp>
1616
# include <boost/python/converter/registry.hpp>
1717
# include <boost/python/converter/registered.hpp>
1818
# include <boost/python/converter/registered_pointee.hpp>
@@ -165,22 +165,22 @@ struct select_arg_from_python
165165
bool, back_ref =
166166
boost::python::is_back_reference<T>::value);
167167

168-
typedef typename mpl::select_type<
168+
typedef typename mpl::if_c<
169169
obj_mgr
170170
, object_manager_value_arg_from_python<T>
171-
, typename mpl::select_type<
171+
, typename mpl::if_c<
172172
obj_mgr_ref
173173
, object_manager_ref_arg_from_python<T>
174-
, typename mpl::select_type<
174+
, typename mpl::if_c<
175175
ptr
176176
, pointer_arg_from_python<T>
177-
, typename mpl::select_type<
177+
, typename mpl::if_c<
178178
ptr_cref
179179
, pointer_cref_arg_from_python<T>
180-
, typename mpl::select_type<
180+
, typename mpl::if_c<
181181
ref
182182
, reference_arg_from_python<T>
183-
, typename mpl::select_type<
183+
, typename mpl::if_c<
184184
back_ref
185185
, back_reference_arg_from_python<T>
186186
, arg_rvalue_from_python<T>

include/boost/python/converter/arg_to_python.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,22 @@ namespace detail
109109
typedef typename unwrap_reference<T>::type unwrapped_referent;
110110
typedef typename unwrap_pointer<T>::type unwrapped_ptr;
111111

112-
typedef typename mpl::select_type<
112+
typedef typename mpl::if_c<
113113
is_string
114114
, arg_to_python<char const*>
115-
, typename mpl::select_type<
115+
, typename mpl::if_c<
116116
function
117117
, function_arg_to_python<T>
118-
, typename mpl::select_type<
118+
, typename mpl::if_c<
119119
manager
120120
, object_manager_arg_to_python<T>
121-
, typename mpl::select_type<
121+
, typename mpl::if_c<
122122
ptr
123123
, pointer_deep_arg_to_python<T>
124-
, typename mpl::select_type<
124+
, typename mpl::if_c<
125125
ptr_wrapper
126126
, pointer_shallow_arg_to_python<unwrapped_ptr>
127-
, typename mpl::select_type<
127+
, typename mpl::if_c<
128128
ref_wrapper
129129
, reference_arg_to_python<unwrapped_referent>
130130
, value_arg_to_python<T>

include/boost/python/converter/object_manager.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# include <boost/python/cast.hpp>
1111
# include <boost/python/converter/pyobject_traits.hpp>
1212
# include <boost/type_traits/object_traits.hpp>
13-
# include <boost/mpl/select_type.hpp>
13+
# include <boost/mpl/if.hpp>
1414
# include <boost/python/detail/indirect_traits.hpp>
1515

1616
// Facilities for dealing with types which always manage Python
@@ -102,7 +102,7 @@ struct default_object_manager_traits
102102

103103
template <class T>
104104
struct object_manager_traits
105-
: mpl::select_type<
105+
: mpl::if_c<
106106
is_handle<T>::value
107107
, handle_object_manager_traits<T>
108108
, default_object_manager_traits<T>
@@ -164,7 +164,7 @@ namespace detail
164164
template <class T>
165165
struct is_object_manager_help
166166
{
167-
typedef typename mpl::select_type<
167+
typedef typename mpl::if_c<
168168
is_object_manager<T>::value
169169
, yes_reference_to_object_manager
170170
, no_reference_to_object_manager
@@ -217,7 +217,7 @@ namespace detail
217217
template <class T>
218218
struct is_reference_to_object_manager
219219
{
220-
typedef typename mpl::select_type<
220+
typedef typename mpl::if_c<
221221
is_reference<T>::value
222222
, detail::is_reference_to_object_manager_ref<T>
223223
, detail::is_reference_to_object_manager_nonref<T>

include/boost/python/converter/return_from_python.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ namespace detail
6363
BOOST_STATIC_CONSTANT(
6464
bool, ref = is_reference<T>::value);
6565

66-
typedef typename mpl::select_type<
66+
typedef typename mpl::if_c<
6767
obj_mgr
6868
, return_object_manager_from_python<T>
69-
, typename mpl::select_type<
69+
, typename mpl::if_c<
7070
ptr
7171
, return_pointer_from_python<T>
72-
, typename mpl::select_type<
72+
, typename mpl::if_c<
7373
ref
7474
, return_reference_from_python<T>
7575
, return_rvalue_from_python<T>

include/boost/python/converter/rvalue_from_python_data.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
# include <boost/python/detail/referent_storage.hpp>
1111
# include <boost/python/detail/destroy.hpp>
1212
# include <boost/static_assert.hpp>
13+
# include <boost/type_traits/add_reference.hpp>
14+
# include <boost/type_traits/add_cv.hpp>
1315
# include <cstddef>
1416

1517
// Data management for potential rvalue conversions from Python to C++

0 commit comments

Comments
 (0)