You need to typename std::list<T>::iterator. This is due to the fact that it listdepends on the template parameter, so the compiler cannot know what exactly will be indicated in it iterator(well, technically it would be possible to know, but the C ++ standard does not work that way). The keyword typenametells the compiler that the next one follows the type name.
source
share