Template for a nullable TYPE that may be allocated out‐of‐place.

Synopsis

Declared in <bdlb_nullableallocatedvalue.h>

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

Name

Description

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

Name

Description

NullableAllocatedValue [constructor]

Constructors

~NullableAllocatedValue [destructor]

Destroy this object.

operator=

Assignment operators

addressOr

Return the address of the contained value, or address if null.

allocator

Return the allocator used by this object to supply memory.

bdexStreamIn

Assign to this object the value read from the specified input stream.

bdexStreamOut

Write this object to the specified output stream.

emplace

Destroy any contained value and construct a new one in place.

get_allocator

Return the allocator used by this object to supply memory.

has_value

Return true if this object contains a value, and false otherwise.

isNull

Return false if this object contains a value, and true otherwise. Note that this is the opposite of has_value.

makeValue

makeValue overloads

makeValueInplace

Destroy any contained value and construct a new one in place.

maxSupportedBdexVersion

maxSupportedBdexVersion overloads

operator*

Dereference operators

operator‐>

Member access operators

print

Format this object to the specified output stream.

reset

Reset this object to the default constructed state (i.e., to have the null value).

swap

Exchange the values of this object and other.

value

value overloads

valueOr

Return the contained value, or otherValue if this object is null.

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 contained value, or default_value if this object is null.

operator BloombergLP::bslmf::NestedTraitDeclaration<NullableAllocatedValue, HasPrintMethod>

Declare that NullableAllocatedValue provides a print method.

operator BloombergLP::bslmf::NestedTraitDeclaration<NullableAllocatedValue, IsBitwiseMoveable>

Declare NullableAllocatedValue as bitwise moveable when TYPE is.

operator BloombergLP::bslmf::NestedTraitDeclaration<NullableAllocatedValue, UsesBslmaAllocator>

Declare that NullableAllocatedValue uses a bslma allocator.

operator bool

Return true if this object is contains a value, and true otherwise.

Non-Member Functions

Name

Description

operator!=

Return whether the operands do not have the same value.

operator!=

Return whether the operands do not have the same value.

operator!=

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

operator!=

Return whether the operands do not have the same value.

operator<

Return false. Note that bsl::nullopt never orders after a NullableAllocatedValue.

operator<

Return whether the left‐hand operand is ordered before the right.

operator<

Return whether the left‐hand operand is ordered before the right.

operator<

Return whether the left‐hand operand is ordered before the right.

operator<=

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

operator<=

Return whether the left‐hand operand is before or equal to the right.

operator<=

Return whether the left‐hand operand is before or equal to the right.

operator<=

Return whether the left‐hand operand is before or equal to the right.

operator==

Return whether the operands have the same value.

operator==

Return whether the specified nullable value is null.

operator==

Return whether the operands have the same value.

operator==

Return whether the operands have the same value.

operator>

Return whether the left‐hand operand is ordered after the right.

operator>

Return whether the left‐hand operand is ordered after the right.

operator>

Return whether the left‐hand operand is ordered after the right.

operator>

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

operator>=

Return true.

operator>=

Return whether the left‐hand operand is after or equal to the right.

operator>=

Return whether the left‐hand operand is after or equal to the right.

operator>=

Return whether the left‐hand operand is after or equal to the right.

swap

Exchange the values of two nullable objects.

::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueAccessValue

Invoke accessor on the non‐null value held by object.

::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueIsNull

Default customization‐point implementation of isNull for bdlb::NullableAllocatedValue.

::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueMakeValue

Default customization‐point implementation of makeValue for bdlb::NullableAllocatedValue.

::BloombergLP::bdlat_NullableValueFunctions::bdlat_nullableValueManipulateValue

Default customization‐point implementation of manipulateValue for bdlb::NullableAllocatedValue.

Created with MrDocs