Ruling out arbitrary cost copy construction?
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Tue Nov 9 07:16:53 PST 2010
On 02/11/2010 15:16, Steven Schveighoffer wrote:
> On Fri, 29 Oct 2010 09:06:24 -0400, Bruno Medeiros
> <brunodomedeiros+spam at com.gmail> wrote:
>
>> On 06/10/2010 17:34, Andrei Alexandrescu wrote:
>>>
>>>
>>> or similar. However, a sealed range does not offer references, so trying
>>> e.g.
>>>
>>> swap(r1.front, r2.front);
>>>
>>> will not work. This is a problem.
>>
>> Why doesn't a sealed range offer references? Is it to prevent
>> modifying the elements being iterated?
>> (I searched google and TDPL but couldn't find any info on sealed ranges)
>
> Because a sealed range then has complete power over memory allocation of
> its elements (really, I think sealed ranges is a misnomer, it's really
> ranges on sealed containers).
>
Ah, my mistake. I thought sealed ranges were simply ranges that did not
allow modifying the underlying container (a "logical const" range), and
similarly for sealed containers (= an unmodifiable container).
I see why escaping references is not allowed then.
--
Bruno Medeiros - Software Engineer
More information about the Digitalmars-d
mailing list