[#bsl-optional-072-transform-00] = xref:bsl.adoc[bsl]::xref:bsl/optional-072.adoc[optional]::transform :relfileprefix: ../../ :mrdocs: If this object contains a value, invoke the specified `func` with the contained value as an argument and return `optional<U>` that contains the result of that invocation, where `U` is the cv‐unqualified `func` return type, which can be different from `t_TYPE`; otherwise, return an empty `optional<U>`. Note that `func` must return an object type other than array, `bsl::in_place_t` or `bsl::nullopt`. Also note that there is no requirement that `U` is movable. Finally note that the returned optional uses the allocator of the object returned by `func`, or the default allocator if `func` is not invoked. == Synopsis Declared in `<bslstl_optional.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class t_FUNC> constexpr auto transform(t_FUNC&& func) &; ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#