Merge "Add android::base::expected::ok()"
This commit is contained in:
commit
d25c64bbf2
|
@ -331,6 +331,7 @@ class _NODISCARD_ expected {
|
|||
|
||||
constexpr explicit operator bool() const noexcept { return has_value(); }
|
||||
constexpr bool has_value() const noexcept { return var_.index() == 0; }
|
||||
constexpr bool ok() const noexcept { return has_value(); }
|
||||
|
||||
constexpr const T& value() const& { return std::get<T>(var_); }
|
||||
constexpr T& value() & { return std::get<T>(var_); }
|
||||
|
@ -557,6 +558,7 @@ class _NODISCARD_ expected<void, E> {
|
|||
// observers
|
||||
constexpr explicit operator bool() const noexcept { return has_value(); }
|
||||
constexpr bool has_value() const noexcept { return var_.index() == 0; }
|
||||
constexpr bool ok() const noexcept { return has_value(); }
|
||||
|
||||
constexpr void value() const& { if (!has_value()) std::get<0>(var_); }
|
||||
|
||||
|
|
Loading…
Reference in New Issue