Printing shortest decimal form of floating point number with Mir

welkam wwwelkam at gmail.com
Tue Jan 5 21:43:09 UTC 2021


On Wednesday, 23 December 2020 at 22:13:09 UTC, Ola Fosheim 
Grøstad wrote:
> The big picture that the DIP suggested was that when stuff like 
> this fails to compile:
>
>   struct Foo(T) {}
>
>   alias Bar(T) = Foo!T;
>
>   void f(T)(Bar!T x) {}
>
>   void main() {
>     auto foo = Bar!int();
>     f(foo);
>   }
>
> Then most programmers would just conclude that the compiler is 
> broken beyond repair and move on to another language.

Replace alias Bar(T) = Foo!T; with alias Bar = Foo;

struct Foo(T) {}

alias Bar = Foo;

void f(T)(Bar!T x) {}

void main() {
     auto foo = Bar!int();
     f(foo);
}


More information about the Digitalmars-d-announce mailing list