[#beman-optional-optional-06-transform] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-06.adoc[optional<T&>]::transform :relfileprefix: ../../../ :mrdocs: Applies a function to the contained value if there is one. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class F> constexpr xref:beman/optional/optional-03.adoc[optional<std::invoke_result_t<F, T&>>] transform(F&& f) const; ---- == Description The return type is the same as `std::invoke_result_t<F, T&>`, but wrapped in an optional. == Return Value optional<std::invoke_result_t<F, T&>> == Template Parameters [cols="1,4"] |=== |Name|Description | *F* | The type of the invocable |=== == Parameters [cols="1,4"] |=== |Name|Description | *f* | The invocable to apply to the contained value |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#