Printing shortest decimal form of floating point number with Mir

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Jan 5 21:46:34 UTC 2021


On Tuesday, 5 January 2021 at 21:43:09 UTC, welkam wrote:
> 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);
> }

The example was a reduced case. One can trivially construct 
examples where that won't work.

It is very useful to create a simple alias from a complex type 
for export from a type library, then it breaks when people use 
that type library to write templated functions.

People do this all the time in C++.



More information about the Digitalmars-d-announce mailing list