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排序规则顺序中。
例
二次
#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";
}二次
可能的产出:
二次
char goes before int in this implementation.二次
另见
| operator==operator!= | checks whether the objects refer to the same type (public member function) | 
|---|
 © cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

