diff --git a/include/nameof.hpp b/include/nameof.hpp index 4751039..101bfce 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -234,6 +234,16 @@ template } } +// Obtains simple (unqualified) string enum name of static storage enum variable. +// This version is much lighter on the compile times and is not restricted to the enum_range limitation. +template +[[nodiscard]] constexpr std::enable_if_t>, std::string_view> nameof_enum() noexcept { + using D = std::decay_t; + static_assert(std::is_enum_v, "nameof::nameof_enum requires enum type."); + + return nameof_enum_impl(); +} + // Obtains string name of type. template [[nodiscard]] constexpr std::string_view nameof_type() noexcept { @@ -254,6 +264,10 @@ template // Obtains simple (unqualified) string enum name of enum variable. #define NAMEOF_ENUM(...) ::nameof::nameof_enum(__VA_ARGS__) +// Obtains simple (unqualified) string enum name of static storage enum variable. +// This version is much lighter on the compile times and is not restricted to the enum_range limitation. +#define NAMEOF_CONST_ENUM(...) ::nameof::nameof_enum<__VA_ARGS__>() + // Obtains string name of type. #define NAMEOF_TYPE(...) ::nameof::nameof_type<__VA_ARGS__>()