当我在 Ubuntu (Ubuntu 13.10, 64 bits, g++ 4.8.1) 中运行这个简单的代码时:
#include <iostream>
#include <typeinfo>
#include <string>
using namespace std;
int main(void)
{
const type_info &ti_trait = typeid(char_traits<char>::char_type);
cout << "Traits character type name : " <<
ti_trait.name() << endl;
return 0;
}
一切正常,但在 Windows(Windows 8 64 位,mingw,g++ 4.8.1)中,我得到“程序已停止工作”(编译工作正常, -Wall 不产生警告)。
在 Visual Studio 中编译和执行的相同代码可以正常工作。
任何想法?