From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-09-15 12:50:58
At 05:13 PM 9/14/2002, David Abrahams wrote:
>> I frankly don't understand the details of this problem. Am I using
>> iterator_adaptor incorrectly
>Yes. A class derived from a valid iterator is not a valid iterator unless
>you add all the appropriate operators. That's why iterator_adaptor<>
>defines all the operators. Instantiations of iterator_adaptor<> are valid
>iterators. Derived classes are generally not valid iterators.
I think you should point that out in the documentation. I just skimmed the
docs again and there is no indication I could see that it isn't safe to
derive from iterator_adaptor.
Instead the docs say things like "There is an unlimited number of ways the
iterator_adaptors class can be used to create iterators" which made me
think iterator_adaptor performed some magic that made derivation safe.
Since, as Thomas Witt points out, the point of derivation was to add a
constructor, it would be nice if the docs explained what a user is supposed
to do when faced with this need.
> That's why
>all the examples in the library use type generators instead of
>Just follow the formula given by the library docs and you'll be fine.
I can't find any "formula" in the docs for simple iterators that require
The only discussion I found of generators said "The nicest way to package
the construction of the transform iterator is to create a type generator".
That seems to imply there are other choices, and that using a generator was
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk