描述
它返回该类型是否以某种特定于实现的顺序位于 rhs 标识的类型之前。
声明
以下是 std::type_info::before 的声明。
C++98
bool before (const type_info& rhs) const;
C++11
bool before (const type_info& rhs) const noexcept;
参数
rhs− 标识对象类型。
返回值
它返回该类型是否以某种特定于实现的顺序位于 rhs 标识的类型之前。
异常
No-throw guarantee- 该成员函数从不抛出异常。
数据竞争
区域设置对象被修改。
示例
在下面的 std::type_info::before 示例中。
#include <iostream>
#include <typeinfo>
int main() {
if ( typeid(int).before(typeid(char)) )
std::cout << "int goes before char while implementation.\n";
else
std::cout << "char goes before int while implementation.\n";
return 0;
}
输出应该是这样的 -
char goes before int while iimplementation.
相关用法
- C++ type_info name用法及代码示例
- C++ type_traits::is_null_pointer用法及代码示例
- C++ typeinfo::bad_cast用法及代码示例
- C++ typeinfo::bad_typeid用法及代码示例
- C++ complex tanh()用法及代码示例
- C++ tellg()用法及代码示例
- C++ tan()用法及代码示例
- C++ transform_inclusive_scan()用法及代码示例
- C++ tgamma()用法及代码示例
- C++ complex tan()用法及代码示例
- C++ towupper()用法及代码示例
- C++ towlower()用法及代码示例
- C++ trunc()用法及代码示例
- C++ tanh()用法及代码示例
- C++ towctrans()用法及代码示例
- C++ unordered_map cbegin用法及代码示例
- C++ map lower_bound()用法及代码示例
- C++ Unordered_multimap reserve()用法及代码示例
- C++ list assign()用法及代码示例
注:本文由纯净天空筛选整理自 C++ Type_info Library - before Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。