value_or overloads

Synopses

Declared in <absl/status/statusor.h>

Returns the held value, or a default when no value is present.

template<typename U>
requires internal_statusor::IsValueOrValid<T, U&&, false>::value
T
value_or(U&& default_value) const &;

Returns the held value, or a default when no value is present (rvalue overload).

template<typename U>
requires internal_statusor::IsValueOrValid<T, U&&, false>::value
T
value_or(U&& default_value) &&;

Returns the held value, or a default when no value is present (lifetime‐bound overload).

template<typename U>
requires internal_statusor::IsValueOrValid<T, U&&, true>::value
T
value_or(U&& default_value) const &;

Returns the held value, or a default when no value is present (rvalue, lifetime‐bound overload).

template<typename U>
requires internal_statusor::IsValueOrValid<T, U&&, true>::value
T
value_or(U&& default_value) &&;

Return Value

The held value if present, otherwise default_value.

Parameters

Name

Description

default_value

The value returned when no held value is present.

Created with MrDocs