Printing shortest decimal form of floating point number with Mir

ag0aep6g anonymous at example.com
Mon Jan 4 15:31:02 UTC 2021


On 04.01.21 16:03, jmh530 wrote:
> IMO, this is a better example, even if it's a little more verbose.
> 
> struct Foo(T) {}
> 
> alias Bar(T) = Foo!T;
> 
> void f(T)(Bar!T x) {}
> 
> void main() {
>      auto x = Bar!int();
>      f(x);
> }

To be sure that I'm not missing anything: You just added the temporary 
`x`, right? I don't think that changes anything. The type of the 
argument is `Foo!int` in all variations of the code we've seen, 
including this one. And that type is all that DMD sees when it attempts 
IFTI of `f`.


More information about the Digitalmars-d-announce mailing list