UFCS with constructors

bearophile bearophileHUGS at lycos.com
Wed Nov 6 03:04:03 PST 2013


import std.typecons: Typedef;
alias Foo = Typedef!double;
void main() {
     auto a1 = Foo(1);
     pragma(msg, typeof(a1));
     auto a2 = 1.Foo;
     pragma(msg, typeof(a2));
     auto a3 = Foo(-1);
     pragma(msg, typeof(a3));
     auto a4 = -1.Foo;
     pragma(msg, typeof(a4));
}


It prints:

Typedef!(double, nan)
Typedef!(double, nan)
Typedef!(double, nan)
double


Is this expected/acceptable/good?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list