module pind.samples.ja.cond_comp.cond_comp_4; import std.stdio; struct MyType(T) { static if (is (T == float)) { alias ResultType = double; } else static if (is (T == double)) { alias ResultType = real; } else { static assert(false, T.stringof ~ " is not supported"); } ResultType doWork() { writefln("The return type for %s is %s.", T.stringof, ResultType.stringof); ResultType result; // ... return result; } } void main() { auto f = MyType!float(); f.doWork(); auto d = MyType!double(); d.doWork(); }