Using foreach with named enum/ enum X {A=0x80000000, B=0, C=0x10000, D=0} foreach(x; X) .... This will be useful to write code with extendable in future enums that doesnt need refactoring