Boost logo

Boost :

Subject: [boost] [iterator] Interest in abstract iterator?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2010-02-08 10:33:15


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:

Tested on MSVC 9. Is there any interest?

Boost list run by bdawes at, gregod at, cpdaniel at, john at