== Auszug aus Jesse Phillips (jessekphillip...@gmail.com)'s Artikel > Nrgyzer Wrote: > > Hey guys, > > > > I'm trying to iterate over an enumeration which contains strings like > > the this: > > > > enum FileName : string { > > file1 = "file1.ext", > > file2 = "file2.ext" > > } > > > > I already found this article: http://lists.puremagic.com/ pipermail/ > > digitalmars-d/2007-July/021920.html but it's an enum which contains > > integers instead of strings, thus I can't use min- or max- property. > > > > Any suggestions -> thanks in advance! > I'll just be leaving this here, if you need more explanation ask, but maybe you'll understand: > import std.stdio; > enum FileName : string { > file1 = "file1.ext", > file2 = "file2.ext" > } > void main(string args[]) > { > foreach(a; __traits(allMembers, FileName)) > writeln(mixin("FileName." ~ a)); > }
I've already worked with the mixin-statement, but the __trait is new. As I can see in the documentation, it provides some interesting features. Your solution works great, thanks!