Boost logo

Boost :

Subject: Re: [boost] [iterator] Interest in abstract iterator?
From: joaquin_at_[hidden]
Date: 2010-02-08 10:55:38


Andrey Semashev escribió:
> Hi,
>
> Quite a few times I needed a type-erased iterator, that is somewhat
> similar to boost::function and boost::any with regard to functors and
> other objects. I've crafted a simple abstract_iterator that is capable
> to adopt other iterators. Main features are:
>
> * A quite small and simple implementation.
> * Small objects optimization. By default, adopting iterators with size
> of a pointer or smaller will not result in dynamic memory allocation.
> * The abstract_iterator is capable to adopt other abstract_iterators of
> the same or more relaxed iterator category without increasing the
> adoption level.
> * Most operations on the iterator introduce a virtual function call
> overhead. Operations involving two iterators also require a dynamic_cast.
>
> The code is in the Vault:
>
> http://tinyurl.com/yhxbkl3
>
> Tested on MSVC 9. Is there any interest?

I'm much interested. There's also Adobe any_iterator to draw some
inspiration from:

http://stlab.adobe.com/classadobe_1_1any__iterator.html

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk