Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > vector iterator within a template

Thread Tools

vector iterator within a template
Posts: n/a
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.

Reply With Quote
Posts: n/a
Ahh, nevermind, found a solution:

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
can I use stl vector iterator to delete a vector of pointers? zl2k C++ 27 09-07-2010 11:47 AM
iterator within iterator dhavalshah Java 0 12-16-2008 02:38 AM
Free memory allocate by a STL vector, vector of vector, map of vector C++ 8 02-18-2006 12:48 AM
Iterator of STL vector of a template arg fails! =?ISO-8859-15?Q?R=FCdiger_Kn=F6rig?= C++ 3 06-02-2005 01:40 PM
trying to declare an iterator for a std::vector of template pointers Ken Cecka C++ 3 03-27-2005 08:47 PM