summaryrefslogtreecommitdiff
path: root/base/include/android-base/expected.h
diff options
context:
space:
mode:
authorSteven Laver <lavers@google.com>2020-04-26 19:23:49 -0700
committerSteven Laver <lavers@google.com>2020-04-26 19:23:49 -0700
commit4ac5a687c56a98bc54783c53d3a7ed38c93c4386 (patch)
tree36ded3563a964ecb44ef7fda3bb373aed83353d8 /base/include/android-base/expected.h
parentbe3a52c076b2355e6ef6e4c37e8a2d99310151b5 (diff)
parent60264d77dc3e467004412af972ac5a80e8d12059 (diff)
Merge RP1A.200426.001
Change-Id: Ibf1e9770ee4685621e932873dbbebd97e4b4801a
Diffstat (limited to 'base/include/android-base/expected.h')
-rw-r--r--base/include/android-base/expected.h40
1 files changed, 12 insertions, 28 deletions
diff --git a/base/include/android-base/expected.h b/base/include/android-base/expected.h
index 9603bb1cfd..38f0d6f2bc 100644
--- a/base/include/android-base/expected.h
+++ b/base/include/android-base/expected.h
@@ -387,13 +387,9 @@ class _NODISCARD_ expected {
template<class T1, class E1, class T2, class E2>
constexpr bool operator==(const expected<T1, E1>& x, const expected<T2, E2>& y) {
- if (x.has_value() != y.has_value()) {
- return false;
- } else if (!x.has_value()) {
- return x.error() == y.error();
- } else {
- return *x == *y;
- }
+ if (x.has_value() != y.has_value()) return false;
+ if (!x.has_value()) return x.error() == y.error();
+ return *x == *y;
}
template<class T1, class E1, class T2, class E2>
@@ -581,35 +577,23 @@ class _NODISCARD_ expected<void, E> {
template<class E1, class E2>
constexpr bool operator==(const expected<void, E1>& x, const expected<void, E2>& y) {
- if (x.has_value() != y.has_value()) {
- return false;
- } else if (!x.has_value()) {
- return x.error() == y.error();
- } else {
- return true;
- }
+ if (x.has_value() != y.has_value()) return false;
+ if (!x.has_value()) return x.error() == y.error();
+ return true;
}
template<class T1, class E1, class E2>
constexpr bool operator==(const expected<T1, E1>& x, const expected<void, E2>& y) {
- if (x.has_value() != y.has_value()) {
- return false;
- } else if (!x.has_value()) {
- return x.error() == y.error();
- } else {
- return false;
- }
+ if (x.has_value() != y.has_value()) return false;
+ if (!x.has_value()) return x.error() == y.error();
+ return false;
}
template<class E1, class T2, class E2>
constexpr bool operator==(const expected<void, E1>& x, const expected<T2, E2>& y) {
- if (x.has_value() != y.has_value()) {
- return false;
- } else if (!x.has_value()) {
- return x.error() == y.error();
- } else {
- return false;
- }
+ if (x.has_value() != y.has_value()) return false;
+ if (!x.has_value()) return x.error() == y.error();
+ return false;
}
template<class E>