
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:
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