[#BloombergLP-bdlb-ConstNullableValueRef] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::ConstNullableValueRef :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class ConstNullableValueRef; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/ConstNullableValueRef/value_type.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/ConstNullableValueRef/2constructor-05.adoc[`ConstNullableValueRef`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlb/ConstNullableValueRef/addressOr.adoc[`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. | xref:BloombergLP/bdlb/ConstNullableValueRef/has_value.adoc[`has_value`] | Return `true` if the target contains a value, and `false` otherwise. | xref:BloombergLP/bdlb/ConstNullableValueRef/isNull.adoc[`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`. | xref:BloombergLP/bdlb/ConstNullableValueRef/operator_star.adoc[`operator*`] | Return a reference providing non‐modifiable access to the underlying `TYPE` object. The behavior is undefined if the target has no value. | xref:BloombergLP/bdlb/ConstNullableValueRef/operator_ptr.adoc[`operator‐>`] | Return a pointer providing non‐modifiable access to the underlying `TYPE` object. The behavior is undefined if the target has no value. | xref:BloombergLP/bdlb/ConstNullableValueRef/value.adoc[`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. | xref:BloombergLP/bdlb/ConstNullableValueRef/valueOr.adoc[`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. | xref:BloombergLP/bdlb/ConstNullableValueRef/valueOrNull.adoc[`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. | xref:BloombergLP/bdlb/ConstNullableValueRef/value_or.adoc[`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. | xref:BloombergLP/bdlb/ConstNullableValueRef/2conversion.adoc[`operator bool`] | Return `true` if the target holds a value, and `false` otherwise. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/operator_not_eq-001.adoc[`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. | xref:BloombergLP/bdlb/operator_not_eq-051.adoc[`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. | xref:BloombergLP/bdlb/operator_not_eq-0c0.adoc[`operator!=`] | Return `true` if the specified `lhs` is not null, and `false` otherwise. | xref:BloombergLP/bdlb/operator_not_eq-0eb.adoc[`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. | xref:BloombergLP/bdlb/operator_lt-033.adoc[`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. | xref:BloombergLP/bdlb/operator_lt-054c.adoc[`operator<`] | Return `false`. `bsl::nullopt` never orders after a `ConstNullableValueRef`. | xref:BloombergLP/bdlb/operator_lt-0f9.adoc[`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`. | xref:BloombergLP/bdlb/operator_lt-0fe.adoc[`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. | xref:BloombergLP/bdlb/operator_le-054.adoc[`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. | xref:BloombergLP/bdlb/operator_le-0b.adoc[`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. | xref:BloombergLP/bdlb/operator_le-0d.adoc[`operator<=`] | Return `true` if the specified `lhs` is null, and `false` otherwise. | xref:BloombergLP/bdlb/operator_le-0f6.adoc[`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)`. | xref:BloombergLP/bdlb/operator_eq-003.adoc[`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. | xref:BloombergLP/bdlb/operator_eq-01c.adoc[`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. | xref:BloombergLP/bdlb/operator_eq-03cc.adoc[`operator==`] | Return `true` if the specified `lhs` is null, and `false` otherwise. | xref:BloombergLP/bdlb/operator_eq-04f.adoc[`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. | xref:BloombergLP/bdlb/operator_gt-02.adoc[`operator>`] | Return `true` if the specified `lhs` is not null, and `false` otherwise. | xref:BloombergLP/bdlb/operator_gt-04f.adoc[`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`. | xref:BloombergLP/bdlb/operator_gt-098.adoc[`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. | xref:BloombergLP/bdlb/operator_gt-0b0.adoc[`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. | xref:BloombergLP/bdlb/operator_ge-008.adoc[`operator>=`] | Return `true`. | xref:BloombergLP/bdlb/operator_ge-035.adoc[`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. | xref:BloombergLP/bdlb/operator_ge-09f9.adoc[`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. | xref:BloombergLP/bdlb/operator_ge-0a.adoc[`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)`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#