www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Enumerator Alias-Skipping Dynamic Iteration of Enum Members

reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
How do I make

     foreach (E; EnumMembers!T)

- iterate dynamically instead of statically (no loop unrolling) 
and
- skip enumerator aliases?
Jan 07 2015
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Nordlöw:

 How do I make

     foreach (E; EnumMembers!T)

 - iterate dynamically instead of statically (no loop unrolling) 
 and
 - skip enumerator aliases?
Try: foreach (immutable e; [EnumMembers!T].sort().uniq) Bye, bearophile
Jan 07 2015
parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
On Wednesday, 7 January 2015 at 18:27:48 UTC, bearophile wrote:
 foreach (immutable e; [EnumMembers!T].sort().uniq)
Thanks!
Jan 07 2015