
Can't your iterator just hold on to a "container" base class ref, an incrementable index and call the above virtual method in the iterator's deref implementation?
Jeff
Look at Adobe's any_iterator http://stlab.adobe.com/classadobe_1_1any__iterator.html
In Christ, Steven Watanabe
Jeff, Steven, thank you both for the excellent suggestions. I finally had some time to revisit this problem and currently have something working based on Jeff's idea. It does provide the simplest interface for people wanting to subclass (only 2 functions to implement instead of a complete subclass of boost::iterator_facade). AFAICS Adobe's any_iterator will not be more efficient because they mention a heap allocation is needed. I couldn't check its code, however, as the any_iterator class is mentioned nowhere in the source distribution (or I'm too stupid to find it in 1.0.42). Thanks again. Greets, Ben