|
Boost : |
From: ravioli_at_[hidden]
Date: 2003-05-07 02:36:08
In the Boost "iterator_adaptor" library, the "indirect_iterator_adaptor"
template allows to create, having an object pointers container,
an iterator behaving like an iterator on a container of objects
(without dereferences). Is is therefore usable with the usual STL
algorithms. For the moment, this adaptor only works with "input_iterator"
and "random_access_iterator" types iterators.
The "indirect_output_iterator_adaptor" template behaves
the same way, but with "output_iterator" type iterators. This template :
- Does the insertion of a pointer in the container the iterators points
to.
- And before that, does the allocation of a new object the get this
pointer.
Therefore, it is possible to use in insertion mode, containers of
objects pointers, exactly like objects containers.
The code takes about 40 lines. Any interest ?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk