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

Reply via email to