diff --git a/include/boost/system/detail/error_condition.hpp b/include/boost/system/detail/error_condition.hpp index a7e35ab..b2da281 100644 --- a/include/boost/system/detail/error_condition.hpp +++ b/include/boost/system/detail/error_condition.hpp @@ -261,6 +261,58 @@ public: return !( lhs == rhs ); } + // + + template::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT + { + return lhs == make_error_condition( rhs ); + } + + template::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT + { + return make_error_condition( lhs ) == rhs; + } + + template::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + template::value>::type> + BOOST_SYSTEM_CONSTEXPR inline friend bool operator!=( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + // + + template::value>::type> + inline friend bool operator==( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT + { + return lhs == make_error_code( rhs ); + } + + template::value>::type> + inline friend bool operator==( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT + { + return make_error_code( lhs ) == rhs; + } + + template::value>::type> + inline friend bool operator!=( error_condition const & lhs, E rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + template::value>::type> + inline friend bool operator!=( E lhs, error_condition const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + #endif std::string to_string() const diff --git a/test/std_interop_test15.cpp b/test/std_interop_test15.cpp index 87f64dc..66a953b 100644 --- a/test/std_interop_test15.cpp +++ b/test/std_interop_test15.cpp @@ -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(); }