Drop explicit bool idiom

This commit is contained in:
Andrzej Krzemienski
2024-08-15 10:57:03 +02:00
parent 794e03af30
commit 6ec468aff6
3 changed files with 2 additions and 5 deletions

View File

@ -160,8 +160,7 @@ public:
throw_exception(bad_optional_access()); throw_exception(bad_optional_access());
} }
bool operator!() const BOOST_NOEXCEPT { return ptr_ == 0; } explicit operator bool() const BOOST_NOEXCEPT { return ptr_ != 0; }
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
void reset() BOOST_NOEXCEPT { ptr_ = 0; } void reset() BOOST_NOEXCEPT { ptr_ = 0; }

View File

@ -29,7 +29,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/addressof.hpp> #include <boost/core/addressof.hpp>
#include <boost/core/enable_if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/core/explicit_operator_bool.hpp>
#include <boost/core/invoke_swap.hpp> #include <boost/core/invoke_swap.hpp>
#include <boost/core/launder.hpp> #include <boost/core/launder.hpp>
#include <boost/optional/bad_optional_access.hpp> #include <boost/optional/bad_optional_access.hpp>

View File

@ -25,8 +25,7 @@ struct implicit_bool_conv
struct explicit_bool_conv struct explicit_bool_conv
{ {
bool operator!() const BOOST_NOEXCEPT { return false; } explicit operator bool() const BOOST_NOEXCEPT { return true; }
BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
}; };
template <typename To, typename From> template <typename To, typename From>