template<class T>
void Clear( std::list<T*> ls)
{
std::list<T*>::iterator it = ls.begin(); // 这一行在linux编译不过,提示:expected ';' before 'it'
for (; it != ls.end(); ++it)
{
//...
}
ls.clear();
}
修改如下:
template<class T>
void Clear( std::list<T*> ls)
{
typename std::list<T*>::iterator it = ls.begin();
for (; it != ls.end(); ++it)
{
//...
}
ls.clear();
}