forked from TartanLlama/expected
Fix equality test for expected<void,E>
This commit is contained in:
@@ -2276,6 +2276,20 @@ constexpr bool operator!=(const expected<T, E> &lhs,
|
||||
? true
|
||||
: (!lhs.has_value() ? lhs.error() != rhs.error() : *lhs != *rhs);
|
||||
}
|
||||
template <class E, class F>
|
||||
constexpr bool operator==(const expected<void, E> &lhs,
|
||||
const expected<void, F> &rhs) {
|
||||
return (lhs.has_value() != rhs.has_value())
|
||||
? false
|
||||
: (!lhs.has_value() ? lhs.error() == rhs.error() : true);
|
||||
}
|
||||
template <class E, class F>
|
||||
constexpr bool operator!=(const expected<void, E> &lhs,
|
||||
const expected<void, F> &rhs) {
|
||||
return (lhs.has_value() != rhs.has_value())
|
||||
? true
|
||||
: (!lhs.has_value() ? lhs.error() == rhs.error() : false);
|
||||
}
|
||||
|
||||
template <class T, class E, class U>
|
||||
constexpr bool operator==(const expected<T, E> &x, const U &v) {
|
||||
|
||||
Reference in New Issue
Block a user