<分区>
此代码在 Visual Studio 2013 上运行,但不能在 gcc 4.9.2 上运行:
template <typename T>
void foo(){
T::value_type bar('a');
cout << bar << endl;
}
int main() {
foo<string>();
return 0;
}
似乎 Visual Studio 2013 推导类型允许我实现模板参数中定义的类型,而 gcc 4.9.2 does not .
是否有解决方法可以在 gcc 中允许这种行为?