Jay Norwood:

    enum Suit { spades, hearts=4, diamonds=10, clubs }

    foreach (i, member; EnumMembers!Suit)

Here 'i' is the index of the enumeration type tuple.

This code lacks the [] I added in my code, so your foreach is a static one. To tell them apart when I read the code I sometimes add a comment:

/*static*/ foreach (i, member; EnumMembers!Suit)

Bye,
bearophile

Reply via email to