[#BloombergLP-bslstl-Optional_Base-05-value_or-07] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Optional_Base-05.adoc[Optional_Base]::value_or :relfileprefix: ../../../ :mrdocs: `value_or` overloads == Synopses Declared in `<bslstl_optional.h>` Return a copy of the underlying object of a (template parameter) `t_TYPE` if this object is non‐null, and the specified `value` converted to `t_TYPE` otherwise. Note that this method returns _by_ _value_, so may be inefficient in some contexts. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_ANY_TYPE> t_TYPE xref:BloombergLP/bslstl/Optional_Base-05/value_or-09.adoc[value_or](t_ANY_TYPE&& value) &&; ---- [.small]#xref:BloombergLP/bslstl/Optional_Base-05/value_or-09.adoc[_» more..._]# Return a copy of the underlying object of a (template parameter) `t_TYPE` if this object is non‐null, and the specified `value` converted to `t_TYPE` otherwise. Note that this method returns _by_ _value_, so may be inefficient in some contexts. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_ANY_TYPE> t_TYPE xref:BloombergLP/bslstl/Optional_Base-05/value_or-04a.adoc[value_or](t_ANY_TYPE&& value) const &; ---- [.small]#xref:BloombergLP/bslstl/Optional_Base-05/value_or-04a.adoc[_» more..._]# If this object is non‐null, return a copy of the underlying object of a (template parameter) `t_TYPE` created using the provided allocator, and the specified `value` converted to `t_TYPE` using the specified `allocator` otherwise. Note that this method returns _by_ _value_, so may be inefficient in some contexts. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_ANY_TYPE> t_TYPE xref:BloombergLP/bslstl/Optional_Base-05/value_or-0a.adoc[value_or]( std::allocator_arg_t, xref:BloombergLP/bslstl/Optional_Base-05/allocator_type.adoc[allocator_type] allocator, t_ANY_TYPE&& value) &&; ---- [.small]#xref:BloombergLP/bslstl/Optional_Base-05/value_or-0a.adoc[_» more..._]# If this object is non‐null, return a copy of the underlying object of a (template parameter) `t_TYPE` created using the provided allocator, and the specified `value` converted to `t_TYPE` using the specified `allocator` otherwise. Note that this method returns _by_ _value_, so may be inefficient in some contexts. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_ANY_TYPE> t_TYPE xref:BloombergLP/bslstl/Optional_Base-05/value_or-041.adoc[value_or]( std::allocator_arg_t, xref:BloombergLP/bslstl/Optional_Base-05/allocator_type.adoc[allocator_type] allocator, t_ANY_TYPE&& value) const &; ---- [.small]#xref:BloombergLP/bslstl/Optional_Base-05/value_or-041.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#