complete initialization of the static allocated array

Alexandr Druzhinin drug2004 at bk.ru
Sun Aug 12 05:09:53 PDT 2012


12.08.2012 18:52, bearophile пишет:
> Alexandr Druzhinin:
>
>> but I don't think it is elegant
>
> If you think that's not elegant, then try to do the opposite: instead of
> giving the full mymap in the static this, try to create it from the
> elements of the enum itself.
>
> In D the enum name is better starting with an upper case, and the end
> semicolon is not needed:
>
> enum Foo { one, three, seven }
>
> Bye,
> bearophile

I can't create mymap automatically based on Foo elements, because 
there's no correlation between them - I should just set this 
corrrelation by means of mymap.
What about elegance - I just thought that there was some better way to 
check if all elements of Foo were included into mymap than just brutal 
force iteration through all Foo elements.



More information about the Digitalmars-d-learn mailing list