nameof v0.12.0
Permanent link:
cppdashboard.dev/r/2026/11/nameof-v0-12-0Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum
Release notes
# v0.12.0 Upgrade steps are in the [migration guide](https://github.com/Neargye/nameof/blob/v0.12.0/doc/migration.md). ## 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 return `nameof::name_view` by value instead of a reference to `nameof::cstring<N>`. Names of different lengths now share one return type. - `auto& name = nameof_type<T>()` and `nameof::cstring<N>` results no longer compile. Use `auto` or `nameof::name_view`. - `nameof_enum_flag` returns the name of a named zero, such as `"None"`, instead of an empty string. Define `NAMEOF_NO_NAMED_ZERO_IN_FLAGS` to keep it empty. - `NAMEOF` and `NAMEOF_FULL` fail to compile for `static_cast<T>(x)`, `long(x)` and `sizeof(x)` instead of returning the keyword. - A user-defined `fmt::formatter<nameof::cstring<N>>` is ambiguous with fmt 10. Remove it or define `NAMEOF_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_MEMBER` and `NAMEOF_POINTER` work in C++17 on Visual Studio 2022 17.14 and newer. - Compile-time names can be used as template arguments in C++20. - `fmt::format` works in any include order with fmt 10 and newer. With fmt 9, `NAMEOF`, `NAMEOF_FULL` and `NAMEOF_RAW` need `<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_ASSERT` and `NAMEOF_REQUIRE_STD_REFLECTION`. ## Fixes - A name saved with `auto`, such as `auto name = NAMEOF_TYPE(T)`, stays in static storage, so its views outlive the variable. - Compilation of `cstring` in 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.
Share this resource