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

Applies a function to the stored value if there is one&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class F&gt;
constexpr
xref:beman/optional/optional-03.adoc[optional&lt;std::invoke&lowbar;result&lowbar;t&lt;F, T&&gt;&gt;]
transform(F&& f) const;
----

== Description

The return type is the same as

[,cpp]
----
{std::invoke_result_t<F, T&>},
 but wrapped in an optional.



----
== Return Value

optional&lt;std&colon;&colon;invoke&lowbar;result&lowbar;t&lt;F, T&amp;&gt;&gt;


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