On Wednesday, 6 November 2013 at 11:04:05 UTC, bearophile wrote:
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?

Operator precedence of "." is higher than unary minus. That should be the explanation, why the fourth output is different than the others.

However, what is Typedef for?

Reply via email to