custom iterators

does anyone know of an article that describes how to write iterators for custom classes that will work with the STL algorithms?
As long as they behave properly anything you write will work. Make sure to look through the reference. http://www.cplusplus.com/reference/std/iterator/

If it makes a difference, just watch that your reverse iterators use that stupid +1 offset so that they behave like the STL. (A bad design decision IMO.)
This might be a good question to ask "C++ Standard Template Library" by Josuttis; it should define the requirements. There are a lot of typedefs you need and iterator traits, etc. ie, compile-time stuff in
addition to the runtime stuff like providing both operator++'s etc.

Topic archived. No new replies allowed.