当在C++中检查字符串的typeinfo
时,它返回一个奇怪的输出A19_c
,A19_c
是什么意思?检查字符串的typeinfo时出现奇怪的输出
当作为引用类型字符串显式初始化时,它可以查找并返回一个Ss
。
#include <iostream>
#include <typeinfo>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
std::string mystr = "I am a code monkey";
cout << typeid(mystr).name() << endl;
cout << typeid("I am a code monkey").name() << endl;
return 0;
}
[出]:
Ss
A19_c
数组可能包含19个字符? – LogicStuff
_string literal_不是'std :: string'。 –