[#beman-optional-optional-06] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-03.adoc[optional]<T&> :relfileprefix: ../../ :mrdocs: == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> class xref:beman/optional/optional-03.adoc[optional]<T&>; ---- == Types [cols=2] |=== | Name | Description | xref:beman/optional/optional-06/iterator.adoc[`iterator`] | The type of the iterator for the optional. | xref:beman/optional/optional-06/value_type.adoc[`value_type`] | The type of the value stored in the optional. |=== == Member Functions [cols=2] |=== | Name | Description | xref:beman/optional/optional-06/2constructor-03.adoc[`optional`] [.small]#[constructor]# | Constructors | xref:beman/optional/optional-06/2destructor.adoc[`~optional`] [.small]#[destructor]# | Destructor. | xref:beman/optional/optional-06/operator_assign-0f.adoc[`operator=`] | Assignment operators | xref:beman/optional/optional-06/and_then.adoc[`and_then`] | Applies a function to the stored value if there is one. | xref:beman/optional/optional-06/begin.adoc[`begin`] | Returns an iterator to the beginning of the optional. | xref:beman/optional/optional-06/emplace.adoc[`emplace`] | Emplaces a new value in the optional, destroying the current one if | xref:beman/optional/optional-06/end.adoc[`end`] | Returns an iterator to the end of the optional. | xref:beman/optional/optional-06/has_value.adoc[`has_value`] | Checks if the optional has a value. | xref:beman/optional/optional-06/operator_star.adoc[`operator*`] | Returns a reference to the stored value. | xref:beman/optional/optional-06/operator_ptr.adoc[`operator‐>`] | Returns a pointer to the stored value. | xref:beman/optional/optional-06/or_else.adoc[`or_else`] | Calls a function if the optional is empty. | xref:beman/optional/optional-06/reset.adoc[`reset`] | Resets the optional to an empty state. | xref:beman/optional/optional-06/swap.adoc[`swap`] | Swaps the contents of this optional with another. | xref:beman/optional/optional-06/transform.adoc[`transform`] | Applies a function to the stored value if there is one. | xref:beman/optional/optional-06/value.adoc[`value`] | Returns the stored value if there is one, otherwise throws | xref:beman/optional/optional-06/value_or.adoc[`value_or`] | Returns the stored value if there is one, otherwise returns `u`. | xref:beman/optional/optional-06/2conversion.adoc[`operator bool`] | Converts the optional to a boolean value. |=== == Friends [cols=2] |=== | Name | Description | `xref:beman/optional/optional-03.adoc[beman::optional::optional]` | |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#