#include "tensorstore/util/result.h"
const Ttensorstore::Result<T>::value() const&;
Ttensorstore::Result<T>::value() &;
const T&tensorstore::Result<T>::value() const&&;
T&tensorstore::Result<T>::value() &&;

Returns a reference to the held value if this->ok(). Otherwise terminates the process.

If the state of the result has already been checked using this->ok(), consider using operator*() or operator->() to access the value.

Note: for value types that are cheap to copy, prefer simple code:

T value = result.value();

Otherwise, if the value type is expensive to copy, but can be left in the Result, simply assign to a reference:

T& value = result.value();  // or `const T&`

Otherwise, if the value type supports an efficient move, it can be used as follows:

T value = std::move(result).value();

The std::move on result instead of on the whole expression enables warnings about possible uses of the result object after the move.

Pre:

this->ok() == true, otherwise the process will be terminated.