AA literals/initialisation

Dmitry Olshansky dmitry.olsh at gmail.com
Mon Nov 11 03:59:47 PST 2013


11-Nov-2013 15:55, simendsjo пишет:
> On Monday, 11 November 2013 at 11:43:01 UTC, Dmitry Olshansky
> wrote:
>> 11-Nov-2013 15:06, Manu пишет:
>>
>>>    but enum works fine:
>>>
>>>    enum priorityMap = [
>>>
>>>         "1" : "blocker",
>>>         "2" : "critical",
>>>         "3" : "critical",
>>>         "4" : "major",
>>>         "5" : "major",
>>>         "6" : "major",
>>>         "7" : "minor",
>>>         "8" : "minor",
>>>         "9" : "trivial" ];
>>>
>>>
>>> So it does... I didn't think of an enum AA ;)
>>
>> ... copy pastes that literal everywhere, I'm sure you'll like it ;)
>
> Will it be copied even if you just use it ("1" in priorityMap),
> or only if you pass it around as a parameter or assign it to
> variables?

It will do whatever it does when written as literal by hand.
And it's nothing clever still, last time I checked - allocation, everywhere.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list