#include <bdlb_nullablevalueref.h>
template<class TYPE>
class bdlb::NullableValueRef< TYPE >
This class is a wrapper for either a bsl::optional
or NullableAllocatedValue
, and provides modifiable access to the wrapped object.
See bdlb_nullablevalueref
◆ value_type
value_type
is an alias for the template parameter TYPE
, and represents the type of the object managed by the wrapped nullable object.
◆ ~NullableValueRef()
Destroy this object. Note that this destructor is generated by the compiler, and does not destroy the target.
◆ BSLS_DEPRECATE_FEATURE() [1/4]
Return an address providing non-modifiable access to the underlying object of a (template parameter) TYPE
if this object is non-null, and the specified address
otherwise.
◆ BSLS_DEPRECATE_FEATURE() [2/4]
template<class TYPE >
template<class... ARGS>
Assign to this nullable object the value of the (template parameter) TYPE
created in place using the specified args
. Return a reference providing modifiable access to the created (value) object. The object is also accessible via the value
method. If this nullable object already contains an object (false == isNull()
), that object is destroyed before the new object is created. If TYPE
has the trait bslma::UsesBslmaAllocator
(TYPE
is allocator-enabled) the allocator specified at the construction of this nullable object is used to supply memory to the value object. Attempts to explicitly specify via args
another allocator to supply memory to the created (value) object are disallowed by the compiler. Note that if the constructor of TYPE
throws an exception this object is left in the null state.
◆ BSLS_DEPRECATE_FEATURE() [3/4]
Return the value of the underlying object of a (template parameter) TYPE
if this object is non-null, and the specified otherValue
otherwise. Note that this method returns by value, so may be inefficient in some contexts.
◆ BSLS_DEPRECATE_FEATURE() [4/4]
Return an address providing non-modifiable access to the underlying object of a (template parameter) TYPE
if this object is non-null, and 0 otherwise.
◆ emplace()
template<class TYPE >
template<class... ARGS>
Assign to the target the value of the (template parameter) TYPE
created in place using the specified args
and return a reference providing modifiable access to the underlying TYPE
object. If this optional
object already contains an object (true == hasValue()
), that object is destroyed before the new object is created. Note that if the constructor of TYPE
throws an exception this object is left in a disengaged state.
◆ operator UnspecifiedBool()
Simulation of explicit conversion to bool. Inlined to work around xlC but when out-of-line.
◆ ConstNullableValueRef< TYPE >
The documentation for this class was generated from the following file: