Created on 2017-03-13.00:00:00 last changed 45 months ago
Proposed resolution:
This wording is relative to N4659.
Modify [optional.syn], <optional> synopsis, as indicated:
// [optional.comp_with_t], comparison with T template <class T, class U> constexpr bool operator==(const optional<T>&, const U&); template <class T, class U> constexpr bool operator==(constUT&, const optional<TU>&); template <class T, class U> constexpr bool operator!=(const optional<T>&, const U&); template <class T, class U> constexpr bool operator!=(constUT&, const optional<TU>&); template <class T, class U> constexpr bool operator<(const optional<T>&, const U&); template <class T, class U> constexpr bool operator<(constUT&, const optional<TU>&); template <class T, class U> constexpr bool operator<=(const optional<T>&, const U&); template <class T, class U> constexpr bool operator<=(constUT&, const optional<TU>&); template <class T, class U> constexpr bool operator>(const optional<T>&, const U&); template <class T, class U> constexpr bool operator>(constUT&, const optional<TU>&); template <class T, class U> constexpr bool operator>=(const optional<T>&, const U&); template <class T, class U> constexpr bool operator>=(constUT&, const optional<TU>&);
Modify [optional.comp_with_t] as indicated:
template <class T, class U> constexpr bool operator==(constUT& v, const optional<TU>& x);-3- […]
[…]
template <class T, class U> constexpr bool operator!=(constUT& v, const optional<TU>& x);-7- […]
[…]
template <class T, class U> constexpr bool operator<(constUT& v, const optional<TU>& x);-11- […]
[…]
template <class T, class U> constexpr bool operator<=(constUT& v, const optional<TU>& x);-15- […]
[…]
template <class T, class U> constexpr bool operator>(constUT& v, const optional<TU>& x);-19- […]
[…]
template <class T, class U> constexpr bool operator>=(constUT& v, const optional<TU>& x);-23- […]
[…]
[ 2016-07, Toronto Thursday night issues processing ]
Status to Ready
[ 2017-07-13, Casey Carter provides wording ]
LWG 2934 added an additional template parameter to the comparison operators for std::optional, but the ones that compare U with optional<T> have the parameters backwards compared to the function parameters:
template <class T, class U> constexpr bool operator==(const U&, const optional<T>&);
Ville confirmed there's no particular reason for this, it's just how he wrote the proposed resolution, but as this has normative effect we should consider if we really want the template parameters and function parameters to be in different orders or not.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2017-11-13 19:01:36 | admin | set | status: voting -> wp |
2017-10-17 18:34:55 | admin | set | status: ready -> voting |
2017-07-16 20:11:05 | admin | set | messages: + msg9417 |
2017-07-16 20:11:05 | admin | set | status: new -> ready |
2017-07-13 17:00:16 | admin | set | messages: + msg9364 |
2017-07-13 17:00:16 | admin | set | messages: + msg9363 |
2017-03-13 00:00:00 | admin | create |