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

Template for a nullable `TYPE` that may be allocated out&hyphen;of&hyphen;place&period;

== Synopsis

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

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

== Description

This template class extends the set of values of its value&hyphen;semantic `TYPE` parameter to include the notion of a &quot;null&quot; value&period; If `TYPE` is fully value&hyphen;semantic, then the augmented type `NullableAllocatedValue&lt;TYPE&gt;` will be as well&period; In addition to supporting all homogeneous value&hyphen;semantic operations, conversions between comparable underlying value types is also supported&period; Two nullable objects with different underlying types compare equal if their underlying types are comparable and either (1) both objects are null or (2) the non&hyphen;null values compare equal&period; Attempts to copy construct, copy assign, or compare incompatible values types will fail to compile&period; The `NullableAllocatedValue` template can be instantiated on an incomplete type, but it cannot be instantiated on a type that overloads `operator&amp;`&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlb/NullableAllocatedValue/ValueType.adoc[`ValueType`] 
| `ValueType` is an alias for the underlying `TYPE` upon which this template class is instantiated, and represents the type of the managed object&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlb/NullableAllocatedValue/2constructor-0bd.adoc[`NullableAllocatedValue`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlb/NullableAllocatedValue/2destructor.adoc[`&#126;NullableAllocatedValue`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/operator_assign-0b.adoc[`operator&equals;`] 
| Assignment operators
| xref:BloombergLP/bdlb/NullableAllocatedValue/addressOr.adoc[`addressOr`] 
| Return the address of the contained value, or `address` if null&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/allocator.adoc[`allocator`] 
| Return the allocator used by this object to supply memory&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/bdexStreamIn.adoc[`bdexStreamIn`] 
| Assign to this object the value read from the specified input `stream`&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/bdexStreamOut.adoc[`bdexStreamOut`] 
| Write this object to the specified output `stream`&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/emplace-01.adoc[`emplace`] 
| Destroy any contained value and construct a new one in place&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/get_allocator.adoc[`get&lowbar;allocator`] 
| Return the allocator used by this object to supply memory&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/has_value.adoc[`has&lowbar;value`] 
| Return `true` if this object contains a value, and `false` otherwise&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/isNull.adoc[`isNull`] 
| Return `false` if this object contains a value, and `true` otherwise&period; Note that this is the opposite of `has&lowbar;value`&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/makeValue-08.adoc[`makeValue`] 
| `makeValue` overloads
| xref:BloombergLP/bdlb/NullableAllocatedValue/makeValueInplace.adoc[`makeValueInplace`] 
| Destroy any contained value and construct a new one in place&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/maxSupportedBdexVersion-03.adoc[`maxSupportedBdexVersion`] 
| `maxSupportedBdexVersion` overloads
| xref:BloombergLP/bdlb/NullableAllocatedValue/operator_star-0d.adoc[`operator&ast;`] 
| Dereference operators
| xref:BloombergLP/bdlb/NullableAllocatedValue/operator_ptr-0f.adoc[`operator&hyphen;&gt;`] 
| Member access operators
| xref:BloombergLP/bdlb/NullableAllocatedValue/print.adoc[`print`] 
| Format this object to the specified output `stream`&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/reset.adoc[`reset`] 
| Reset this object to the default constructed state (i&period;e&period;, to have the null value)&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/swap.adoc[`swap`] 
| Exchange the values of this object and `other`&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/value-00.adoc[`value`] 
| `value` overloads
| xref:BloombergLP/bdlb/NullableAllocatedValue/valueOr.adoc[`valueOr`] 
| Return the contained value, or `otherValue` if this object is null&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/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/NullableAllocatedValue/value_or.adoc[`value&lowbar;or`] 
| Return the contained value, or `default&lowbar;value` if this object is null&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-06.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;NullableAllocatedValue, HasPrintMethod&gt;`] 
| Declare that `NullableAllocatedValue` provides a `print` method&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-07.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;NullableAllocatedValue, IsBitwiseMoveable&gt;`] 
| Declare `NullableAllocatedValue` as bitwise moveable when `TYPE` is&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-0e.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;NullableAllocatedValue, UsesBslmaAllocator&gt;`] 
| Declare that `NullableAllocatedValue` uses a `bslma` allocator&period;
| xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-02.adoc[`operator bool`] 
| Return `true` if this object is contains a value, and `true` otherwise&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlb/operator_not_eq-005.adoc[`operator!&equals;`]
| Return whether the operands do not have the same value&period;
| xref:BloombergLP/bdlb/operator_not_eq-011.adoc[`operator!&equals;`]
| Return whether the operands do not have the same value&period;
| xref:BloombergLP/bdlb/operator_not_eq-052.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` is not null, and `false` otherwise&period;
| xref:BloombergLP/bdlb/operator_not_eq-0f.adoc[`operator!&equals;`]
| Return whether the operands do not have the same value&period;
| xref:BloombergLP/bdlb/operator_lt-015.adoc[`operator&lt;`]
| Return `false`&period; Note that `bsl&colon;&colon;nullopt` never orders after a `NullableAllocatedValue`&period;
| xref:BloombergLP/bdlb/operator_lt-02d.adoc[`operator&lt;`]
| Return whether the left&hyphen;hand operand is ordered before the right&period;
| xref:BloombergLP/bdlb/operator_lt-057.adoc[`operator&lt;`]
| Return whether the left&hyphen;hand operand is ordered before the right&period;
| xref:BloombergLP/bdlb/operator_lt-094.adoc[`operator&lt;`]
| Return whether the left&hyphen;hand operand is ordered before the right&period;
| xref:BloombergLP/bdlb/operator_le-00.adoc[`operator&lt;&equals;`]
| Return `true` if the specified `lhs` is null, and `false` otherwise&period;
| xref:BloombergLP/bdlb/operator_le-081.adoc[`operator&lt;&equals;`]
| Return whether the left&hyphen;hand operand is before or equal to the right&period;
| xref:BloombergLP/bdlb/operator_le-08f.adoc[`operator&lt;&equals;`]
| Return whether the left&hyphen;hand operand is before or equal to the right&period;
| xref:BloombergLP/bdlb/operator_le-0c1.adoc[`operator&lt;&equals;`]
| Return whether the left&hyphen;hand operand is before or equal to the right&period;
| xref:BloombergLP/bdlb/operator_eq-03c1.adoc[`operator&equals;&equals;`]
| Return whether the operands have the same value&period;
| xref:BloombergLP/bdlb/operator_eq-056.adoc[`operator&equals;&equals;`]
| Return whether the specified nullable value is null&period;
| xref:BloombergLP/bdlb/operator_eq-078.adoc[`operator&equals;&equals;`]
| Return whether the operands have the same value&period;
| xref:BloombergLP/bdlb/operator_eq-0c3.adoc[`operator&equals;&equals;`]
| Return whether the operands have the same value&period;
| xref:BloombergLP/bdlb/operator_gt-051.adoc[`operator&gt;`]
| Return whether the left&hyphen;hand operand is ordered after the right&period;
| xref:BloombergLP/bdlb/operator_gt-054.adoc[`operator&gt;`]
| Return whether the left&hyphen;hand operand is ordered after the right&period;
| xref:BloombergLP/bdlb/operator_gt-07b.adoc[`operator&gt;`]
| Return whether the left&hyphen;hand operand is ordered after the right&period;
| xref:BloombergLP/bdlb/operator_gt-07e.adoc[`operator&gt;`]
| Return `true` if the specified `lhs` is not null, and `false` otherwise&period;
| xref:BloombergLP/bdlb/operator_ge-003.adoc[`operator&gt;&equals;`]
| Return `true`&period;
| xref:BloombergLP/bdlb/operator_ge-04.adoc[`operator&gt;&equals;`]
| Return whether the left&hyphen;hand operand is after or equal to the right&period;
| xref:BloombergLP/bdlb/operator_ge-060.adoc[`operator&gt;&equals;`]
| Return whether the left&hyphen;hand operand is after or equal to the right&period;
| xref:BloombergLP/bdlb/operator_ge-0cf2.adoc[`operator&gt;&equals;`]
| Return whether the left&hyphen;hand operand is after or equal to the right&period;
| xref:BloombergLP/bdlb/swap-07.adoc[`swap`]
| Exchange the values of two nullable objects&period;
| xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueAccessValue-00.adoc[`&colon;&colon;BloombergLP&colon;&colon;bdlat&lowbar;NullableValueFunctions&colon;&colon;bdlat&lowbar;nullableValueAccessValue`]
| Invoke `accessor` on the non&hyphen;null value held by `object`&period;
| xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueIsNull-06.adoc[`&colon;&colon;BloombergLP&colon;&colon;bdlat&lowbar;NullableValueFunctions&colon;&colon;bdlat&lowbar;nullableValueIsNull`]
| Default customization&hyphen;point implementation of `isNull` for `bdlb&colon;&colon;NullableAllocatedValue`&period;
| xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueMakeValue-05.adoc[`&colon;&colon;BloombergLP&colon;&colon;bdlat&lowbar;NullableValueFunctions&colon;&colon;bdlat&lowbar;nullableValueMakeValue`]
| Default customization&hyphen;point implementation of `makeValue` for `bdlb&colon;&colon;NullableAllocatedValue`&period;
| xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueManipulateValue-04f.adoc[`&colon;&colon;BloombergLP&colon;&colon;bdlat&lowbar;NullableValueFunctions&colon;&colon;bdlat&lowbar;nullableValueManipulateValue`]
| Default customization&hyphen;point implementation of `manipulateValue` for `bdlb&colon;&colon;NullableAllocatedValue`&period;
|===


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