BDE 4.14.0 Production release
|
#include <bdlb_nullablevalueref.h>
Public Types | |
typedef TYPE | value_type |
Public Member Functions | |
ConstNullableValueRef (const bsl::optional< TYPE > &opt) | |
ConstNullableValueRef (const NullableAllocatedValue< TYPE > &opt) | |
ConstNullableValueRef (const NullableValueRef< TYPE > &ref) | |
ConstNullableValueRef (const ConstNullableValueRef &original) | |
~ConstNullableValueRef () | |
bool | has_value () const BSLS_KEYWORD_NOEXCEPT |
Return true if the target contains a value, and false otherwise. | |
bool | isNull () const BSLS_KEYWORD_NOEXCEPT |
const value_type & | value () const |
const value_type * | operator-> () const |
const value_type & | operator* () const |
operator UnspecifiedBool () const BSLS_NOTHROW_SPEC | |
template<class ANY_TYPE > | |
TYPE | value_or (const ANY_TYPE &default_value) const |
BSLS_DEPRECATE_FEATURE ("bdl", "ConstNullableValueRef::addressOr", "Use 'has_value() ? &value() : address' instead") const TYPE *addressOr(const TYPE *address) const | |
BSLS_DEPRECATE_FEATURE ("bdl", "ConstNullableValueRef::valueOr", "Use 'value_or' instead") TYPE valueOr(const TYPE &otherValue) const | |
BSLS_DEPRECATE_FEATURE ("bdl", "ConstNullableValueRef::valueOrNull", "Use 'has_value() ? &value() : NULL' instead") const TYPE *valueOrNull() const | |
This class is a wrapper for either a bsl::optional
or NullableAllocatedValue
, and provides non-modifiable access to the wrapped object.
typedef TYPE bdlb::ConstNullableValueRef< TYPE >::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.
bdlb::ConstNullableValueRef< TYPE >::~ConstNullableValueRef | ( | ) |
Destroy this object. Note that this destructor is generated by the compiler, and does not destruct the target.
bdlb::ConstNullableValueRef< TYPE >::BSLS_DEPRECATE_FEATURE | ( | "bdl" | , |
"ConstNullableValueRef< TYPE >::addressOr" | , | ||
"Use 'has_value() ? &value() : address' instead" | |||
) | const |
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.
bdlb::ConstNullableValueRef< TYPE >::BSLS_DEPRECATE_FEATURE | ( | "bdl" | , |
"ConstNullableValueRef< TYPE >::valueOr" | , | ||
"Use 'value_or' instead" | |||
) | const & |
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.
bdlb::ConstNullableValueRef< TYPE >::BSLS_DEPRECATE_FEATURE | ( | "bdl" | , |
"ConstNullableValueRef< TYPE >::valueOrNull" | , | ||
"Use 'has_value() ? &value() : NULL' instead" | |||
) | const |
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.
|
inline |
Simulation of explicit conversion to bool. Inlined to work around xlC but when out-of-line.