VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
vlink::NameDetector 命名空间参考

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.

函数说明

◆ get()

template<typename T>
std::string_view vlink::NameDetector::get ( )
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.

模板参数
TThe type whose name is requested.
返回
A constexpr std::string_view containing the type name.
注解
This function is constexpr on supported compilers. The result is identical whether evaluated at compile time or runtime.
这是这个函数的调用关系图:

◆ get_enum()

template<typename T>
std::string_view vlink::NameDetector::get_enum ( T e)
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.

模板参数
TThe enumeration type.
参数
eThe enumeration value to name.
返回
A std::string_view containing the enumerator name, or an empty view if e is not a named enumerator.

◆ is_support()

template<typename T>
bool vlink::NameDetector::is_support ( )
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.

模板参数
TThe type to check.
返回
true if type-name detection is supported for T.
这是这个函数的调用关系图: