From feff6e40ea4de1013e3e11fda95e3eb0f04322b9 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 2 Oct 2003 17:49:06 +0000 Subject: [PATCH] Use conforming is_class for EDG compilers Make is_enum work for class types which are convertible to anything at all (on many compilers). smart_ptr library workarounds for __MWERKS__ (must use member function pointer for unspecified_bool_type). [SVN r20244] --- include/boost/scoped_array.hpp | 10 +++++++++- include/boost/scoped_ptr.hpp | 9 ++++++++- include/boost/shared_array.hpp | 10 +++++++++- include/boost/shared_ptr.hpp | 10 +++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/include/boost/scoped_array.hpp b/include/boost/scoped_array.hpp index 08155e9..e5919a4 100644 --- a/include/boost/scoped_array.hpp +++ b/include/boost/scoped_array.hpp @@ -93,7 +93,15 @@ public: return ptr != 0; } -#else +#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return ptr == 0? 0: &this_type::get; + } + +#else typedef T * this_type::*unspecified_bool_type; diff --git a/include/boost/scoped_ptr.hpp b/include/boost/scoped_ptr.hpp index da4aeef..c36cace 100644 --- a/include/boost/scoped_ptr.hpp +++ b/include/boost/scoped_ptr.hpp @@ -110,8 +110,15 @@ public: return ptr != 0; } -#else +#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return ptr == 0? 0: &this_type::get; + } +#else typedef T * this_type::*unspecified_bool_type; operator unspecified_bool_type() const // never throws diff --git a/include/boost/shared_array.hpp b/include/boost/shared_array.hpp index b380879..5e943d9 100644 --- a/include/boost/shared_array.hpp +++ b/include/boost/shared_array.hpp @@ -102,7 +102,15 @@ public: return px != 0; } -#else +#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::get; + } + +#else typedef T * this_type::*unspecified_bool_type; diff --git a/include/boost/shared_ptr.hpp b/include/boost/shared_ptr.hpp index f7d80ae..d4b44e6 100644 --- a/include/boost/shared_ptr.hpp +++ b/include/boost/shared_ptr.hpp @@ -269,7 +269,15 @@ public: return px != 0; } -#else +#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::get; + } + +#else typedef T * this_type::*unspecified_bool_type;