File indexing completed on 2025-01-18 09:30:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP
0019 #define BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP
0020
0021 #include <boost/config.hpp>
0022 #include <boost/config/workaround.hpp>
0023
0024 #ifdef BOOST_HAS_PRAGMA_ONCE
0025 #pragma once
0026 #endif
0027
0028 #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
0029
0030
0031
0032
0033
0034
0035
0036
0037 #define BOOST_EXPLICIT_OPERATOR_BOOL()\
0038 BOOST_FORCEINLINE explicit operator bool () const\
0039 {\
0040 return !this->operator! ();\
0041 }
0042
0043
0044
0045
0046
0047
0048
0049
0050 #define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
0051 BOOST_FORCEINLINE explicit operator bool () const BOOST_NOEXCEPT\
0052 {\
0053 return !this->operator! ();\
0054 }
0055
0056 #if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
0057
0058
0059
0060
0061
0062
0063
0064
0065 #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
0066 BOOST_FORCEINLINE BOOST_CONSTEXPR explicit operator bool () const BOOST_NOEXCEPT\
0067 {\
0068 return !this->operator! ();\
0069 }
0070
0071 #else
0072
0073 #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL() BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
0074
0075 #endif
0076
0077 #else
0078
0079 #if (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG)
0080
0081 #define BOOST_NO_UNSPECIFIED_BOOL
0082 #endif
0083
0084 #if !defined(BOOST_NO_UNSPECIFIED_BOOL)
0085
0086 namespace boost {
0087
0088 namespace detail {
0089
0090 #if !defined(_MSC_VER) && !defined(__IBMCPP__)
0091
0092 struct unspecified_bool
0093 {
0094
0095
0096
0097 struct OPERATORS_NOT_ALLOWED;
0098 static void true_value(OPERATORS_NOT_ALLOWED*) {}
0099 };
0100 typedef void (*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
0101
0102 #else
0103
0104
0105 struct unspecified_bool
0106 {
0107
0108
0109
0110 struct OPERATORS_NOT_ALLOWED;
0111 void true_value(OPERATORS_NOT_ALLOWED*) {}
0112 };
0113 typedef void (unspecified_bool::*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
0114
0115 #endif
0116
0117 }
0118
0119 }
0120
0121 #define BOOST_EXPLICIT_OPERATOR_BOOL()\
0122 BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const\
0123 {\
0124 return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
0125 }
0126
0127 #define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
0128 BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\
0129 {\
0130 return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
0131 }
0132
0133 #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
0134 BOOST_FORCEINLINE BOOST_CONSTEXPR operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\
0135 {\
0136 return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
0137 }
0138
0139 #else
0140
0141 #define BOOST_EXPLICIT_OPERATOR_BOOL()\
0142 BOOST_FORCEINLINE operator bool () const\
0143 {\
0144 return !this->operator! ();\
0145 }
0146
0147 #define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
0148 BOOST_FORCEINLINE operator bool () const BOOST_NOEXCEPT\
0149 {\
0150 return !this->operator! ();\
0151 }
0152
0153 #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
0154 BOOST_FORCEINLINE BOOST_CONSTEXPR operator bool () const BOOST_NOEXCEPT\
0155 {\
0156 return !this->operator! ();\
0157 }
0158
0159 #endif
0160
0161 #endif
0162
0163 #endif