18 #ifndef BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP
19 #define BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP
23 #ifdef BOOST_HAS_PRAGMA_ONCE
27 #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
36 #define BOOST_EXPLICIT_OPERATOR_BOOL()\
37 BOOST_FORCEINLINE explicit operator bool () const\
39 return !this->operator! ();\
49 #define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
50 BOOST_FORCEINLINE explicit operator bool () const BOOST_NOEXCEPT\
52 return !this->operator! ();\
62 #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
63 BOOST_FORCEINLINE BOOST_CONSTEXPR explicit operator bool () const BOOST_NOEXCEPT\
65 return !this->operator! ();\
68 #else // !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
70 #if (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG)
72 #define BOOST_NO_UNSPECIFIED_BOOL
73 #endif // (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG)
75 #if !defined(BOOST_NO_UNSPECIFIED_BOOL)
81 #if !defined(_MSC_VER) && !defined(__IBMCPP__)
83 struct unspecified_bool
88 struct OPERATORS_NOT_ALLOWED;
89 static void true_value(OPERATORS_NOT_ALLOWED*) {}
91 typedef void (*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
96 struct unspecified_bool
101 struct OPERATORS_NOT_ALLOWED;
102 void true_value(OPERATORS_NOT_ALLOWED*) {}
104 typedef void (unspecified_bool::*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
112 #define BOOST_EXPLICIT_OPERATOR_BOOL()\
113 BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const\
115 return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
118 #define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
119 BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\
121 return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
124 #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
125 BOOST_FORCEINLINE BOOST_CONSTEXPR operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\
127 return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
130 #else // !defined(BOOST_NO_UNSPECIFIED_BOOL)
132 #define BOOST_EXPLICIT_OPERATOR_BOOL()\
133 BOOST_FORCEINLINE operator bool () const\
135 return !this->operator! ();\
138 #define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
139 BOOST_FORCEINLINE operator bool () const BOOST_NOEXCEPT\
141 return !this->operator! ();\
144 #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
145 BOOST_FORCEINLINE BOOST_CONSTEXPR operator bool () const BOOST_NOEXCEPT\
147 return !this->operator! ();\
150 #endif // !defined(BOOST_NO_UNSPECIFIED_BOOL)
152 #endif // !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
154 #endif // BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP