mirror of
https://github.com/boostorg/function.git
synced 2025-07-29 12:27:15 +02:00
Replace operator safe_bool with explicit operator bool
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user