<div dir="auto">Yes this is how I mean it.</div><div class="gmail_extra"><br><div class="gmail_quote">Dne 22. 2. 2017 9:05 napsal uživatel "Jacob Carlborg via Digitalmars-d-learn" <<a href="mailto:digitalmars-d-learn@puremagic.com">digitalmars-d-learn@puremagic.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2017-02-21 23:49, H. S. Teoh via Digitalmars-d-learn wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That may appear to work, but I would *strongly* recommend against it,<br>
because what happens when you use enum with an AA, is that the AA will<br>
be created *at runtime*, *every single time* it is referenced. (It is<br>
as if you copy-n-pasted the entire AA into the code each time you<br>
reference the enum.) Which will introduce ridiculous amounts of<br>
redundant work at runtime and cause a big performance penalty.<br>
</blockquote>
<br>
You can use an enum to declare the AA and then assign it to an immutable variable using "static this". The you would only use to the immutable variable and never the enum.<br>
<br>
enum aa = [1 : 2];<br>
<br>
immutable int[int] iaa;<br>
<br>
static this()<br>
{<br>
iaa = aa;<br>
}<br>
<br>
-- <br>
/Jacob Carlborg<br>
</blockquote></div></div>