Synopsis

Declared in <beman/optional/optional.hpp>

template<class T>
class optional;

Types

Name

Description

const_iterator

Type alias for the const iterator type of the optional.

iterator

Type alias for the iterator type of the optional.

value_type

Type alias for the value type stored in the optional.

Member Functions

Name

Description

optional [constructor]

Constructors

~optional [destructor]

Destructs the optional.

~optional [destructor]

Destroys the optional and its value if it has one.

operator=

Assignment operators

and_then

Returns an optional containing the result of applying f to the stored value.

begin

begin overloads

emplace

emplace overloads

end

end overloads

has_value

Returns whether or not the optional has a value.

operator*

Returns a reference to the stored value.

operator‐>

Returns a pointer to the stored value.

or_else

Returns an optional containing the stored value if it has one, or the result of applying f to the optional if it does not.

reset

Resets the optional to an empty state, destroying the stored value if there is one.

swap

Swaps this optional with the other.

transform

Returns an optional containing the result of applying f to the stored value, or a default value if there is no stored value.

value

Returns a reference to the stored value.

value_or

Returns a reference to the stored value.

operator bool

Converts the optional to a boolean indicating whether it has a value.

Data Members

Name

Description

_ [variant member]

The empty state of the optional.

value_ [variant member]

The stored value of the optional.

Friends

Name

Description

beman::optional::optional

Template Parameters

Name

Description

T

Created with MrDocs