June 08, 2021 [Issue 22008] New: foreach over enum members | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22008 Issue ID: 22008 Summary: foreach over enum members Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: b2.temp@gmx.com Given the declaration --- enum E {e1, e2} --- the following code --- foreach (v; E) { // use v } --- could be semantically equivalent to --- foreach (e; __traits(allMembers, E)) { auto v = __traits(getMember, E, e); { // use v } } --- -- |
Copyright © 1999-2021 by the D Language Foundation