diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-07-23 17:14:03 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2024-07-28 19:05:58 +0200 |
commit | 8fbee909fd8516a18e3677e837bda190ed9dccf7 (patch) | |
tree | 5961895d265d3e823f699dd2758de63a39085919 | |
parent | dd46a960f3bfb4a4d147bb349deee150c2cd0547 (diff) | |
download | gcc-8fbee909fd8516a18e3677e837bda190ed9dccf7.zip gcc-8fbee909fd8516a18e3677e837bda190ed9dccf7.tar.gz gcc-8fbee909fd8516a18e3677e837bda190ed9dccf7.tar.bz2 |
libstdc++: Reorder template params of std::optional comparisons (LWG 2945)
libstdc++-v3/ChangeLog:
* include/std/optional: Reorder parameters in comparison
operators as per LWG 2945.
-rw-r--r-- | libstdc++-v3/include/std/optional | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 2cc0221..4694d59 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -1601,10 +1601,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __lhs && *__lhs == __rhs; } template<typename _Tp, typename _Up> - _REQUIRES_NOT_OPTIONAL(_Up) + _REQUIRES_NOT_OPTIONAL(_Tp) constexpr auto - operator==(const _Up& __lhs, const optional<_Tp>& __rhs) - -> __optional_eq_t<_Up, _Tp> + operator== [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs) + -> __optional_eq_t<_Tp, _Up> { return __rhs && __lhs == *__rhs; } template<typename _Tp, typename _Up> @@ -1615,10 +1615,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !__lhs || *__lhs != __rhs; } template<typename _Tp, typename _Up> - _REQUIRES_NOT_OPTIONAL(_Up) + _REQUIRES_NOT_OPTIONAL(_Tp) constexpr auto - operator!= [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs) - -> __optional_ne_t<_Up, _Tp> + operator!= [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs) + -> __optional_ne_t<_Tp, _Up> { return !__rhs || __lhs != *__rhs; } template<typename _Tp, typename _Up> @@ -1629,10 +1629,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !__lhs || *__lhs < __rhs; } template<typename _Tp, typename _Up> - _REQUIRES_NOT_OPTIONAL(_Up) + _REQUIRES_NOT_OPTIONAL(_Tp) constexpr auto - operator< [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs) - -> __optional_lt_t<_Up, _Tp> + operator< [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs) + -> __optional_lt_t<_Tp, _Up> { return __rhs && __lhs < *__rhs; } template<typename _Tp, typename _Up> @@ -1643,10 +1643,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __lhs && *__lhs > __rhs; } template<typename _Tp, typename _Up> - _REQUIRES_NOT_OPTIONAL(_Up) + _REQUIRES_NOT_OPTIONAL(_Tp) constexpr auto - operator> [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs) - -> __optional_gt_t<_Up, _Tp> + operator> [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs) + -> __optional_gt_t<_Tp, _Up> { return !__rhs || __lhs > *__rhs; } template<typename _Tp, typename _Up> @@ -1657,10 +1657,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !__lhs || *__lhs <= __rhs; } template<typename _Tp, typename _Up> - _REQUIRES_NOT_OPTIONAL(_Up) + _REQUIRES_NOT_OPTIONAL(_Tp) constexpr auto - operator<= [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs) - -> __optional_le_t<_Up, _Tp> + operator<= [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs) + -> __optional_le_t<_Tp, _Up> { return __rhs && __lhs <= *__rhs; } template<typename _Tp, typename _Up> @@ -1671,10 +1671,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __lhs && *__lhs >= __rhs; } template<typename _Tp, typename _Up> - _REQUIRES_NOT_OPTIONAL(_Up) + _REQUIRES_NOT_OPTIONAL(_Tp) constexpr auto - operator>= [[nodiscard]] (const _Up& __lhs, const optional<_Tp>& __rhs) - -> __optional_ge_t<_Up, _Tp> + operator>= [[nodiscard]] (const _Tp& __lhs, const optional<_Up>& __rhs) + -> __optional_ge_t<_Tp, _Up> { return !__rhs || __lhs >= *__rhs; } #ifdef __cpp_lib_three_way_comparison |