Repository navigation
v0.12.0
Upgrade steps are in the migration guide.
Breaking changes
- Clang 9 and Xcode 11 are the minimum versions.
nameof_enum<V>(),nameof_type<T>(),nameof_full_type<T>(),nameof_short_type<T>(),nameof_member<V>(),nameof_pointer<V>()and their macros returnnameof::name_viewby value instead of a reference tonameof::cstring<N>. Names of different lengths now share one return type.auto& name = nameof_type<T>()andnameof::cstring<N>results no longer compile. Useautoornameof::name_view.nameof_enum_flagreturns the name of a named zero, such as"None", instead of an empty string. DefineNAMEOF_NO_NAMED_ZERO_IN_FLAGSto keep it empty.NAMEOFandNAMEOF_FULLfail to compile forstatic_cast<T>(x),long(x)andsizeof(x)instead of returning the keyword.- A user-defined
fmt::formatter<nameof::cstring<N>>is ambiguous with fmt 10. Remove it or defineNAMEOF_NO_FMT_FORMAT. fmt 11 and newer silently ignore it and format names as strings.
Improvements
- Faster compilation of enum names.
- Faster
nameof_enum(value)for large sparse enums. - Support for nvcc and nvc++.
- Enum names in ReSharper C++ and CLion Nova 2025.3 and newer.
NAMEOF_MEMBERandNAMEOF_POINTERwork in C++17 on Visual Studio 2022 17.14 and newer.- Compile-time names can be used as template arguments in C++20.
fmt::formatworks in any include order with fmt 10 and newer. With fmt 9,NAMEOF,NAMEOF_FULLandNAMEOF_RAWneed<fmt/format.h>first.- New options:
NAMEOF_CONFIG_FILE(a header with options),NAMEOF_NO_STD_FORMAT,NAMEOF_NO_FMT_FORMAT,NAMEOF_NO_NAMED_ZERO_IN_FLAGS,NAMEOF_ASSERT/NAMEOF_NO_ASSERTandNAMEOF_REQUIRE_STD_REFLECTION.
Fixes
- A name saved with
auto, such asauto name = NAMEOF_TYPE(T), stays in static storage, so its views outlive the variable. - Compilation of
cstringin templated lambdas on GCC 13 and 14. - Empty enum names on Clang for enums nested in class templates when the first lookup is by value.
- Compilation of enums with an empty range on Visual Studio 2019 in C++20.