I\'m writing an own container class and have run into a problem I can\'t get my head around. Here\'s the bare-bone sample that shows the problem.
It consists of a con
You should have a look to the Boost.Iterators library, especially the iterator_facade
and iterator_adaptor
sections. They contain a build-up of an iterator "from scratch".
It will show you how to write iterators without too much duplication, because most of the times the code the const and non-const versions is about the same, apart from the const
qualification itself. Using templates it's possible to write it once, then declare two different types, and that's what the library documentation illustrates.