From e1ba7dd7a976b2ce076b9361f761dd51cdf4b4ec Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Thu, 8 May 2025 00:15:26 +0200 Subject: Add enum underlying utilities --- asl/base/utility.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'asl/base/utility.hpp') diff --git a/asl/base/utility.hpp b/asl/base/utility.hpp index f371ab4..c4801b1 100644 --- a/asl/base/utility.hpp +++ b/asl/base/utility.hpp @@ -69,6 +69,12 @@ constexpr U bit_cast(T value) requires (sizeof(T) == sizeof(U)) return __builtin_bit_cast(U, value); } +template +constexpr auto to_underlying(T value) +{ + return static_cast>(value); +} + // NOLINTBEGIN(*-macro-parentheses) #define ASL_DELETE_COPY(T) \ T(const T&) = delete; \ -- cgit