[#beman-optional-optional-03] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::optional :relfileprefix: ../../ :mrdocs: == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> class optional; ---- == Types [cols=2] |=== | Name | Description | xref:beman/optional/optional-03/const_iterator.adoc[`const_iterator`] | Type alias for the const iterator type of the optional. | xref:beman/optional/optional-03/iterator.adoc[`iterator`] | Type alias for the iterator type of the optional. | xref:beman/optional/optional-03/value_type.adoc[`value_type`] | Type alias for the value type stored in the optional. |=== == Member Functions [cols=2] |=== | Name | Description | xref:beman/optional/optional-03/2constructor-026.adoc[`optional`] [.small]#[constructor]# | Constructors | xref:beman/optional/optional-03/2destructor-01.adoc[`~optional`] [.small]#[destructor]# | Destructors | xref:beman/optional/optional-03/operator_assign-01.adoc[`operator=`] | Assignment operators | xref:beman/optional/optional-03/and_then-02.adoc[`and_then`] | Returns an optional containing the result of applying `f` to the stored value. | xref:beman/optional/optional-03/begin-09.adoc[`begin`] | `begin` overloads | xref:beman/optional/optional-03/emplace-07.adoc[`emplace`] | `emplace` overloads | xref:beman/optional/optional-03/end-01.adoc[`end`] | `end` overloads | xref:beman/optional/optional-03/has_value.adoc[`has_value`] | Returns whether or not the optional has a value. | xref:beman/optional/optional-03/operator_star-03.adoc[`operator*`] | Returns a reference to the stored value. | xref:beman/optional/optional-03/operator_ptr-094.adoc[`operator‐>`] | Returns a pointer to the stored value. | xref:beman/optional/optional-03/or_else-01.adoc[`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. | xref:beman/optional/optional-03/reset.adoc[`reset`] | Resets the optional to an empty state, destroying the stored value if there is one. | xref:beman/optional/optional-03/swap.adoc[`swap`] | Swaps this optional with the other. | xref:beman/optional/optional-03/transform-08.adoc[`transform`] | Returns an optional containing the result of applying `f` to the stored value, or a default value if there is no stored value. | xref:beman/optional/optional-03/value-028.adoc[`value`] | Returns a reference to the stored value. | xref:beman/optional/optional-03/value_or-03.adoc[`value_or`] | Returns a reference to the stored value. | xref:beman/optional/optional-03/2conversion.adoc[`operator bool`] | Converts the optional to a boolean indicating whether it has a value. |=== == Data Members [cols=2] |=== | Name | Description | xref:beman/optional/optional-03/_.adoc[`_`] [.small]#[variant member]# | The empty state of the optional. | xref:beman/optional/optional-03/value_.adoc[`value_`] [.small]#[variant member]# | The stored value of the optional. |=== == Friends [cols=2] |=== | Name | Description | `beman::optional::optional` | |=== == Non-Member Functions [cols=2] |=== | Name | Description | xref:beman/optional/operator_not_eq-0d8.adoc[`operator!=`] | Inequality operator | xref:beman/optional/operator_not_eq-0e.adoc[`operator!=`] | Inequality operator | xref:beman/optional/operator_lt-08.adoc[`operator<`] | Less‐than operator | xref:beman/optional/operator_lt-0d.adoc[`operator<`] | Less‐than operator | xref:beman/optional/operator_le-01.adoc[`operator<=`] | Less‐than‐or‐equal operator | xref:beman/optional/operator_le-0f.adoc[`operator<=`] | Less‐than‐or‐equal operator | xref:beman/optional/operator_3way-02.adoc[`operator<=>`] | Three‐way comparison operator | xref:beman/optional/operator_3way-09.adoc[`operator<=>`] | Three‐way comparison operator | xref:beman/optional/operator_3way-0a.adoc[`operator<=>`] | Three‐way comparison operator | xref:beman/optional/operator_eq-00.adoc[`operator==`] | Equality operator | xref:beman/optional/operator_eq-08.adoc[`operator==`] | Equality operator | xref:beman/optional/operator_eq-09.adoc[`operator==`] | Equality operator | xref:beman/optional/operator_gt-08.adoc[`operator>`] | Greater‐than operator | xref:beman/optional/operator_gt-0d.adoc[`operator>`] | Greater‐than operator | xref:beman/optional/operator_ge-00.adoc[`operator>=`] | Greater‐than‐or‐equal operator | xref:beman/optional/operator_ge-0f.adoc[`operator>=`] | Greater‐than‐or‐equal operator |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#