[#BloombergLP-bdlb-NullableValueRef]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::NullableValueRef
:relfileprefix: ../../
:mrdocs:

This class is a wrapper for either a `bsl&colon;&colon;optional` or `NullableAllocatedValue`, and provides modifiable access to the wrapped object&period;

== Synopsis

Declared in `&lt;bdlb&lowbar;nullablevalueref&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
class NullableValueRef;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlb/NullableValueRef/value_type.adoc[`value&lowbar;type`] 
| `value&lowbar;type` is an alias for the template parameter `TYPE`, and represents the type of the object managed by the wrapped nullable object&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlb/NullableValueRef/2constructor-0d8.adoc[`NullableValueRef`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlb/NullableValueRef/operator_assign-08.adoc[`operator&equals;`] 
| Assignment operators
| xref:BloombergLP/bdlb/NullableValueRef/addressOr.adoc[`addressOr`] 
| Return an address providing non&hyphen;modifiable access to the underlying object of a (template parameter) `TYPE` if this object is non&hyphen;null, and the specified `address` otherwise&period;
| xref:BloombergLP/bdlb/NullableValueRef/emplace.adoc[`emplace`] 
| 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&period; If this `optional` object already contains an object (&grave;true &equals;&equals; hasValue()&grave;), that object is destroyed before the new object is created&period; Note that if the constructor of `TYPE` throws an exception this object is left in a disengaged state&period;
| xref:BloombergLP/bdlb/NullableValueRef/has_value.adoc[`has&lowbar;value`] 
| Return `true` if the target contains a value, and `false` otherwise&period;
| xref:BloombergLP/bdlb/NullableValueRef/isNull.adoc[`isNull`] 
| Return `false` if the target contains a value, and `true` otherwise&period; Note that this accessor is provided purely for compatibility with `NullableValue` and `NullableAllocatedValue`, and its use is discouraged in favor of `has&lowbar;value`&period;
| xref:BloombergLP/bdlb/NullableValueRef/makeValueInplace.adoc[`makeValueInplace`] 
| Assign to this nullable object the value of the (template parameter) `TYPE` created in place using the specified `args`&period; Return a reference providing modifiable access to the created (value) object&period; The object is also accessible via the `value` method&period; If this nullable object already contains an object (`false &equals;&equals; isNull()`), that object is destroyed before the new object is created&period; If `TYPE` has the trait `bslma&colon;&colon;UsesBslmaAllocator` (`TYPE` is allocator&hyphen;enabled) the allocator specified at the construction of this nullable object is used to supply memory to the value object&period; Attempts to explicitly specify via `args` another allocator to supply memory to the created (value) object are disallowed by the compiler&period; Note that if the constructor of `TYPE` throws an exception this object is left in the null state&period;
| xref:BloombergLP/bdlb/NullableValueRef/operator_star-08e.adoc[`operator&ast;`] 
| Dereference operators
| xref:BloombergLP/bdlb/NullableValueRef/operator_ptr-0a.adoc[`operator&hyphen;&gt;`] 
| Member access operators
| xref:BloombergLP/bdlb/NullableValueRef/reset.adoc[`reset`] 
| Reset the target to the default constructed state (i&period;e&period;, to have the null value)&period;
| xref:BloombergLP/bdlb/NullableValueRef/value-04.adoc[`value`] 
| `value` overloads
| xref:BloombergLP/bdlb/NullableValueRef/valueOr.adoc[`valueOr`] 
| Return the value of the underlying object of a (template parameter) `TYPE` if this object is non&hyphen;null, and the specified `otherValue` otherwise&period; Note that this method returns _by_ _value_, so may be inefficient in some contexts&period;
| xref:BloombergLP/bdlb/NullableValueRef/valueOrNull.adoc[`valueOrNull`] 
| Return an address providing non&hyphen;modifiable access to the underlying object of a (template parameter) `TYPE` if this object is non&hyphen;null, and 0 otherwise&period;
| xref:BloombergLP/bdlb/NullableValueRef/value_or.adoc[`value&lowbar;or`] 
| Return the value of the underlying object of a (template parameter) `TYPE` if the target is non&hyphen;null, and the specified `default&lowbar;value` otherwise&period; Note that this method returns _by_ _value_, so may be inefficient in some contexts&period;
| xref:BloombergLP/bdlb/NullableValueRef/2conversion.adoc[`operator bool`] 
| Return `true` if the target holds a value, and `false` otherwise&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlb/ConstNullableValueRef.adoc[BloombergLP::bdlb::ConstNullableValueRef]`
| This class is a wrapper for either a `bsl&colon;&colon;optional` or `NullableAllocatedValue`, and provides non&hyphen;modifiable access to the wrapped object&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlb/operator_not_eq-00d.adoc[`operator!&equals;`]
| See the overload above for contract&period;
| xref:BloombergLP/bdlb/operator_not_eq-00fa.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` and `rhs` objects do not have the same value, and `false` otherwise&period; 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&period; Note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_not_eq-076.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` is not null, and `false` otherwise&period;
| xref:BloombergLP/bdlb/operator_not_eq-0d.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` and `rhs` nullable objects do not have the same value, and `false` otherwise&period; Two nullable wrappers do not have the same value if one is null and the other is non&hyphen;null, or if both are non&hyphen;null and the values of their underlying objects do not compare equal&period; Note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_lt-020.adoc[`operator&lt;`]
| Return `false`&period; `bsl&colon;&colon;nullopt` never orders after a `NullableValueRef`&period;
| xref:BloombergLP/bdlb/operator_lt-02f.adoc[`operator&lt;`]
| Return `true` if the specified `lhs` nullable wrapper is ordered before the specified `rhs`, and `false` otherwise&period; `lhs` is ordered before `rhs` if `lhs` is null or `lhs&period;value()` is ordered before `rhs`&period;
| xref:BloombergLP/bdlb/operator_lt-037.adoc[`operator&lt;`]
| Return `true` if the specified `lhs` nullable wrapper is ordered before the specified `rhs` nullable object, and `false` otherwise&period; `lhs` is ordered before `rhs` if `lhs` is null and `rhs` is non&hyphen;null or if both are non&hyphen;null and `lhs&period;value()` is ordered before `rhs&period;value()`&period; Note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_lt-0f0.adoc[`operator&lt;`]
| See the overload above for contract&period;
| xref:BloombergLP/bdlb/operator_le-03f.adoc[`operator&lt;&equals;`]
| 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&period; (See `operator&lt;` and `operator&equals;&equals;`&period;) Note that this operator returns `!(rhs &lt; lhs)`&period;
| xref:BloombergLP/bdlb/operator_le-07.adoc[`operator&lt;&equals;`]
| See the overload above for contract&period;
| xref:BloombergLP/bdlb/operator_le-0fd.adoc[`operator&lt;&equals;`]
| 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&period; (See `operator&lt;` and `operator&equals;&equals;`&period;) Note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_le-0ff.adoc[`operator&lt;&equals;`]
| Return `true` if the specified `lhs` is null, and `false` otherwise&period;
| xref:BloombergLP/bdlb/operator_eq-013ae.adoc[`operator&equals;&equals;`]
| Return `true` if the specified `lhs` is null, and `false` otherwise&period;
| xref:BloombergLP/bdlb/operator_eq-06d.adoc[`operator&equals;&equals;`]
| See the overload above for contract&period;
| xref:BloombergLP/bdlb/operator_eq-07f.adoc[`operator&equals;&equals;`]
| Return `true` if the specified `lhs` and `rhs` nullable wrappers have the same value, and `false` otherwise&period; Two nullable wrappers have the same value if both targets are null, or if both are non&hyphen;null and the values of their underlying objects compare equal&period; Note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_eq-0a9.adoc[`operator&equals;&equals;`]
| Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise&period; A nullable wrapper and a value of some type have the same value if the nullable wrapper is non&hyphen;null and the underlying value of it&apos;s target compares equal to the other value&period; Note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_gt-0110.adoc[`operator&gt;`]
| See the overload above for contract&period;
| xref:BloombergLP/bdlb/operator_gt-0c5e.adoc[`operator&gt;`]
| Return `true` if the specified `lhs` nullable wrapper is ordered after the specified `rhs` nullable object, and `false` otherwise&period; `lhs` is ordered after `rhs` if `lhs` is non&hyphen;null and `rhs` is null or if both are non&hyphen;null and `lhs&period;value()` is ordered after `rhs&period;value()`&period; Note that this operator returns `rhs &lt; lhs` when both operands are of `bsl&colon;&colon;optional` type&period; Also note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_gt-0e.adoc[`operator&gt;`]
| Return `true` if the specified `lhs` nullable wrapper is ordered after the specified `rhs`, and `false` otherwise&period; `lhs` is ordered after `rhs` if `lhs` is not null and `lhs&period;value()` is ordered after `rhs`&period; Note that this operator returns `rhs &lt; lhs`&period;
| xref:BloombergLP/bdlb/operator_gt-0f5.adoc[`operator&gt;`]
| Return `true` if the specified `lhs` is not null, and `false` otherwise&period;
| xref:BloombergLP/bdlb/operator_ge-037.adoc[`operator&gt;&equals;`]
| 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&period; (See `operator&gt;` and `operator&equals;&equals;`&period;) Note that this operator returns `!(lhs &lt; rhs)`&period;
| xref:BloombergLP/bdlb/operator_ge-03d.adoc[`operator&gt;&equals;`]
| See the overload above for contract&period;
| xref:BloombergLP/bdlb/operator_ge-05d.adoc[`operator&gt;&equals;`]
| 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&period; (See `operator&gt;` and `operator&equals;&equals;`&period;) Note that this operator returns `!(lhs &lt; rhs)` when both operands are of `bsl&colon;&colon;optional` type&period; Also note that this function will fail to compile if `LHS&lowbar;TYPE` and `RHS&lowbar;TYPE` are not compatible&period;
| xref:BloombergLP/bdlb/operator_ge-0e.adoc[`operator&gt;&equals;`]
| Return `true`&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
