[#bsl-optional-072-transform-09d]
= xref:bsl.adoc[bsl]::xref:bsl/optional-072.adoc[optional]::transform
:relfileprefix: ../../
:mrdocs:

`transform` overloads

== Synopses

Declared in `&lt;bslstl&lowbar;optional&period;h&gt;`

Map the contained value through `func`, or return an empty optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;FUNC&gt;
constexpr
auto
xref:bsl/optional-072/transform-00.adoc[transform](t&lowbar;FUNC&& func) &amp;;
----

[.small]#xref:bsl/optional-072/transform-00.adoc[_» more&period;&period;&period;_]#

Same as the `transform` overload taking `&amp;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;FUNC&gt;
constexpr
auto
xref:bsl/optional-072/transform-068.adoc[transform](t&lowbar;FUNC&& func) const &amp;;
----

[.small]#xref:bsl/optional-072/transform-068.adoc[_» more&period;&period;&period;_]#

Apply the specified `func` to the contained value and return the result as an rvalue optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;FUNC&gt;
constexpr
auto
xref:bsl/optional-072/transform-06b.adoc[transform](t&lowbar;FUNC&& func) &amp;&amp;;
----

[.small]#xref:bsl/optional-072/transform-06b.adoc[_» more&period;&period;&period;_]#

Apply the specified `func` to the contained value and return the result as a const rvalue optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;FUNC&gt;
constexpr
auto
xref:bsl/optional-072/transform-097.adoc[transform](t&lowbar;FUNC&& func) const &amp;&amp;;
----

[.small]#xref:bsl/optional-072/transform-097.adoc[_» more&period;&period;&period;_]#

== Return Value

`optional` containing the result of `func`, or empty if disengaged

== Parameters

[cols="1,4"]
|===
| Name| Description
| *func*
| callable invoked with the contained value or when empty
|===


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