首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::type_info::before

bool before( const type_info& rhs ) const;

回报true如果这个类型type_info的类型之前rhs在实现%27排序规则顺序中。不提供任何保证;特别是,排序顺序在同一程序的调用之间可以更改。

参数

rhs

-

another type information object to compare to

返回值

true如果这个类型type_info的类型之前rhs在实现%27排序规则顺序中。

二次

代码语言:javascript
复制
#include <iostream>
#include <typeinfo>
 
int main()
{
  if(typeid(int).before(typeid(char)))
    std::cout << "int goes before char in this implementation.\n";
  else
    std::cout << "char goes before int in this implementation.\n";
}

二次

可能的产出:

二次

代码语言:javascript
复制
char goes before int in this implementation.

二次

另见

operator==operator!=

checks whether the objects refer to the same type (public member function)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券