
Hello, I'm writing a C++ class which has an STL container as a data member, and I'd like to write an iterator class which allows to iterate through the container. Which container is used, is implementation detail. I want the iterator to be a ForwardIterator, even if a random-access container is used, e.g. std::vector. What's the quick and simple way to define an iterator adapter class which uses the "base" iterator's functions, but only the ones supported by a forward iterator? The reason I need it is error detection. If the user gets a random-access iterator and treats it as such, the compiler won't complain, but in future versions of my code the user's code may break because random access shouldn't really be supported, e.g. if I change from vector to list. Thanks in advance, fr33domlover Hmmm... I guess using boost::iterator_adapter should help