就是不懂没啥好说的。
下面代码输出“0”(false)。
#include <array>
#include <typeinfo>
#include <iostream>
using namespace std;
int x = 0;
char y = '_';
int main(int argc,char **argv) {
cout << typeid(x).before(typeid(y)) << endl;
return 0;
}
求助啊!!
就是不懂没啥好说的。
下面代码输出“0”(false)。
#include <array>
#include <typeinfo>
#include <iostream>
using namespace std;
int x = 0;
char y = '_';
int main(int argc,char **argv) {
cout << typeid(x).before(typeid(y)) << endl;
return 0;
}
求助啊!!
http://www.cplusplus.com/reference/typeinfo/type_info/before/
Returns true if the type identified by *this is considered to go before the type identified by rhs, and false otherwise.
如果你觉得this应该把自己放在括号里那个东西前面,就返回true,反之返回false
至于为什么要放在前面,这个是“is considered”的,你认为的。
好比我认为鸡腿比炒肉丝好吃,为什么,因为我这么认为。