On Monday, 6 January 2014 at 04:10:04 UTC, Ali Çehreli wrote:
On 01/05/2014 05:19 PM, Meta wrote:> The following doesn`t work:
>
> immutable(string[]) strArr = new string[](10);

A pure function is a workaround. The return value of a pure function is implicitly convertible to immutable:

pure string[] foo()
{
    return new string[](10);
}

void main()
{
    immutable(string[]) strArr = foo();
}

Ali

Thanks, that does the trick. Also, is there any hack that I can use to build an AA at compile time? I have a module level variable that's a string[][string] and I'd like to initialize it without resorting to static this.

Reply via email to