Boost logo

Boost :

Subject: Re: [boost] Is Boost.Range broken?
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-11-23 10:31:26


On 2008-11-23, David Abrahams <dave-AT-boostpro.com> wrote:
>
> on Sat Nov 22 2008, "Scott McMurray" <me22.ca+boost-AT-gmail.com> wrote:
>
>> It seems there's an assumption that a default-constructed iterator is
>> either singular or past-the-end, but I saw no such requirement in
>> either the standard or the "New iterator concepts" document.
>
> Where was such an assumption made? I don't see it.
>

In both the old iterator_range implementation (which assumes that a
range between default constructed iterators is empty) and the new one
(which assumes that all default constructed iterators are singular).
The sentence in 1.34 "This means that the iterator_range will still
be usable in many contexts even though the iterators underneath are
not" seems to descripe the assumption that 2 default-constructed
iterators can never delimit a valid range. (This discussion does
treat the previously-mentioned sentence, along with "Recall that many
default constructed iterators are singular" as documentation that the
begin and end iterators are default-constructed, which is backed up by
the source, analogy to std::pair, and the fact that since my iterator
type has a default constructor, pointless gymnastics would be required
for it to not be used.)

As I can find no requirement that prevents two default-constructed
iterators from delimiting a valid range, I think that neither
implementation properly models the range concept (under the
presumption, justified above, that a default-constructed
iterator_range contains default-constructed iterators).


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