对于现代 C++ 的运算符,只需获取变量、类型、函数、宏和枚举的名称
A header-only C++17 library that provides nameof macros and functions for obtaining the name of a variable, type, function, macro, or enum.
…
…
Nameof type
Exact type spellings are compiler-specific.
…
Single header: add nameof.hpp to your project.
CMake package:
find_package(nameof CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE nameof::nameof)
vcpkg: install the nameof package with vcpkg install nameof.
Conan: add nameof/x.y.z to the requires section, where x.y.z is the required release version.
AUR: install nameof with an AUR helper, for example yay -S nameof.
CPM:
CPMAddPackage(
NAME nameof
GITHUB_REPOSITORY Neargye/nameof
GIT_TAG vx.y.z # Replace `x.y.z` with the release version you want to use.
)
nameof requires C++17 or newer and supports:
See the reference for feature-specific requirements.
暂无开放 Issues,或尚未同步最近议题。