Skip to content

Commit 0c22c27

Browse files
committed
Workaround CW bug
[SVN r18472]
1 parent 7a4a79c commit 0c22c27

File tree

1 file changed

+81
-12
lines changed

1 file changed

+81
-12
lines changed

include/boost/python/class.hpp

Lines changed: 81 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
# include <boost/utility.hpp>
4747
# include <boost/detail/workaround.hpp>
4848

49+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
50+
# include <boost/mpl/and.hpp>
51+
# include <boost/type_traits/is_member_pointer.hpp>
52+
# endif
53+
4954
namespace boost { namespace python {
5055

5156
enum no_init_t { no_init };
@@ -97,6 +102,16 @@ namespace detail
97102
SelectHolder::register_();
98103
}
99104

105+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
106+
template <class T>
107+
struct is_data_member_pointer
108+
: mpl::and_<
109+
is_member_pointer<T>
110+
, mpl::not_<is_member_function_pointer<T> >
111+
>
112+
{};
113+
# endif
114+
100115
namespace error
101116
{
102117
//
@@ -293,25 +308,53 @@ class class_ : public objects::class_base
293308
template <class D>
294309
self& def_readonly(char const* name, D const& d)
295310
{
296-
return this->def_readonly_impl(name, d, 0);
311+
return this->def_readonly_impl(
312+
name, d
313+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
314+
, detail::is_data_member_pointer<D>()
315+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
316+
, 0
317+
# endif
318+
);
297319
}
298320

299321
template <class D>
300322
self& def_readwrite(char const* name, D const& d)
301323
{
302-
return this->def_readwrite_impl(name, d, 0);
324+
return this->def_readwrite_impl(
325+
name, d
326+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
327+
, detail::is_data_member_pointer<D>()
328+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
329+
, 0
330+
# endif
331+
);
303332
}
304-
333+
305334
template <class D>
306335
self& def_readonly(char const* name, D& d)
307336
{
308-
return this->def_readonly_impl(name, d, 0);
337+
return this->def_readonly_impl(
338+
name, d
339+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
340+
, detail::is_data_member_pointer<D>()
341+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
342+
, 0
343+
# endif
344+
);
309345
}
310346

311347
template <class D>
312348
self& def_readwrite(char const* name, D& d)
313349
{
314-
return this->def_readwrite_impl(name, d, 0);
350+
return this->def_readwrite_impl(
351+
name, d
352+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
353+
, detail::is_data_member_pointer<D>()
354+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
355+
, 0
356+
# endif
357+
);
315358
}
316359

317360
// Property creation
@@ -400,27 +443,55 @@ class class_ : public objects::class_base
400443
private: // helper functions
401444

402445
template <class D, class B>
403-
self& def_readonly_impl(char const* name, D B::*pm_, int)
446+
self& def_readonly_impl(
447+
char const* name, D B::*pm_
448+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
449+
, mpl::true_
450+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
451+
, int
452+
# endif
453+
)
404454
{
405455
D T::*pm = pm_;
406456
return this->add_property(name, make_getter(pm));
407457
}
408458

409459
template <class D, class B>
410-
self& def_readwrite_impl(char const* name, D B::*pm_, int)
460+
self& def_readwrite_impl(
461+
char const* name, D B::*pm_
462+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
463+
, mpl::true_
464+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
465+
, int
466+
# endif
467+
)
411468
{
412469
D T::*pm = pm_;
413470
return this->add_property(name, make_getter(pm), make_setter(pm));
414471
}
415472

416473
template <class D>
417-
self& def_readonly_impl(char const* name, D& d, ...)
474+
self& def_readonly_impl(
475+
char const* name, D& d
476+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
477+
, mpl::false_
478+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
479+
, ...
480+
# endif
481+
)
418482
{
419483
return this->add_static_property(name, make_getter(d));
420484
}
421485

422486
template <class D>
423-
self& def_readwrite_impl(char const* name, D& d, ...)
487+
self& def_readwrite_impl(
488+
char const* name, D& d
489+
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004)
490+
, mpl::false_
491+
# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING
492+
, ...
493+
# endif
494+
)
424495
{
425496
return this->add_static_property(name, make_getter(d), make_setter(d));
426497
}
@@ -542,10 +613,8 @@ inline void class_<T,X1,X2,X3>::register_() const
542613
mpl::bool_<is_copyable>()
543614
# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
544615
, holder_selector::execute((held_type*)0)
545-
# elif BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
546-
, holder_selector::type()
547616
# else
548-
, typename holder_selector::type()
617+
, BOOST_DEDUCED_TYPENAME holder_selector::type()
549618
# endif
550619
);
551620
}

0 commit comments

Comments
 (0)