uniqueEnumMembers

Dynamic Variant of EnumMembers excluding the enumerator aliases.

@trusted
uniqueEnumMembers
(
T
)
()
if (
is(T == enum)
)

Examples

enum E { x, y, z, Z = z, Y = y }
import std.algorithm.comparison : equal;
assert(enumMembersAsEnumerators!E.equal([E.x, E.y, E.z, E.Z, E.Y])); // run-time
assert(uniqueEnumMembers!E.equal([E.x, E.y, E.z])); // run-time
// static assert(uniqueEnumMembers!E.equal([E.x, E.y, E.z])); // compile-time
static assert(E.x == 0);
static assert(E.y == 1);
static assert(E.z == 2);
static assert(E.Z == E.z);
static assert(E.Y == E.y);

See Also

Meta