|
VLink 2.0.0
A high-performance communication middleware
|
Compile-time type-name and enum-name detection utilities. 更多...
函数 | |
| template<typename T> | |
| constexpr bool | is_support () noexcept |
Checks at compile time whether the nameof library can produce a type name for T. | |
| template<typename T> | |
| constexpr std::string_view | get () noexcept |
Returns the unqualified compile-time name of type T as a std::string_view. | |
| template<typename T> | |
| std::string_view | get_enum (T e) noexcept |
Returns the string representation of an enumeration value e. | |
Compile-time type-name and enum-name detection utilities.
|
inlinenodiscardconstexprnoexcept |
Returns the unqualified compile-time name of type T as a std::string_view.
On Windows, leading "struct " and "class " prefixes that MSVC may inject are stripped before returning. On other platforms the raw nameof::nameof_type<T>() result is returned.
The returned view points to static storage (lifetime of the program). It is used by the VLink plugin system to register interfaces by their type name rather than by a manually specified string.
| T | The type whose name is requested. |
constexpr std::string_view containing the type name.constexpr on supported compilers. The result is identical whether evaluated at compile time or runtime.
|
inlinenodiscardnoexcept |
Returns the string representation of an enumeration value e.
Wraps nameof::nameof_enum to obtain the enumerator name. Returns an empty std::string_view if the value is out of the known range.
| T | The enumeration type. |
| e | The enumeration value to name. |
std::string_view containing the enumerator name, or an empty view if e is not a named enumerator.
|
inlinenodiscardconstexprnoexcept |
Checks at compile time whether the nameof library can produce a type name for T.
Details
Returns true when the underlying nameof::detail::nameof_type_supported trait evaluates to true for T. When this returns false, calling get<T>() may produce an empty or implementation-defined string.
| T | The type to check. |
true if type-name detection is supported for T.