diff --git a/src/base/3rdparty/expected.hpp b/src/base/3rdparty/expected.hpp index f2b7f9402..a1ddc6f0e 100644 --- a/src/base/3rdparty/expected.hpp +++ b/src/base/3rdparty/expected.hpp @@ -14,7 +14,7 @@ #define expected_lite_MAJOR 0 #define expected_lite_MINOR 6 -#define expected_lite_PATCH 2 +#define expected_lite_PATCH 3 #define expected_lite_VERSION expected_STRINGIFY(expected_lite_MAJOR) "." expected_STRINGIFY(expected_lite_MINOR) "." expected_STRINGIFY(expected_lite_PATCH) @@ -405,7 +405,7 @@ struct is_nothrow_swappable }; } // namespace detail -// is [nothow] swappable: +// is [nothrow] swappable: template< typename T > struct is_swappable : decltype( detail::is_swappable::test(0) ){}; @@ -1002,11 +1002,12 @@ public: // x.x.5.2.4 Swap + template< typename U=E > nsel_REQUIRES_R( void, - std17::is_swappable::value + std17::is_swappable::value ) swap( unexpected_type & other ) noexcept ( - std17::is_nothrow_swappable::value + std17::is_nothrow_swappable::value ) { using std::swap; @@ -2164,22 +2165,30 @@ private: // x.x.4.6 expected<>: comparison operators -template< typename T1, typename E1, typename T2, typename E2 > +template< typename T1, typename E1, typename T2, typename E2 + nsel_REQUIRES_T( + !std::is_void::value && !std::is_void::value + ) +> constexpr bool operator==( expected const & x, expected const & y ) { - return bool(x) != bool(y) ? false : bool(x) == false ? x.error() == y.error() : *x == *y; + return bool(x) != bool(y) ? false : bool(x) ? *x == *y : x.error() == y.error(); } -template< typename T1, typename E1, typename T2, typename E2 > -constexpr bool operator!=( expected const & x, expected const & y ) +template< typename T1, typename E1, typename T2, typename E2 + nsel_REQUIRES_T( + std::is_void::value && std::is_void::value + ) +> +constexpr bool operator==( expected const & x, expected const & y ) { - return !(x == y); + return bool(x) != bool(y) ? false : bool(x) || static_cast( x.error() == y.error() ); } -template< typename E1, typename E2 > -constexpr bool operator==( expected const & x, expected const & y ) +template< typename T1, typename E1, typename T2, typename E2 > +constexpr bool operator!=( expected const & x, expected const & y ) { - return bool(x) != bool(y) ? false : bool(x) == false ? x.error() == y.error() : true; + return !(x == y); } #if nsel_P0323R <= 2 @@ -2212,13 +2221,21 @@ constexpr bool operator>=( expected const & x, expected const & y ) // x.x.4.7 expected: comparison with T -template< typename T1, typename E1, typename T2 > +template< typename T1, typename E1, typename T2 + nsel_REQUIRES_T( + !std::is_void::value + ) +> constexpr bool operator==( expected const & x, T2 const & v ) { return bool(x) ? *x == v : false; } -template< typename T1, typename E1, typename T2 > +template< typename T1, typename E1, typename T2 + nsel_REQUIRES_T( + !std::is_void::value + ) +> constexpr bool operator==(T2 const & v, expected const & x ) { return bool(x) ? v == *x : false;