15template <
typename T, EnumKind Kind>
22 return underlying{1} <<
static_cast<underlying
>(
idx - 1);
25 return static_cast<underlying
>(
idx);
29template <
typename T, auto Value>
31 if constexpr (std::same_as<T,
decltype(Value)>) {
42 return std::bit_cast<T>(
static_cast<underlying
>(Value));
46#if USING(LIBREPR_COMPILER_CLANG) && __has_warning("-Wenum-constexpr-conversion")
53template <
typename T, auto Value>
55 constexpr auto name = ctvi::value<to_enum<T, Value>()>;
56 if constexpr (!name.empty() && name[0] !=
'(') {
64template <
typename T, auto Value>
65inline constexpr auto enum_name = detail::get_enum_name<T, Value>();
72 constexpr std::size_t start =
sizeof(
"__cdecl librepr::ctei::dump_quick<") - 1;
77 constexpr std::size_t start =
sizeof(
"auto librepr::ctei::dump_quick() [V = ") - 1;
78#elif defined(__GNUC__)
80 constexpr std::size_t start =
sizeof(
"consteval auto librepr::ctei::dump_quick() [with auto V = ") - 1;
81#elif defined(_MSC_VER)
86 return signature.substr(start, end - start);
94 constexpr std::size_t start =
sizeof(
"__cdecl librepr::ctei::dump_list<") - 1;
98 constexpr std::size_t start =
sizeof(
"auto librepr::ctei::dump_list() [V = <") - 1;
99#elif defined(__GNUC__)
100 constexpr std::size_t start =
sizeof(
"consteval auto librepr::ctei::dump_list() [with auto ...V = {") - 1;
105 return signature.substr(start, end - start);
108template <
typename T, auto Value>
113 return !name.empty() && name[0] !=
'(';
116#if USING(LIBREPR_COMPILER_CLANG) && __has_warning("-Wenum-constexpr-conversion")
constexpr auto get_enum_name() noexcept
Definition enum/util.h:54
consteval auto dump_quick() noexcept
Definition enum/util.h:68
constexpr bool is_enum_value()
Definition enum/util.h:109
constexpr auto to_underlying(auto idx) noexcept -> std::underlying_type_t< T >
Definition enum/util.h:16
constexpr T to_enum() noexcept
Definition enum/util.h:30
consteval auto dump_list() noexcept
Definition enum/util.h:90
EnumKind
Definition enum/util.h:13
constexpr auto enum_name
Definition enum/util.h:65
std::string code_for()
Definition repr:39
Definition const_string.h:9
#define LIBREPR_WARNING_DISABLE_CLANG(...)
Definition warning.h:24