|
Boost Users : |
Subject: Re: [Boost-users] [Iterators] Filtering and conversion
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-12-23 23:47:56
Ruediger Berlich wrote:
> The filter_iterator already does part of what I'd want here, but
> cannot help with the conversion part.
>
> I'm not asking for a solution to the above problem, just whether you
> think this can be done at all. I had the impression that the
> iterators library assumes that the types of the sequence being
> iterated over and the type being returned are identical.
I don't know if this helps. But the serialization library has
a section called dataflow iterators. It's really about
composition of iterators. So you can
a) start with an original sequence o_i
a) make a derivation from transform iterator - call it t_i
b) make a deriveration from filter iterator - call it f-i
c) make a composition of the two with - f-i(t_i(o_i). This
composite returns a the original sequence filtered and transformed.
It's all done at compile time so when you compile
for release - the final result is very fast.
Robert Ramey
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