Iterating through enumeration

Alexandr Druzhinin drug2004 at bk.ru
Sun Aug 12 04:19:49 PDT 2012


12.08.2012 17:43, simendsjo пишет:
> On Sun, 12 Aug 2012 12:36:21 +0200, Alexandr Druzhinin <drug2004 at bk.ru>
> wrote:
>
>> Hello all.
>> I have some enum foo { first=1, second=2, fourth=4, sixth=6} and I'd
>> like to go through this enumeration like it:
>> foreach(m; foo.min..foo.max) {
>>     bar(m);
>> }
>> But without excluding foo.max and correct handle situation when enum
>> identifiers aren't consequentive.
>>
>> Thanks in advance
>
> Looking for this? http://dlang.org/phobos/std_traits.html#EnumMembers
Yes, this is what I need, thanks!


More information about the Digitalmars-d-learn mailing list