How to make a global immutable associative array?
Meta
jared771 at gmail.com
Tue Mar 18 21:10:19 PDT 2014
On Wednesday, 19 March 2014 at 01:56:35 UTC, Rikki Cattermole
wrote:
> Is an enum not appropriate? Because it can be used to push
> constants and available at ctfe.
>
> enum int[int] aa = [1: 2, 3: 4];
> pragma(msg, aa);
This will create a new associative array at runtime wherever aa
is used, rather than creating only one instance at compile time
and referring to it wherever aa is used. This is also the case
with normal arrays, and possibly objects... I can't remember.
More information about the Digitalmars-d
mailing list