Boost logo

Boost Users :

Subject: Re: [Boost-users] Iterators and subclasses
From: Swerts, Benjamin (Benjamin.Swerts_at_[hidden])
Date: 2009-10-19 09:10:07


> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net