util::Result::value_or

value_or overloads

Synopses

Declared in <util/result.h>

Returns the held value, or a fallback when the result holds an error.

template<class U>
T
value_or(U&& default_value) const &;
» more...

Returns the held value by move, or a fallback when the result holds an error.

template<class U>
T
value_or(U&& default_value) &&;
» more...

Return Value

the stored value if present, otherwise default_value

Parameters

NameDescription
default_valuethe value returned when no value is held