[#beman-optional-optional-03]
= xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::optional
:relfileprefix: ../../
:mrdocs:

== Synopsis

Declared in `&lt;beman&sol;optional&sol;optional&period;hpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class T&gt;
class optional;
----

== Types

[cols=2]
|===
| Name
| Description
| xref:beman/optional/optional-03/const_iterator.adoc[`const&lowbar;iterator`] 
| Type alias for the const iterator type of the optional&period;
| xref:beman/optional/optional-03/iterator.adoc[`iterator`] 
| Type alias for the iterator type of the optional&period;
| xref:beman/optional/optional-03/value_type.adoc[`value&lowbar;type`] 
| Type alias for the value type stored in the optional&period;
|===

== Member Functions

[cols=2]
|===
| Name
| Description
| xref:beman/optional/optional-03/2constructor-026.adoc[`optional`]         [.small]#[constructor]#
| Constructors
| xref:beman/optional/optional-03/2destructor-0b.adoc[`&#126;optional`] [.small]#[destructor]#
| Destructs the optional&period;
| xref:beman/optional/optional-03/2destructor-0e.adoc[`&#126;optional`] [.small]#[destructor]#
| Destroys the optional and its value if it has one&period;
| xref:beman/optional/optional-03/operator_assign-01.adoc[`operator&equals;`] 
| Assignment operators
| xref:beman/optional/optional-03/and_then-02.adoc[`and&lowbar;then`] 
| Returns an optional containing the result of applying `f` to the stored value&period;
| 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&lowbar;value`] 
| Returns whether or not the optional has a value&period;
| xref:beman/optional/optional-03/operator_star-03.adoc[`operator&ast;`] 
| Returns a reference to the stored value&period;
| xref:beman/optional/optional-03/operator_ptr-094.adoc[`operator&hyphen;&gt;`] 
| Returns a pointer to the stored value&period;
| xref:beman/optional/optional-03/or_else-01.adoc[`or&lowbar;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&period;
| xref:beman/optional/optional-03/reset.adoc[`reset`] 
| Resets the optional to an empty state, destroying the stored value if there is one&period;
| xref:beman/optional/optional-03/swap.adoc[`swap`] 
| Swaps this optional with the other&period;
| 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&period;
| xref:beman/optional/optional-03/value-028.adoc[`value`] 
| Returns a reference to the stored value&period;
| xref:beman/optional/optional-03/value_or-03.adoc[`value&lowbar;or`] 
| Returns a reference to the stored value&period;
| xref:beman/optional/optional-03/2conversion.adoc[`operator bool`] 
| Converts the optional to a boolean indicating whether it has a value&period;
|===

== Data Members

[cols=2]
|===
| Name
| Description
| xref:beman/optional/optional-03/_.adoc[`&lowbar;`] [.small]#[variant member]#
| The empty state of the optional&period;
| xref:beman/optional/optional-03/value_.adoc[`value&lowbar;`] [.small]#[variant member]#
| The stored value of the optional&period;
|===

== Friends

[cols=2]
|===
| Name
| Description
| `xref:beman/optional/optional-03.adoc[beman::optional::optional]`
| 
|===

== Template Parameters

[cols=2]
|===
| Name
| Description
| *T*
| 
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
