|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-05-25 16:39:42
Could you consider the possibility of adding templated constructors to
the iterator library?. I liked the iterator library in made a key part
of the implemenation of the serialization library. It was perfect
from my standpoint in that it permited me to make smaller iterators
and compose them at compile time
except for one thing....
The syntax for composing interators wasn't transparent enough
for me. I fixed this by adding (through derivation) templated
constructors. This let me compose iterators with much simpler
syntax. It also permitted me to make "iterator snippets" which
composed from other "iterator snippets" (via typedef). Which
permited me to express what I wanted in a transparent way.
(ok a lot of < and > characters - but still I like it). And all
built a compile time so in theory anyway - could be compiled
down to optimally efficient code. I called this approach
"dataflow iterators" as that what it seemed like to me. Its
described in the serialization library. I was always disappointed
that no one seemed to find it as appealing as I did - but of
course tastes differ.
Another thing that would be useful would be the notion
of "polymorphic iterators". A case study/example/test
where by a family of iterators with the same iterface
are derived from base class and the public operations
are implemented as virtual functions. This would permit
plugging in / composing different iterators at run time. In
the serialization library, the concept of polymorphic
archives fulfills the same purpose. It was achived
without touching the "base library" but by making
a "bridge" structure (like microsoft COM) which attached
a separate "polymophic" interface via multiple inheritance.
my 2 cents.
David Abrahams wrote:
> That looks like a correct fix to me. I plan to spend a little time on
> the iterator library soon, and would be very happy to apply this (or
> something very like it). Would you mind submitting your patch in a
> ticket at http://svn.boost.org?
>
> Thanks,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk