#include "tensorstore/util/result.h"
template <typename U>
T tensorstore::Result<T>::value_or(U&default_value) const&;
template <typename U>
T tensorstore::Result<T>::value_or(U&default_value) &&;

Returns the current value if this->ok() == true. Otherwise constructs a value using the provided default_value.

Unlike value, this function returns by value, copying the current value if necessary. If the value type supports an efficient move, it can be used as follows:

T value = std::move(statusor).value_or(def);

Unlike with value, calling std::move() on the result of value_or will still trigger a copy.