toStringFromEnumWithConsecutiveAliases

Fast and more generic implementation of std.conv.to for enumerations. TODO: Handle non-adjacent enumerator aliases.

@safe pure nothrow @safe @nogc
string
toStringFromEnumWithConsecutiveAliases
(
T
)
(
const scope T value
)
if (
is(T == enum)
)

Examples

enum E { unknown, x, y, z, z_ = z, }
assert(E.x.toStringFromEnumWithConsecutiveAliases == "x");
assert(E.y.toStringFromEnumWithConsecutiveAliases == "y");
assert(E.z.toStringFromEnumWithConsecutiveAliases == "z");
assert(E.z_.toStringFromEnumWithConsecutiveAliases == "z");

Meta