Replace operator safe_bool with explicit operator bool

This commit is contained in:
Peter Dimov
2024-01-27 09:15:01 +02:00
parent f898d3a1dd
commit af8e66d03b

View File

@ -810,24 +810,7 @@ namespace boost {
}
}
#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG)
// Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it
operator bool () const { return !this->empty(); }
#else
private:
struct dummy {
void nonnull() {}
};
typedef void (dummy::*safe_bool)();
public:
operator safe_bool () const
{ return (this->empty())? 0 : &dummy::nonnull; }
bool operator!() const
{ return this->empty(); }
#endif
explicit operator bool () const { return !this->empty(); }
private:
void assign_to_own(const BOOST_FUNCTION_FUNCTION& f)