Boost logo

Boost :

Subject: Re: [boost] Is Boost.Range broken?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-11-22 12:20:51


Scott McMurray wrote:

> Also, what if I write a random_number_iterator, a forward iterator
> which returns a different random number after each increment? Then
> iterator_range<random_number_iterator>() is again non-singular, and it
> has an infinite size (operator== would always be false)

In that case, it might be clearer to write something like

iterator_range<random_number_iterator> r(random_number_iterator(),
random_number_iterator());

Here, it is explicitly initialized and thus iterator_range should know
that this is not a singular range.

That is quite a pain, of course.

> , so the
> empty() for the range should *not* return false.

I'm not sure I'm following.
The way you wrote it, it should abort, and the way I wrote it, it should
return false.


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