[#BloombergLP-bslstl-Optional_Base-05] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::Optional_Base :relfileprefix: ../../ :mrdocs: Component‐private class template implementing `bsl::optional`. == Synopsis Declared in `<bslstl_optional.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class t_TYPE, bool t_USES_BSLMA_ALLOC = BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value> class Optional_Base; ---- == Description This component‐private class template implements the functionality of `bsl::optional`. The primary template is instantiated when `TYPE` is allocator‐aware, and holds the allocator that is used to create the stored object. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Optional_Base-05/allocator_type.adoc[`allocator_type`] | This `typedef` is an alias to `bsl::allocator<char>`. | xref:BloombergLP/bslstl/Optional_Base-05/value_type.adoc[`value_type`] | Alias for the managed object type of this optional. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Optional_Base-05/operator_assign-09.adoc[`operator=`] | Assignment operators | xref:BloombergLP/bslstl/Optional_Base-05/emplace-02.adoc[`emplace`] | Destroy any contained value and construct a new one in place. | xref:BloombergLP/bslstl/Optional_Base-05/get_allocator.adoc[`get_allocator`] | Return allocator used for construction of `value_type`. | xref:BloombergLP/bslstl/Optional_Base-05/has_value.adoc[`has_value`] | Return `false` if this object is disengaged, and `true` otherwise. | xref:BloombergLP/bslstl/Optional_Base-05/operator_star-0b.adoc[`operator*`] | Dereference operators | xref:BloombergLP/bslstl/Optional_Base-05/operator_ptr-0a.adoc[`operator‐>`] | Member access operators | xref:BloombergLP/bslstl/Optional_Base-05/reset.adoc[`reset`] | Reset this object to the default constructed state (i.e., to a disengaged state). | xref:BloombergLP/bslstl/Optional_Base-05/swap.adoc[`swap`] | Exchange the values of two optionals. | xref:BloombergLP/bslstl/Optional_Base-05/value-07a.adoc[`value`] | `value` overloads | xref:BloombergLP/bslstl/Optional_Base-05/value_or-07.adoc[`value_or`] | Return the contained value, or a converted fallback if disengaged. | xref:BloombergLP/bslstl/Optional_Base-05/2conversion-076.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<Optional_Base, IsBitwiseCopyable, BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value>`] | Nested trait declaration for `bslmf::IsBitwiseCopyable`. | xref:BloombergLP/bslstl/Optional_Base-05/2conversion-04.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<Optional_Base, IsBitwiseMoveable, BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value>`] | Nested trait declaration for `bslmf::IsBitwiseMoveable`. | xref:BloombergLP/bslstl/Optional_Base-05/2conversion-0a.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<Optional_Base, UsesAllocatorArgT>`] | Nested trait declaration for `bslmf::UsesAllocatorArgT`. | xref:BloombergLP/bslstl/Optional_Base-05/2conversion-0b.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<Optional_Base, UsesBslmaAllocator>`] | Nested trait declaration for `bslma::UsesBslmaAllocator`. | xref:BloombergLP/bslstl/Optional_Base-05/2conversion-071.adoc[`operator bool`] | Return `false` if this object is disengaged, and `true` otherwise. |=== == Protected Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Optional_Base-05/AllocType.adoc[`AllocType`] | This `typedef` is an alias to `allocator_type`. |=== == Protected Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Optional_Base-05/2constructor-0f.adoc[`Optional_Base`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslstl/Optional_Base-05/assignOrEmplace.adoc[`assignOrEmplace`] | Assign or emplace a value into this optional. | xref:BloombergLP/bslstl/Optional_Base-05/dereferenceRaw-049.adoc[`dereferenceRaw`] | Return a reference to the contained value without checking engagement. |=== == Specializations [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Optional_Base-08.adoc[`Optional_Base<t_TYPE, false>`] | Specialization of `Optional_Base` for `value_type` that is not allocator‐aware when `std::optional` is available. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:bsl/optional-072.adoc[`optional`] | Allocator‐aware nullable wrapper for an object of type `t_TYPE`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#