On 07/13/2012 11:09 AM, Era Scarecrow wrote:

> I would think the best solution is to create a mutable local version,
> and then assign the immutable global one when you are done.

And there wouldn't be a copy with std.exception.assumeUnique:

import std.exception;

private immutable(int[]) constants;

shared static this()
{
    int[] local;
    local.length = 10;
    local[0] = 123;
    constants = assumeUnique(local);
}

void main()
{
    assert(constants[0] == 123);
}

Ali

--
D Programming Language Tutorial: http://ddili.org/ders/d.en/index.html

Reply via email to