From 70b5449e99b1df904f293dabc9225e4d0b73dc64 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 14 Jun 2021 03:53:00 +0300 Subject: [PATCH] Resolve ambiguity for std::error_code == boost::system::error_code --- include/boost/system/detail/error_code.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/boost/system/detail/error_code.hpp b/include/boost/system/detail/error_code.hpp index f92c5d7..2b8766f 100644 --- a/include/boost/system/detail/error_code.hpp +++ b/include/boost/system/detail/error_code.hpp @@ -302,6 +302,28 @@ public: #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + inline friend bool operator==( std::error_code const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return lhs == static_cast< std::error_code >( rhs ); + } + + inline friend bool operator==( error_code const & lhs, std::error_code const & rhs ) BOOST_NOEXCEPT + { + return static_cast< std::error_code >( lhs ) == rhs; + } + + inline friend bool operator!=( std::error_code const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + inline friend bool operator!=( error_code const & lhs, std::error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + // conversions + operator std::error_code () const { if( flags_ == 1 )