C++ iterators

I declared a const_iterator in header

 
  typedef vector<Uint>::const_iterator TIterator;


How could i define the iterator?
If i try TIterator=... i receive an error illegal use of the iterator.

I don't want to use vector<Uint>::iterator TIterator=...
TIterator it; defines an iterator named it and is the same as writing vector<Uint>::const_iterator it;.
@cenzuratu

I declared a const_iterator in header

typedef vector<Uint>::const_iterator TIterator;


You did not declare an iterator. You declared a synonym fo the type vector<Uint>::const_iterator

So instead of this type you can use its synonym TIterator to declare iterators of this type everywhere in the program where this definition of the synonym is seen..

Topic archived. No new replies allowed.