[PATCH] D140221: [Support] Add StringSwitch::AsOptional
Sergei Barannikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 11:30:37 PST 2022
barannikov88 added inline comments.
================
Comment at: llvm/include/llvm/ADT/StringSwitch.h:189-192
+ if (Result)
+ return std::optional(std::move(*Result));
+
+ return std::nullopt;
----------------
Would that work? Note that `Result` is `std::optional<T>` and std::optional has a converting move constructor.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140221/new/
https://reviews.llvm.org/D140221
More information about the llvm-commits
mailing list