From af8e66d03b4366c7039a138306470567c2243130 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 27 Jan 2024 09:15:01 +0200 Subject: [PATCH] Replace operator safe_bool with explicit operator bool --- include/boost/function/function_template.hpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index f3a524f..3991e36 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -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)