mirror of
https://github.com/boostorg/system.git
synced 2025-07-31 21:14:26 +02:00
Resolve ambiguities when comparing error_condition with std enums (refs #91)
This commit is contained in:
@@ -261,6 +261,58 @@ public:
|
||||
return !( lhs == rhs );
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type>
|
||||
BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return lhs == make_error_condition( rhs );
|
||||
}
|
||||
|
||||
template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type>
|
||||
BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return make_error_condition( lhs ) == rhs;
|
||||
}
|
||||
|
||||
template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type>
|
||||
BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return !( lhs == rhs );
|
||||
}
|
||||
|
||||
template<class E, class N = typename detail::enable_if<std::is_error_condition_enum<E>::value>::type>
|
||||
BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return !( lhs == rhs );
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type>
|
||||
inline friend bool operator==( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return lhs == make_error_code( rhs );
|
||||
}
|
||||
|
||||
template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type>
|
||||
inline friend bool operator==( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return make_error_code( lhs ) == rhs;
|
||||
}
|
||||
|
||||
template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type>
|
||||
inline friend bool operator!=( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return !( lhs == rhs );
|
||||
}
|
||||
|
||||
template<class E, class N1 = void, class N2 = typename detail::enable_if<std::is_error_code_enum<E>::value>::type>
|
||||
inline friend bool operator!=( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT
|
||||
{
|
||||
return !( lhs == rhs );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::string to_string() const
|
||||
|
@@ -67,11 +67,11 @@ int main()
|
||||
BOOST_TEST_EQ( ec, enomem_n );
|
||||
BOOST_TEST_EQ( enomem_n, ec );
|
||||
|
||||
// BOOST_TEST_EQ( en, enomem_c );
|
||||
// BOOST_TEST_EQ( enomem_c, en );
|
||||
BOOST_TEST_EQ( en, enomem_c );
|
||||
BOOST_TEST_EQ( enomem_c, en );
|
||||
|
||||
// BOOST_TEST_EQ( en, enomem_n );
|
||||
// BOOST_TEST_EQ( enomem_n, en );
|
||||
BOOST_TEST_EQ( en, enomem_n );
|
||||
BOOST_TEST_EQ( enomem_n, en );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Reference in New Issue
Block a user