std::is_same,继承自 integral_constant,用于判断T和U是否为相同的类型,返回值(::value)为true/false。
template struct is_same;
注意,若class类名不同,当且仅当T与U有typedef关联,否则就算T与U的所有成员属性完全一致,也仍认为是不同的类型。 具体示例为:
// is_same example
#include
#include
#include
typedef int integer_type;
struct A { int x,y; };
struct B { int x,y; };
typedef A C;
int main() {
std::cout
关注
打赏