|
Boost : |
From: Dylan Nicholson (dylan_nicholson_at_[hidden])
Date: 2002-03-21 22:33:50
--- Gennadiy Rozental <rogeeff_at_[hidden]> wrote: > --- "Sean Wilson"
<smileyhamster_at_[hidden]> wrote:
> >My proposal is for a istream_iterator that counts how many elements have
> >been extracted so far and then indicates the end of the sequence when all
> >the required elements have been extracted or a failure occurs.
>
> I think simple iterator adaptor would do the work. Is it what are you using?
>
One thing to watch for is that almost every implementation of istream_iterator
that exists "reads ahead" - so for instance if you copy 10 elements from an
istream_iterator using *i++, it will actually extract 11 elements, often
resulting in one going missing. It's actually not difficult to write an
istream_iterator that doesn't do this, but it's not clear what the standard
mandates in this area.
Dylan
http://movies.yahoo.com.au - Yahoo! Movies
- Vote for your nominees in our online Oscars pool.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk