-
#include "tensorstore/util/result.h"
- bool tensorstore::Result<T>::ok() const noexcept;
- bool tensorstore::Result<T>::has_value() const noexcept;
- explicit tensorstore::Result<T>::operator bool() const noexcept;
Returns whether or not this
tensorstore::Result<T>
holds aT
value.This member function is analogous to
absl::Status::ok()
and should be used similarly to check the status of return values.Example:
Result<Foo> result = DoBigCalculationThatCouldFail(); if (result.ok()) { // Handle result } else { // Handle error }