mirror of
https://github.com/boostorg/logic.git
synced 2025-07-30 04:07:15 +02:00
Use explicit operator bool when available
This commit is contained in:
committed by
James E. King III
parent
bffcf0c4db
commit
23cd89d4c8
@ -109,11 +109,22 @@ public:
|
|||||||
* \returns true if the 3-state boolean is true, false otherwise
|
* \returns true if the 3-state boolean is true, false otherwise
|
||||||
* \throws nothrow
|
* \throws nothrow
|
||||||
*/
|
*/
|
||||||
|
#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS )
|
||||||
|
|
||||||
|
BOOST_CONSTEXPR explicit operator bool () const BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return value == true_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
BOOST_CONSTEXPR operator safe_bool() const BOOST_NOEXCEPT
|
BOOST_CONSTEXPR operator safe_bool() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return value == true_value? &dummy::nonnull : 0;
|
return value == true_value? &dummy::nonnull : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actual stored value in this 3-state boolean, which may be false, true,
|
* The actual stored value in this 3-state boolean, which may be false, true,
|
||||||
* or indeterminate.
|
* or indeterminate.
|
||||||
|
Reference in New Issue
Block a user