[llvm] [ADT] Backport std::to_underlying from C++23 (PR #70681)
Vlad Serebrennikov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 30 11:22:30 PDT 2023
================
@@ -1535,6 +1535,13 @@ constexpr decltype(auto) makeVisitor(CallableTs &&...Callables) {
return detail::Visitor<CallableTs...>(std::forward<CallableTs>(Callables)...);
}
+/// Backport of C++23 std::to_underlying.
+template <typename Enum>
+[[nodiscard]] constexpr typename std::underlying_type_t<Enum>
+to_underlying(Enum E) {
+ return static_cast<typename std::underlying_type_t<Enum>>(E);
----------------
Endilll wrote:
Done
https://github.com/llvm/llvm-project/pull/70681
More information about the llvm-commits
mailing list