On 2013-05-16 09:53, TommiT wrote:
I'd like to make it easier to initialize function local immutable/const
data. Here's the type of problem I'd like to alleviate:

const string[100] int__str;
const int[string] str__int;

for (int i = 0; i < 100; ++i)
{
     auto str = to!string(i);
     int__str[i] = str; // ERROR: Can't modify const
     str__int[str] = i; // ERROR: Can't modify const
}

In short, I want to initialize two different const variables at once (in
the same loop or other block).

Use a module constructor:

static this () { }

http://dlang.org/module.html#staticorder

--
/Jacob Carlborg

Reply via email to