From 0c22c276bfd7797ef2214cab51ac9c4b273b752e Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Tue, 20 May 2003 19:01:44 +0000 Subject: [PATCH] Workaround CW bug [SVN r18472] --- include/boost/python/class.hpp | 93 +++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 12 deletions(-) diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp index 0ee6c63c..08ec7cb7 100644 --- a/include/boost/python/class.hpp +++ b/include/boost/python/class.hpp @@ -46,6 +46,11 @@ # include # include +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) +# include +# include +# endif + namespace boost { namespace python { enum no_init_t { no_init }; @@ -97,6 +102,16 @@ namespace detail SelectHolder::register_(); } +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + template + struct is_data_member_pointer + : mpl::and_< + is_member_pointer + , mpl::not_ > + > + {}; +# endif + namespace error { // @@ -293,25 +308,53 @@ class class_ : public objects::class_base template self& def_readonly(char const* name, D const& d) { - return this->def_readonly_impl(name, d, 0); + return this->def_readonly_impl( + name, d +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , detail::is_data_member_pointer() +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , 0 +# endif + ); } template self& def_readwrite(char const* name, D const& d) { - return this->def_readwrite_impl(name, d, 0); + return this->def_readwrite_impl( + name, d +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , detail::is_data_member_pointer() +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , 0 +# endif + ); } - + template self& def_readonly(char const* name, D& d) { - return this->def_readonly_impl(name, d, 0); + return this->def_readonly_impl( + name, d +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , detail::is_data_member_pointer() +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , 0 +# endif + ); } template self& def_readwrite(char const* name, D& d) { - return this->def_readwrite_impl(name, d, 0); + return this->def_readwrite_impl( + name, d +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , detail::is_data_member_pointer() +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , 0 +# endif + ); } // Property creation @@ -400,27 +443,55 @@ class class_ : public objects::class_base private: // helper functions template - self& def_readonly_impl(char const* name, D B::*pm_, int) + self& def_readonly_impl( + char const* name, D B::*pm_ +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , mpl::true_ +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , int +# endif + ) { D T::*pm = pm_; return this->add_property(name, make_getter(pm)); } template - self& def_readwrite_impl(char const* name, D B::*pm_, int) + self& def_readwrite_impl( + char const* name, D B::*pm_ +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , mpl::true_ +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , int +# endif + ) { D T::*pm = pm_; return this->add_property(name, make_getter(pm), make_setter(pm)); } template - self& def_readonly_impl(char const* name, D& d, ...) + self& def_readonly_impl( + char const* name, D& d +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , mpl::false_ +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , ... +# endif + ) { return this->add_static_property(name, make_getter(d)); } template - self& def_readwrite_impl(char const* name, D& d, ...) + self& def_readwrite_impl( + char const* name, D& d +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) + , mpl::false_ +# elif BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , ... +# endif + ) { return this->add_static_property(name, make_getter(d), make_setter(d)); } @@ -542,10 +613,8 @@ inline void class_::register_() const mpl::bool_() # if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) , holder_selector::execute((held_type*)0) -# elif BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - , holder_selector::type() # else - , typename holder_selector::type() + , BOOST_DEDUCED_TYPENAME holder_selector::type() # endif ); }