This class is a wrapper for either a bsl::optional or NullableAllocatedValue, and provides non‐modifiable access to the wrapped object.

Synopsis

Declared in <bdlb_nullablevalueref.h>

template<class TYPE>
class ConstNullableValueRef;

Type Aliases

Name

Description

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.

Member Functions

Name

Description

ConstNullableValueRef [constructor]

Constructors

addressOr

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.

has_value

Return true if the target contains a value, and false otherwise.

isNull

Return false if the target contains a value, and true otherwise. Note that this accessor is provided purely for compatibility with NullableValue and NullableAllocatedValue, and its use is discouraged in favor of has_value.

operator*

Return a reference providing non‐modifiable access to the underlying TYPE object. The behavior is undefined if the target has no value.

operator‐>

Return a pointer providing non‐modifiable access to the underlying TYPE object. The behavior is undefined if the target has no value.

value

Return a reference providing non‐modifiable access to the underlying object of a (template parameter) TYPE. The behavior is undefined if the target has no value.

valueOr

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.

valueOrNull

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.

value_or

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.

operator bool

Return true if the target holds a value, and false otherwise.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs nullable objects do not have the same value, and false otherwise. Two nullable wrappers do not have the same value if one is null and the other is non‐null, or if both are non‐null and the values of their underlying objects do not compare equal. Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator!=

Return true if the specified lhs and rhs nullable objects do not have the same value, and false otherwise. Two nullable wrappers do not have the same value if one is null and the other is non‐null, or if bost are non‐null and the values of their underlying objects do not compare equal. Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator!=

Return true if the specified lhs is not null, and false otherwise.

operator!=

Return true if the specified lhs and rhs objects do not have the same value, and false otherwise. A nullable wrappers and a value of some type do not have the same value if either the nullable wrappers is null, or its underlying value does not compare equal to the other value. Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator<

Return true if the specified lhs nullable wrapper is ordered before the specified rhs nullable object, and false otherwise. lhs is ordered before rhs if lhs is null and rhs is non‐null or if both are non‐null and lhs.value() is ordered before rhs.value(). Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator<

Return false. bsl::nullopt never orders after a ConstNullableValueRef.

operator<

Return true if the specified lhs nullable wrapper is ordered before the specified rhs, and false otherwise. lhs is ordered before rhs if lhs is null or lhs.value() is ordered before rhs.

operator<

Return true if the specified lhs nullable wrapper is ordered before the specified rhs nullable object, and false otherwise. lhs is ordered before rhs if lhs is null and rhs is non‐null or if both are non‐null and lhs.value() is ordered before rhs.value(). Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator<=

Return true if the specified lhs nullable wrapper is ordered before the specified rhs nullable object or lhs and rhs have the same value, and false otherwise. (See operator< and operator==.) Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator<=

Return true if the specified lhs nullable wrapper is ordered before the specified rhs nullable object or lhs and rhs have the same value, and false otherwise. (See operator< and operator==.) Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator<=

Return true if the specified lhs is null, and false otherwise.

operator<=

Return true if the specified lhs nullable wrapper is ordered before the specified rhs or lhs and rhs have the same value, and false otherwise. (See operator< and operator==.) Note that this operator returns !(rhs < lhs).

operator==

Return true if the specified lhs and rhs nullable wrappers have the same value, and false otherwise. Two nullable wrappers have the same value if both targets are null, or if both are non‐null and the values of their underlying objects compare equal. Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator==

Return true if the specified lhs and rhs nullable wrappers have the same value, and false otherwise. Two nullable wrappers have the same value if both targets are null, or if both are non‐null and the values of their underlying objects compare equal. Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator==

Return true if the specified lhs is null, and false otherwise.

operator==

Return true if the specified lhs and rhs objects have the same value, and false otherwise. A nullable wrapper and a value of some type have the same value if the nullable wrapper is non‐null and the underlying value of it's target compares equal to the other value. Note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator>

Return true if the specified lhs is not null, and false otherwise.

operator>

Return true if the specified lhs nullable wrapper is ordered after the specified rhs, and false otherwise. lhs is ordered after rhs if lhs is not null and lhs.value() is ordered after rhs. Note that this operator returns rhs < lhs.

operator>

Return true if the specified lhs nullable wrapper is ordered after the specified rhs nullable object, and false otherwise. lhs is ordered after rhs if lhs is non‐null and rhs is null or if both are non‐null and lhs.value() is ordered after rhs.value(). Note that this operator returns rhs < lhs when both operands are of NullableValue type. Also note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator>

Return true if the specified lhs nullable wrapper is ordered after the specified rhs nullable object, and false otherwise. lhs is ordered after rhs if lhs is non‐null and rhs is null or if both are non‐null and lhs.value() is ordered after rhs.value(). Note that this operator returns rhs < lhs when both operands are of NullableValue type. Also note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator>=

Return true.

operator>=

Return true if the specified lhs nullable object is ordered after the specified rhs nullable wrapper or lhs and rhs have the same value, and false otherwise. (See operator> and operator==.) Note that this operator returns !(lhs < rhs) when both operands are of NullableValue type. Also note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator>=

Return true if the specified lhs nullable object is ordered after the specified rhs nullable wrapper or lhs and rhs have the same value, and false otherwise. (See operator> and operator==.) Note that this operator returns !(lhs < rhs) when both operands are of NullableValue type. Also note that this function will fail to compile if LHS_TYPE and RHS_TYPE are not compatible.

operator>=

Return true if the specified lhs nullable wrapper is ordered after the specified rhs or lhs and rhs have the same value, and false otherwise. (See operator> and operator==.) Note that this operator returns !(lhs < rhs).

Created with MrDocs