Iterating through enumeration

simendsjo simendsjo at gmail.com
Sun Aug 12 03:43:56 PDT 2012


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


More information about the Digitalmars-d-learn mailing list