On Friday, 29 March 2024 at 00:37:21 UTC, Jonathan M Davis wrote:
On Thursday, March 28, 2024 4:21:03 PM MDT Salih Dincer via Digitalmars-d- learn wrote:
How can we add all members of an enum type to a list without duplicating code?

As the documentation for EnumMembers explains, you can use std.meta.NoDuplicates to strip out duplicates if you want to do something like generate a switch statement from the list of enum members.

https://dlang.org/phobos/std_traits.html#EnumMembers

- Jonathan M Davis

I guess this falls into metaprogramming. Maybe we should expect this possibility from IDEs because I've seen something like this in VScode. All enum members were added automatically.

SDB@79

Reply via email to