tags:

views:

55

answers:

1

I have implemented my own container class and need to implement a const_iterator for it. What is the easiest way to go about implementing const_iterator begin() const_iterator end() and const_iterator::operator++ for my own container class?

Please provide examples. Thanks!

+1  A: 

It seems boost library has a compatible version to be used with VC6 according to this question. In that case you can use either boost::iterator_facade or boost::iterator_adaptor to easily write a const_iterator class. If you can't use boost, then the only option I see is to write a class derived from std::iterator and write all the required operator overloads.

Naveen