forked from boostorg/optional
Drop explicit bool idiom
This commit is contained in:
@ -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; }
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
Reference in New Issue
Block a user