Primary Ranges of Containers

Timon Gehr timon.gehr at gmx.ch
Wed Jun 20 12:22:05 PDT 2012


On 06/20/2012 06:03 PM, Jonathan M Davis wrote:
> On Wednesday, June 20, 2012 13:38:31 Timon Gehr wrote:
>> Escape the payload anyway and document that the range is invalid after
>> the container has been destroyed.
>
> That's a given anyway. Ranges from containers are _always_ invalid after the
> container that they come from is gone. They can also become invalid for a
> variety of operations on the container. That's why we have the stableX
> functions. So, there may be serious problems with a range over a const Array,
> but the invalidation of its range when the Array goes away is not one of them.
>
> - Jonathan M Davis

I mean invalid as in "failure to respect the invalidity of the range
results in memory corruption". Therefore, such a design couldn't be
used from @safe code.


More information about the Digitalmars-d mailing list