[SOLVED] Iterator nonsense (pretty basic question)

Hi everyone,

I can't seem to declare iterators with custom data types. Whenever I have a line such as
 
vector<C1>::iterator it;

I always get an error message saying "error: expected ';' before "it"". What exactly am I doing wrong? This doesn't happen for basic data types such as int and float. I know it has to be something really basic, but I've searched both this site and a book and haven't found anything. Thanks in advance.
Last edited on
All I can think of is that a) C1 is not visible at that point (you probably forgot to include something), or b) you forgot std::.
Last edited on
Agrees with helios. The line of code looks correct - I wager the error is nt related to the vector or the iterator declaration. If this doesn't help, post more code
Mmm, is C1 a templated type (ie, is this inside a template class or template function)?

If so, use the keyword "typename":

 
typename vector<C1>::iterator it;

jsmith wins! Apologies, should've mentioned that beforehand. Thanks for all your input, everyone!
Topic archived. No new replies allowed.