有没有办法在VS中识别缺少的类型名称? VS是否至少会产生某种警告?如何在Visual Studio中识别缺少的类型名称
template<class T>
void dum() {
std::vector<T> dum_vector;
typename std::vector<T>::iterator it = dum_vector.begin();
// VS compiles it with or without typename, but I would like to know whether
// I forgot to put a typename, since without typename the code may not compile
// with another compiler (e.g. GCC)
}
“因为没有typename,代码可能无法与另一个编译器编译”=>“,因为没有typename代码没有很好地形成C++”。 – juanchopanza 2013-02-18 15:56:18
我们在谈论什么版本的VS? – fredoverflow 2013-02-18 16:00:43
@FredOverflow这是如何重复的?这个问题并不是问关键词是什么或者它们在哪里应用,而是如何让MSVC从它的唯一性位置下台,至少在接受非标准语法时提及*。 – Angew 2013-02-18 16:04:18