vector iterator within a template

D

Daniel.Wyatt

I need some help with this please. Here's the important part:

#include <vector>
#include <string>
................
template <class T>
bool ResourceManager<T>::isLoaded(const std::string Filename)
{
std::vector<T>::iterator it; //error: expected `;' before "it"
return false;
}

This won't compile. I'm using the newest MinGW, not that it matters. As
the comment says, the iterator declaration causes an error. I'm pretty
sure i've encountered this problem before but i can't remember how i
fixed it. If i replace the "T" template parameter in the iterator
declaration with a regular type, like an int, it compiles fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,113
Latest member
Vinay KumarNevatia
Top