Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-11-05 02:47:10


Dave Harris wrote:
> I see an input sequence as something for which we can get the current
> item, advance to the next, and tell whether there are any items left.
> Surely this applies to integers?
>
> class odds {
> int current_;
> public:
> odds() : current(1) {}
> int current() const { return current_; }
> bool at_end() const { return false; }
> void advance() { current_ += 2; }
> };

Of course, the question is does this special interface to input sequences
only in any way justifies its introduction, given all its drawbacks? IMO,
one point where STL had hit its target is the notion of iterator ranges,
which are much more suitable for representing arbitrary sequences when
anything else.

Aleksey


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