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

Synopsis

Declared in <bslstl_optional.h>

template<class t_TYPE>
class optional
    : public BloombergLP::bslstl::Optional_Base<t_TYPE>

Base Classes

Name

Description

BloombergLP::bslstl::Optional_Base<t_TYPE>

Component‐private class template implementing bsl::optional.

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

optional [constructor]

Constructors

operator=

Assignment operators

and_then

and_then overloads

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

or_else

Return this optional if engaged; otherwise invoke func.

reset

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

swap

Exchange the values of two optionals.

transform

transform overloads

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 BloombergLP::bslmf::NestedTraitDeclaration<optional, IsBitwiseCopyable, BloombergLP::bslmf::IsBitwiseCopyable<t_TYPE>::value>

Nested trait declaration for bslmf::IsBitwiseCopyable.

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

Nested trait declaration for bslmf::IsBitwiseMoveable.

operator BloombergLP::bslmf::NestedTraitDeclaration<optional, UsesAllocatorArgT, BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>

Nested trait declaration for bslmf::UsesAllocatorArgT.

operator BloombergLP::bslmf::NestedTraitDeclaration<optional, UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value>

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

assignOrEmplace

Assign or emplace a value into this optional.

dereferenceRaw

Return a reference to the contained value without checking engagement.

Deduction Guides

Name

Description

optional<t_TYPE>

Deduce the specified type t_TYPE from the corresponding type supplied to the constructor of optional.

optional<t_TYPE>

Deduce t_TYPE for an allocator‐aware optional from a value.

optional<t_TYPE>

Deduce t_TYPE for an allocator‐aware optional from another optional.

Friends

Name

Description

bsl::optional

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

Non-Member Functions

Name

Description

PrintTo

Write the specified value to the specified *stream, surrounded by double quotes.

make_optional

Return an optional containing a value constructed from the arguments.

make_optional

Return an optional object containing a value‐initialized t_TYPE object.

make_optional

Return an optional containing a value constructed from the arguments.

make_optional

Return an optional containing a value constructed from the arguments.

make_optional

Return an optional containing a value constructed from the arguments.

make_optional

Return an optional containing a value constructed from the arguments.

make_optional

Return an optional containing a value constructed from the arguments.

operator!=

Return whether the operands do not have the same value.

operator!=

Return whether the operands do not have the same value.

operator!=

Return whether the operands do not have the same value.

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 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<=>

Perform a three‐way comparison of the operands.

operator<=>

Perform a three‐way comparison of the operands.

operator<=>

Perform a three‐way comparison of the operands.

operator<=>

Perform a three‐way comparison of the operands.

operator==

Return whether the operands have the same value.

operator==

Return whether the operands have the same value.

operator==

Compare a std::optional with a bsl::optional for equality.

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 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 optionals.

swap

Exchange the values of two optionals.

swap

Exchange the values of two optionals.

::BloombergLP::bdlb::nullableValue_acceptsBslOptional

Component‐private constraint helper for bsl::optional conversion.

::BloombergLP::bdlb::operator!=

Return true if the specified nullable objects do not have the same value.

::BloombergLP::bdlb::operator!=

Return true if the specified nullable objects do not have the same value.

::BloombergLP::bdlb::operator<

Return true if lhs is ordered before rhs, and false otherwise.

::BloombergLP::bdlb::operator<

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

::BloombergLP::bdlb::operator<=

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

::BloombergLP::bdlb::operator<=

Return true if lhs is ordered before rhs or they are equal.

::BloombergLP::bdlb::operator==

Return true if the specified nullable objects have the same value.

::BloombergLP::bdlb::operator==

Return true if the specified nullable objects have the same value, and false otherwise.

::BloombergLP::bdlb::operator>

Return true if lhs is ordered after rhs, and false otherwise.

::BloombergLP::bdlb::operator>

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

::BloombergLP::bdlb::operator>=

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

::BloombergLP::bdlb::operator>=

Return true if lhs is ordered after rhs or they are equal.

::BloombergLP::bslstl::optional_acceptsBslOptional

Component‐private constraint helper for Optional_DerivedFromBslOptional.

Derived Classes

Name

Description

NullableValue

Value‐semantic wrapper that adds a null state to TYPE.

Created with MrDocs