Return the underlying value, or default_value if null.
Synopsis
Declared in <bdlb_nullablevalueref.h>
template<class ANY_TYPE>
TYPE
value_or(ANY_TYPE const& default_value) const;
Description
Return the value of the underlying object of a (template parameter) TYPE if the target is non‐null, and the specified default_value otherwise. Note that this method returns by value, so may be inefficient in some contexts.
Return Value
underlying value, or default_value if null
Parameters
Name |
Description |
default_value |
fallback when the target is null |
Created with MrDocs