Loading base/include/android-base/expected.h +12 −28 Original line number Original line Diff line number Diff line Loading @@ -387,14 +387,10 @@ class _NODISCARD_ expected { template<class T1, class E1, class T2, class E2> template<class T1, class E1, class T2, class E2> constexpr bool operator==(const expected<T1, E1>& x, const expected<T2, E2>& y) { constexpr bool operator==(const expected<T1, E1>& x, const expected<T2, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; return false; if (!x.has_value()) return x.error() == y.error(); } else if (!x.has_value()) { return x.error() == y.error(); } else { return *x == *y; return *x == *y; } } } template<class T1, class E1, class T2, class E2> template<class T1, class E1, class T2, class E2> constexpr bool operator!=(const expected<T1, E1>& x, const expected<T2, E2>& y) { constexpr bool operator!=(const expected<T1, E1>& x, const expected<T2, E2>& y) { Loading Loading @@ -581,35 +577,23 @@ class _NODISCARD_ expected<void, E> { template<class E1, class E2> template<class E1, class E2> constexpr bool operator==(const expected<void, E1>& x, const expected<void, E2>& y) { constexpr bool operator==(const expected<void, E1>& x, const expected<void, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; return false; if (!x.has_value()) return x.error() == y.error(); } else if (!x.has_value()) { return x.error() == y.error(); } else { return true; return true; } } } template<class T1, class E1, class E2> template<class T1, class E1, class E2> constexpr bool operator==(const expected<T1, E1>& x, const expected<void, E2>& y) { constexpr bool operator==(const expected<T1, E1>& x, const expected<void, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; if (!x.has_value()) return x.error() == y.error(); return false; return false; } else if (!x.has_value()) { return x.error() == y.error(); } else { return false; } } } template<class E1, class T2, class E2> template<class E1, class T2, class E2> constexpr bool operator==(const expected<void, E1>& x, const expected<T2, E2>& y) { constexpr bool operator==(const expected<void, E1>& x, const expected<T2, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; if (!x.has_value()) return x.error() == y.error(); return false; return false; } else if (!x.has_value()) { return x.error() == y.error(); } else { return false; } } } template<class E> template<class E> Loading Loading
base/include/android-base/expected.h +12 −28 Original line number Original line Diff line number Diff line Loading @@ -387,14 +387,10 @@ class _NODISCARD_ expected { template<class T1, class E1, class T2, class E2> template<class T1, class E1, class T2, class E2> constexpr bool operator==(const expected<T1, E1>& x, const expected<T2, E2>& y) { constexpr bool operator==(const expected<T1, E1>& x, const expected<T2, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; return false; if (!x.has_value()) return x.error() == y.error(); } else if (!x.has_value()) { return x.error() == y.error(); } else { return *x == *y; return *x == *y; } } } template<class T1, class E1, class T2, class E2> template<class T1, class E1, class T2, class E2> constexpr bool operator!=(const expected<T1, E1>& x, const expected<T2, E2>& y) { constexpr bool operator!=(const expected<T1, E1>& x, const expected<T2, E2>& y) { Loading Loading @@ -581,35 +577,23 @@ class _NODISCARD_ expected<void, E> { template<class E1, class E2> template<class E1, class E2> constexpr bool operator==(const expected<void, E1>& x, const expected<void, E2>& y) { constexpr bool operator==(const expected<void, E1>& x, const expected<void, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; return false; if (!x.has_value()) return x.error() == y.error(); } else if (!x.has_value()) { return x.error() == y.error(); } else { return true; return true; } } } template<class T1, class E1, class E2> template<class T1, class E1, class E2> constexpr bool operator==(const expected<T1, E1>& x, const expected<void, E2>& y) { constexpr bool operator==(const expected<T1, E1>& x, const expected<void, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; if (!x.has_value()) return x.error() == y.error(); return false; return false; } else if (!x.has_value()) { return x.error() == y.error(); } else { return false; } } } template<class E1, class T2, class E2> template<class E1, class T2, class E2> constexpr bool operator==(const expected<void, E1>& x, const expected<T2, E2>& y) { constexpr bool operator==(const expected<void, E1>& x, const expected<T2, E2>& y) { if (x.has_value() != y.has_value()) { if (x.has_value() != y.has_value()) return false; if (!x.has_value()) return x.error() == y.error(); return false; return false; } else if (!x.has_value()) { return x.error() == y.error(); } else { return false; } } } template<class E> template<class E> Loading