complete initialization of the static allocated array

David Nadlinger see at klickverbot.at
Sun Aug 12 05:27:19 PDT 2012


On Sunday, 12 August 2012 at 11:36:26 UTC, Alexandr Druzhinin 
wrote:
> it works, but I want to get compile-time error if I add new 
> value to foo enum and don't add it to initialization. How can I 
> do it in the right way?

Use a final switch statement.

No, seriously, that's the only built-in facility that comes to my 
mind which checks for the presence of all enum members. 
Otherwise, you have to put an assert in manually – which, in my 
opinion, is not exactly a problem either.

David


More information about the Digitalmars-d-learn mailing list