[#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‐of‐place. == Synopsis Declared in `<bdlb_nullableallocatedvalue.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class NullableAllocatedValue; ---- == Description This template class extends the set of values of its value‐semantic `TYPE` parameter to include the notion of a "null" value. If `TYPE` is fully value‐semantic, then the augmented type `NullableAllocatedValue<TYPE>` will be as well. In addition to supporting all homogeneous value‐semantic operations, conversions between comparable underlying value types is also supported. 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‐null values compare equal. Attempts to copy construct, copy assign, or compare incompatible values types will fail to compile. The `NullableAllocatedValue` template can be instantiated on an incomplete type, but it cannot be instantiated on a type that overloads `operator&`. == 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. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/NullableAllocatedValue/2constructor-0bd.adoc[`NullableAllocatedValue`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlb/NullableAllocatedValue/2destructor.adoc[`~NullableAllocatedValue`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/bdlb/NullableAllocatedValue/operator_assign-0b.adoc[`operator=`] | Assignment operators | xref:BloombergLP/bdlb/NullableAllocatedValue/addressOr.adoc[`addressOr`] | Return the address of the contained value, or `address` if null. | xref:BloombergLP/bdlb/NullableAllocatedValue/allocator.adoc[`allocator`] | Return the allocator used by this object to supply memory. | xref:BloombergLP/bdlb/NullableAllocatedValue/bdexStreamIn.adoc[`bdexStreamIn`] | Assign to this object the value read from the specified input `stream`. | xref:BloombergLP/bdlb/NullableAllocatedValue/bdexStreamOut.adoc[`bdexStreamOut`] | Write this object to the specified output `stream`. | xref:BloombergLP/bdlb/NullableAllocatedValue/emplace-01.adoc[`emplace`] | Destroy any contained value and construct a new one in place. | xref:BloombergLP/bdlb/NullableAllocatedValue/get_allocator.adoc[`get_allocator`] | Return the allocator used by this object to supply memory. | xref:BloombergLP/bdlb/NullableAllocatedValue/has_value.adoc[`has_value`] | Return `true` if this object contains a value, and `false` otherwise. | xref:BloombergLP/bdlb/NullableAllocatedValue/isNull.adoc[`isNull`] | Return `false` if this object contains a value, and `true` otherwise. Note that this is the opposite of `has_value`. | 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. | xref:BloombergLP/bdlb/NullableAllocatedValue/maxSupportedBdexVersion-03.adoc[`maxSupportedBdexVersion`] | `maxSupportedBdexVersion` overloads | xref:BloombergLP/bdlb/NullableAllocatedValue/operator_star-0d.adoc[`operator*`] | Dereference operators | xref:BloombergLP/bdlb/NullableAllocatedValue/operator_ptr-0f.adoc[`operator‐>`] | Member access operators | xref:BloombergLP/bdlb/NullableAllocatedValue/print.adoc[`print`] | Format this object to the specified output `stream`. | xref:BloombergLP/bdlb/NullableAllocatedValue/reset.adoc[`reset`] | Reset this object to the default constructed state (i.e., to have the null value). | xref:BloombergLP/bdlb/NullableAllocatedValue/swap.adoc[`swap`] | Exchange the values of this object and `other`. | 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. | xref:BloombergLP/bdlb/NullableAllocatedValue/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/NullableAllocatedValue/value_or.adoc[`value_or`] | Return the contained value, or `default_value` if this object is null. | xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-06.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<NullableAllocatedValue, HasPrintMethod>`] | Declare that `NullableAllocatedValue` provides a `print` method. | xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-07.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<NullableAllocatedValue, IsBitwiseMoveable>`] | Declare `NullableAllocatedValue` as bitwise moveable when `TYPE` is. | xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-0e.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<NullableAllocatedValue, UsesBslmaAllocator>`] | Declare that `NullableAllocatedValue` uses a `bslma` allocator. | xref:BloombergLP/bdlb/NullableAllocatedValue/2conversion-02.adoc[`operator bool`] | Return `true` if this object is contains a value, and `true` otherwise. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/operator_not_eq-005.adoc[`operator!=`] | Return whether the operands do not have the same value. | xref:BloombergLP/bdlb/operator_not_eq-011.adoc[`operator!=`] | Return whether the operands do not have the same value. | xref:BloombergLP/bdlb/operator_not_eq-052.adoc[`operator!=`] | Return `true` if the specified `lhs` is not null, and `false` otherwise. | xref:BloombergLP/bdlb/operator_not_eq-0f.adoc[`operator!=`] | Return whether the operands do not have the same value. | xref:BloombergLP/bdlb/operator_lt-015.adoc[`operator<`] | Return `false`. Note that `bsl::nullopt` never orders after a `NullableAllocatedValue`. | xref:BloombergLP/bdlb/operator_lt-02d.adoc[`operator<`] | Return whether the left‐hand operand is ordered before the right. | xref:BloombergLP/bdlb/operator_lt-057.adoc[`operator<`] | Return whether the left‐hand operand is ordered before the right. | xref:BloombergLP/bdlb/operator_lt-094.adoc[`operator<`] | Return whether the left‐hand operand is ordered before the right. | xref:BloombergLP/bdlb/operator_le-00.adoc[`operator<=`] | Return `true` if the specified `lhs` is null, and `false` otherwise. | xref:BloombergLP/bdlb/operator_le-081.adoc[`operator<=`] | Return whether the left‐hand operand is before or equal to the right. | xref:BloombergLP/bdlb/operator_le-08f.adoc[`operator<=`] | Return whether the left‐hand operand is before or equal to the right. | xref:BloombergLP/bdlb/operator_le-0c1.adoc[`operator<=`] | Return whether the left‐hand operand is before or equal to the right. | xref:BloombergLP/bdlb/operator_eq-03c1.adoc[`operator==`] | Return whether the operands have the same value. | xref:BloombergLP/bdlb/operator_eq-056.adoc[`operator==`] | Return whether the specified nullable value is null. | xref:BloombergLP/bdlb/operator_eq-078.adoc[`operator==`] | Return whether the operands have the same value. | xref:BloombergLP/bdlb/operator_eq-0c3.adoc[`operator==`] | Return whether the operands have the same value. | xref:BloombergLP/bdlb/operator_gt-051.adoc[`operator>`] | Return whether the left‐hand operand is ordered after the right. | xref:BloombergLP/bdlb/operator_gt-054.adoc[`operator>`] | Return whether the left‐hand operand is ordered after the right. | xref:BloombergLP/bdlb/operator_gt-07b.adoc[`operator>`] | Return whether the left‐hand operand is ordered after the right. | xref:BloombergLP/bdlb/operator_gt-07e.adoc[`operator>`] | Return `true` if the specified `lhs` is not null, and `false` otherwise. | xref:BloombergLP/bdlb/operator_ge-003.adoc[`operator>=`] | Return `true`. | xref:BloombergLP/bdlb/operator_ge-04.adoc[`operator>=`] | Return whether the left‐hand operand is after or equal to the right. | xref:BloombergLP/bdlb/operator_ge-060.adoc[`operator>=`] | Return whether the left‐hand operand is after or equal to the right. | xref:BloombergLP/bdlb/operator_ge-0cf2.adoc[`operator>=`] | Return whether the left‐hand operand is after or equal to the right. | xref:BloombergLP/bdlb/swap-07.adoc[`swap`] | Exchange the values of two nullable objects. | xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueAccessValue-00.adoc[`::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueAccessValue`] | Invoke `accessor` on the non‐null value held by `object`. | xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueIsNull-06.adoc[`::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueIsNull`] | Default customization‐point implementation of `isNull` for `bdlb::NullableAllocatedValue`. | xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueMakeValue-05.adoc[`::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueMakeValue`] | Default customization‐point implementation of `makeValue` for `bdlb::NullableAllocatedValue`. | xref:BloombergLP/bdlat_NullableValueFunctions/bdlat_nullableValueManipulateValue-04f.adoc[`::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueManipulateValue`] | Default customization‐point implementation of `manipulateValue` for `bdlb::NullableAllocatedValue`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#