Apply F to the contained value of O if present.
Declared in <llvm/ADT/STLForwardCompat.h>
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);
An optional with the result of F, or std::nullopt if O is empty.
| Name | Description |
|---|---|
| O | Optional value to transform. |
| F | Function applied to the contained value when present. |