mirror of
https://github.com/TartanLlama/expected.git
synced 2025-08-03 10:54:31 +02:00
Fix expected and unexpected comparison
p0323 currently contains a copy/paste error.
This commit is contained in:
@@ -1985,19 +1985,19 @@ constexpr bool operator!=(const U &v, const expected<T, E> &x) {
|
|||||||
|
|
||||||
template <class T, class E>
|
template <class T, class E>
|
||||||
constexpr bool operator==(const expected<T, E> &x, const unexpected<E> &e) {
|
constexpr bool operator==(const expected<T, E> &x, const unexpected<E> &e) {
|
||||||
return x.has_value() ? true : x.error() == e.value();
|
return x.has_value() ? false : x.error() == e.value();
|
||||||
}
|
}
|
||||||
template <class T, class E>
|
template <class T, class E>
|
||||||
constexpr bool operator==(const unexpected<E> &e, const expected<T, E> &x) {
|
constexpr bool operator==(const unexpected<E> &e, const expected<T, E> &x) {
|
||||||
return x.has_value() ? true : x.error() == e.value();
|
return x.has_value() ? false : x.error() == e.value();
|
||||||
}
|
}
|
||||||
template <class T, class E>
|
template <class T, class E>
|
||||||
constexpr bool operator!=(const expected<T, E> &x, const unexpected<E> &e) {
|
constexpr bool operator!=(const expected<T, E> &x, const unexpected<E> &e) {
|
||||||
return x.has_value() ? false : x.error() != e.value();
|
return x.has_value() ? true : x.error() != e.value();
|
||||||
}
|
}
|
||||||
template <class T, class E>
|
template <class T, class E>
|
||||||
constexpr bool operator!=(const unexpected<E> &e, const expected<T, E> &x) {
|
constexpr bool operator!=(const unexpected<E> &e, const expected<T, E> &x) {
|
||||||
return x.has_value() ? false : x.error() != e.value();
|
return x.has_value() ? true : x.error() != e.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO is_swappable
|
// TODO is_swappable
|
||||||
|
Reference in New Issue
Block a user