From fe55a4a963e757e1dfb0464fbb1a6f4324be46e9 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 14 Jan 2018 08:49:25 +0200 Subject: [PATCH] Make error_category::op==, !=, < nonmembers (a non-literal class can't have constexpr members acc. to g++) --- include/boost/system/error_code.hpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/boost/system/error_code.hpp b/include/boost/system/error_code.hpp index c349995..ba0b04a 100644 --- a/include/boost/system/error_code.hpp +++ b/include/boost/system/error_code.hpp @@ -310,15 +310,20 @@ namespace boost BOOST_SYSTEM_NOEXCEPT; inline virtual bool equivalent( const error_code & code, int condition ) const BOOST_SYSTEM_NOEXCEPT; - - BOOST_SYSTEM_CONSTEXPR bool operator==(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT - { return this == &rhs; } - BOOST_SYSTEM_CONSTEXPR bool operator!=(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT - { return this != &rhs; } - bool operator<( const error_category & rhs ) const BOOST_SYSTEM_NOEXCEPT - { return std::less()( this, &rhs ); } }; + BOOST_SYSTEM_CONSTEXPR inline bool operator==( const error_category & lhs, + const error_category & rhs ) BOOST_SYSTEM_NOEXCEPT + { return &lhs == &rhs; } + + BOOST_SYSTEM_CONSTEXPR inline bool operator!=( const error_category & lhs, + const error_category & rhs ) BOOST_SYSTEM_NOEXCEPT + { return &lhs != &rhs; } + + inline bool operator<( const error_category & lhs, + const error_category & rhs ) BOOST_SYSTEM_NOEXCEPT + { return std::less()( &lhs, &rhs ); } + #ifdef BOOST_MSVC #pragma warning(pop) #endif