[#llvm-transformOptional] = xref:llvm.adoc[llvm]::transformOptional :relfileprefix: ../ :mrdocs: Apply `F` to the contained value of `O` if present. == Synopsis Declared in `<llvm/ADT/STLForwardCompat.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename Optional, typename Function, typename Value = llvm::remove_cvref_t<Optional>::value_type> constexpr std::optional<remove_cvref_t<std::invoke_result_t<Function, Value>>> transformOptional( Optional&& O, Function&& F); ---- == Return Value An optional with the result of `F,` or `std::nullopt` if `O` is empty. == Parameters [cols="1,4"] |=== | Name| Description | *O* | Optional value to transform. | *F* | Function applied to the contained value when present. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#