Component‐private class template implementing bsl::optional.

Synopsis

Declared in <bslstl_optional.h>

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

Name

Description

allocator_type

This typedef is an alias to bsl::allocator<char>.

value_type

Alias for the managed object type of this optional.

Member Functions

Name

Description

operator=

Assignment operators

emplace

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

get_allocator

Return allocator used for construction of value_type.

has_value

Return false if this object is disengaged, and true otherwise.

operator*

Dereference operators

operator‐>

Member access operators

reset

Reset this object to the default constructed state (i.e., to a disengaged state).

swap

Exchange the values of two optionals.

value

value overloads

value_or

Return the contained value, or a converted fallback if disengaged.

operator BloombergLP::bslmf::NestedTraitDeclaration<Optional_Base, IsBitwiseCopyable, BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value>

Nested trait declaration for bslmf::IsBitwiseCopyable.

operator BloombergLP::bslmf::NestedTraitDeclaration<Optional_Base, IsBitwiseMoveable, BloombergLP::bslmf::IsBitwiseMoveable<t_TYPE>::value>

Nested trait declaration for bslmf::IsBitwiseMoveable.

operator BloombergLP::bslmf::NestedTraitDeclaration<Optional_Base, UsesAllocatorArgT>

Nested trait declaration for bslmf::UsesAllocatorArgT.

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

Nested trait declaration for bslma::UsesBslmaAllocator.

operator bool

Return false if this object is disengaged, and true otherwise.

Protected Type Aliases

Name

Description

AllocType

This typedef is an alias to allocator_type.

Protected Member Functions

Name

Description

Optional_Base [constructor]

Constructors

assignOrEmplace

Assign or emplace a value into this optional.

dereferenceRaw

Return a reference to the contained value without checking engagement.

Specializations

Name

Description

Optional_Base<t_TYPE, false>

Specialization of Optional_Base for value_type that is not allocator‐aware when std::optional is available.

Derived Classes

Name

Description

optional

Allocator‐aware nullable wrapper for an object of type t_TYPE.

Created with MrDocs