[Issue 8012] Add .length field to enums or provide helper function to Phobos
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 1 15:38:28 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8012
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-05-01 15:39:37 PDT ---
(In reply to comment #2)
> (In reply to comment #0)
>
> Dupe of Issue 4997 ?
Yeah, I'll close this then.
> This is enough, no need to create an array:
>
> template EnumLength(E) if (is(E == enum))
> {
> enum EnumLength = __traits(allMembers, E).length;
> }
Thanks, I forgot tuples have length.
> But your problem is probably solved in another way, creating an "enum
> duplicator".
Well in my real code the "subtyped" enum has different field names but the same
values as another enum. Anyway it's not an issue as long as I can get the
length of the enum.
*** This issue has been marked as a duplicate of issue 4997 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list