0
点赞
收藏
分享

微信扫一扫

[modern c++][11] 类型描述库 typeindex


前言:

#include <typeindex>

typeindex库 包含两个类 std::type_info 和 std::type_index

type_info

type_info 可以用来接收 typeid 的返回值,常用成员函数如下:

hash_code

(C++11)

returns a value which is identical for the same types

(public member function)

name

implementation defined name of the type

(public member function)

type_index

type_index 是对 type_info 的包装,其中包含 type_info 成员变量

hash_code

returns hashed code

(public member function)

name

returns implementation defined name of the type,

associated with underlying type_info object

(public member function)

参考:

std::type_index - cppreference.com

举报

相关推荐

0 条评论