15 static_assert(std::is_enum_v<
decltype(V)>,
"enum_value_name requires enum value");
18 constexpr std::string_view header =
"auto Botcraft::Utilities::enum_value_name() [V = ";
19 constexpr std::string_view footer =
"]";
20 constexpr std::string_view name = __PRETTY_FUNCTION__;
21#elif defined(__GNUC__)
22 constexpr std::string_view header =
"constexpr auto Botcraft::Utilities::enum_value_name() [with auto V = ";
23 constexpr std::string_view footer =
"]";
24 constexpr std::string_view name = __PRETTY_FUNCTION__;
25#elif defined(_MSC_VER)
26 constexpr std::string_view header =
"auto __cdecl Botcraft::Utilities::enum_value_name<";
27 constexpr std::string_view footer =
">(void) noexcept";
28 constexpr std::string_view name = __FUNCSIG__;
31 static_assert(V == V &&
false,
"enum_value_name requires either __PRETTY_FUNCTION__ or __FUNCSIG__ to be available");
33 return name.substr(header.size(), name.size() - header.size() - footer.size());