Boost logo

Boost :

From: John E. Potter (jpotter_at_[hidden])
Date: 2000-06-08 17:11:59


On Fri, 9 Jun 2000, Jens Maurer wrote:

> Hm... This is most easily fixed if we insist on input iterator
> semantics, i.e. operator* and operator++ must be called
> alternatingly. Then we can make operator++ a NOP and operator*
> just calls operator(). This also saves the extra member variable
> to hold the value for operator* (see generator_iterator_mixin_adapter).

That requirement is for output iterator. The following is a valid
version of wc -l.

cout << distance(istream_iterator<string>(cin),
      istream_iterator<string>()) << endl;

Just a nit,
John


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk