|
Boost Users : |
Subject: Re: [Boost-users] A forward iterator need not be default-constructible
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2011-09-30 10:22:21
2011/9/30 Krzysztof Żelechowski <giecrilj_at_[hidden]>:
> 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?
You don't need to allocate anything if your sequence is of length 0, since
a NULL pointer is comparable, destroyable and copyable. It can't be
dereferenced nor incremented but if the sequence has length 0 you can't
anyway.
> Chris
-- Felipe Magno de Almeida
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