import std.stdio;
import std.conv;
auto makeType(T, string X)()
{
mixin("enum makeTypeTemp" ~ " : " ~ "T" ~ " { " ~ X ~ " }");
makeTypeTemp temp;
return temp;
}
template choice(T, string X)
{
alias typeof({ auto x = makeType!(T, X); return x; }()) choice;
}
alias choice!(bool, "yes, no") Redraw;
alias choice!(int, "red, green, blue") Color;
void paint(Redraw redraw, Color color = Color.blue)
{
if (redraw == Redraw.yes)
{
writefln("Painting %s pixels.", to!string(color));
}
else
{
writefln("Not painting %s pixels.", to!string(color));
}
}
void main()
{
paint(Redraw.yes);
paint(Redraw.no, Color.red);
}