|
Boost Users : |
Subject: Re: [Boost-users] A forward iterator need not be default-constructible
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-09-30 11:23:28
on Fri Sep 30 2011, Krzysztof Żelechowski <giecrilj-AT-stegny.2a.pl> wrote:
> Dave Abrahams wrote:
>
>> make it copyable, for example. A wrapper over a plain pointer could
>> initialize the pointer to 0. Now it's a valid past-the-end iterator
>> into an array of length zero. Such an iterator is also comparable with
>> other iterators into the same sequence. That's actually far from
>> being minimally singular.
>>
>
> I doubt there may be a sequence of length 0 at NULL. How would you allocate
> such a sequence?
It already exists.
char* p = 0;
p == p; // defined behavior
p - p; // defined behavior
p + 0; // defined behavior
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net