sorry, i forgot everything. here is example of how to do this -----
import std.conv : to; enum Test { One, Two, Three, } template to(T: string) { T to(A: Test)(A val) { final switch (val) { case Test.One: return "1"; case Test.Two: return "2"; case Test.Three: return "3"; } } } void main() { assert(to!string(Test.One) == "1"); auto t = cast(Test)2; assert(to!string(t) == "3"); assert(to!int("4") == 4); // shows original to! template works }