Enum

Enumeration wrapper that uses optimized conversion to string (via toString member).

@safe
struct Enum (
E
) if (
is(E == enum)
) {}

Alias This

_enum

Members

Properties

toString
string toString [@property getter]
Undocumented in source.

Variables

_enum
E _enum;
Undocumented in source.

Examples

enum X { a,
		 b,
		 _b = b			 // enumerator alias
}
alias EnumX = Enum!X;
assert(EnumX(X.a).toString == "a");
assert(EnumX(X.b).toString == "b");
assert(EnumX(X._b).toString == "b"); // alias encodes to original

See Also

https://forum.dlang.org/thread/ppndhxvzayedgpbjculm@forum.dlang.org?page=1

TODO: Move logic to std.conv.to.

Meta