[#absl-StatusOr-value_or-06] = xref:absl.adoc[absl]::xref:absl/StatusOr.adoc[StatusOr]::value_or :relfileprefix: ../../ :mrdocs: `value_or` overloads == Synopses Declared in `<absl/status/statusor.h>` Returns the held value, or a default when no value is present. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename U> requires internal_statusor::IsValueOrValid<T, U&&, false>::value T xref:absl/StatusOr/value_or-03.adoc[value_or](U&& default_value) const &; ---- [.small]#xref:absl/StatusOr/value_or-03.adoc[_» more..._]# Returns the held value, or a default when no value is present (rvalue overload). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename U> requires internal_statusor::IsValueOrValid<T, U&&, false>::value T xref:absl/StatusOr/value_or-08.adoc[value_or](U&& default_value) &&; ---- [.small]#xref:absl/StatusOr/value_or-08.adoc[_» more..._]# Returns the held value, or a default when no value is present (lifetime‐bound overload). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename U> requires internal_statusor::IsValueOrValid<T, U&&, true>::value T xref:absl/StatusOr/value_or-0e.adoc[value_or](U&& default_value) const &; ---- [.small]#xref:absl/StatusOr/value_or-0e.adoc[_» more..._]# Returns the held value, or a default when no value is present (rvalue, lifetime‐bound overload). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename U> requires internal_statusor::IsValueOrValid<T, U&&, true>::value T xref:absl/StatusOr/value_or-04.adoc[value_or](U&& default_value) &&; ---- [.small]#xref:absl/StatusOr/value_or-04.adoc[_» more..._]# == Return Value The held value if present, otherwise `default_value`. == Parameters [cols="1,4"] |=== | Name| Description | *default_value* | The value returned when no held value is present. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#