[#beman-optional-optional-06]
= xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-03.adoc[optional]&lt;T&&gt;
:relfileprefix: ../../
:mrdocs:

A specialization of `optional` for references&period;

== 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 xref:beman/optional/optional-03.adoc[optional]&lt;T&&gt;;
----

== Types

[cols="1,4"]
|===
| Name| Description
| xref:beman/optional/optional-06/iterator.adoc[`iterator`] 
| The type of the iterator for the optional&period;
| xref:beman/optional/optional-06/value_type.adoc[`value&lowbar;type`] 
| The type of the value contained in the optional&period;
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:beman/optional/optional-06/2constructor-03.adoc[`optional`]         [.small]#[constructor]#
| Constructors
| xref:beman/optional/optional-06/2destructor.adoc[`&#126;optional`] [.small]#[destructor]#
| Destructor&period;
| xref:beman/optional/optional-06/operator_assign-0f.adoc[`operator&equals;`] 
| Assignment operators
| xref:beman/optional/optional-06/and_then.adoc[`and&lowbar;then`] 
| Applies a function to the contained value if there is one&period;
| xref:beman/optional/optional-06/begin.adoc[`begin`] 
| Returns an iterator to the beginning of the optional&period;
| xref:beman/optional/optional-06/emplace.adoc[`emplace`] 
| Emplaces a new value in the optional, destroying the current one if the optional is engaged&period;
| xref:beman/optional/optional-06/end.adoc[`end`] 
| Returns an iterator to the end of the optional&period;
| xref:beman/optional/optional-06/has_value.adoc[`has&lowbar;value`] 
| Checks if the optional has a value&period;
| xref:beman/optional/optional-06/operator_star.adoc[`operator&ast;`] 
| Returns a reference to the contained value&period;
| xref:beman/optional/optional-06/operator_ptr.adoc[`operator&hyphen;&gt;`] 
| Returns a pointer to the contained value&period;
| xref:beman/optional/optional-06/or_else.adoc[`or&lowbar;else`] 
| Calls a function if the optional is empty&period;
| xref:beman/optional/optional-06/reset.adoc[`reset`] 
| Resets the optional to an empty state&period;
| xref:beman/optional/optional-06/swap.adoc[`swap`] 
| Swaps the contents of this optional with another&period;
| xref:beman/optional/optional-06/transform.adoc[`transform`] 
| Applies a function to the contained value if there is one&period;
| xref:beman/optional/optional-06/value.adoc[`value`] 
| Returns the contained value if there is one, otherwise throws
| xref:beman/optional/optional-06/value_or.adoc[`value&lowbar;or`] 
| Returns the contained value if there is one, otherwise returns `u`&period;
| xref:beman/optional/optional-06/2conversion.adoc[`operator bool`] 
| Converts the optional to a boolean value&period;
|===

== Friends

[cols="1,4"]
|===
|Name|Description

| `xref:beman/optional/optional-03.adoc[beman::optional::optional]`
| Optional Objects
|===


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