How to search for an enum by values and why enum items aren't unique

stunaep via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 20 11:08:14 PDT 2016


On Wednesday, 20 July 2016 at 05:45:21 UTC, Jonathan M Davis 
wrote:
> On Wednesday, July 20, 2016 04:03:23 stunaep via 
> Digitalmars-d-learn wrote:
>> [...]
>
> If you want the list of members in an enum, then use 
> std.traits.EnumMembers and you'll get a compile-time list of 
> them. It can be made into a runtime list by being put into an 
> array literal.
>
> [...]

Coming from Java I've learned to love enums that are separate 
objects, that can store multiple values, and that can have 
methods that can be in their scope. Seems to me like there's no 
reason to even use enums in D. What's the point when just making 
a constant would do the same exact thing?


More information about the Digitalmars-d-learn mailing list