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: [email protected]
Reporter: [email protected]
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
}
}
---
--
