|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-09 16:36:49
----- Original Message -----
From: "Moore, Paul" <paul.moore_at_[hidden]>
> I just grabbed Boost 1.21.0 (I don't track the CVS stuff), and I have had
a
> quick glance at the iterator adapters library.
>
> One thing that struck me was that, although there is a Function Output
> Iterator Adapter, what I often feel the need for is a function *input*
> iterator, specifically an input iterator which returns the results of
> calling a function repeatedly. The obvious example of something like this
is
> a lexer, where you often find lexer functions, but what you would really
> like is an input iterator which generates tokens one after another.
>
> Does the iterator adaptors library offer a way of doing this?
You could use your function as a base object I guess. Just write the
appropriate policies class and I think you could get it to work.
> I couldn't see
> anything at a first glance... I think it would be very helpful to add, as
> writing input iterators is a bit subtle (it nearly always takes me a
couple
> of goes to get the behaviour right).
I think this is Jens' generator_iterator, which you can find in the random
library. We've been discussing moving all boost iterator stuff into a
centrally-organized area.
> There is one obvious issue, namely that it's not easy to define an "end"
> condition. istream_iterators have EOF, but a general function could signal
> an "end" to its stream of values in all sorts of ways, not least of which
is
> having no end at all (consider a random number generator).
>
> I'll look into all this a bit more closely as soon as I get the time...
>
> Paul.
>
> PS Is there any way of getting the Boost documentation packaged up into
> something printable for offline use? HTML is all very well, but it's not
> really on to try to print each page manually. Maybe it's time to consider
> some form of documentation guidelines...
Whew, I just barely learned HTML. I don't think I'm ready for XML yet ;-(.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk