| Document Number: | P0393r3, ISO/IEC JTC1 SC22 WG21 |
| Audience: | LWG |
| Date: | 2016-06-21 |
| Author: | Tony Van Eerd (variant at forecode.com) |
These edits align variant with optional in making the relational operators delegate to the relational operators of the underlying types
Other fixes, noticed when editing and/or suggested by LWG during review
operator<() was defined as if index() was signed. It is not.
template <class... Types> constexpr bool operator==(const variant<Types...>& v, const variant<Types...>& w);
get<i>(v) == get<i>(w) is a valid expression returning a type that is convertible to bool, for all i.
return (v.valueless_by_exception() && w.valueless_by_exception()) || (v.index() == w.index() && get<i>(v) == get<i>(w) with i being v.index().
template <class... Types> constexpr bool operator!=(const variant<Types...>& v, const variant<Types...>& w);
return !(v == w).
template <class... Types> constexpr bool operator<(const variant<Types...>& v, const variant<Types...>& w);
get<i>(v) < get<i>(w) is a valid expression returning a type that is convertible to bool, for all i.
return (v.index() < w.index()) || (v.index() == w.index() && !v.valueless_by_exception() && get<i>(v) < get<i>(w) with i being v.index()
template <class... Types> constexpr bool operator>(const variant<Types...>& v, const variant<Types...>& w);
return w < v
template <class... Types> constexpr bool operator<=(const variant<Types...>& v, const variant<Types...>& w);
return !(v > w)
template <class... Types> constexpr bool operator>=(const variant<Types...>& v, const variant<Types...>& w);
return !(v < w).