Function parameter type inference: is this example working as intended?

Nathan S. no.public.email at example.com
Wed Sep 5 02:33:47 UTC 2018


The below writes "uint". Is this working as intended?
https://run.dlang.io/is/Dx2e7f

---
import std.stdio;

auto foo(T = uint)(uint x)
{
     return T.stringof;
}

auto foo(T = ulong)(ulong x)
{
     return T.stringof;
}

void main()
{
     writeln(foo(10L));
}
---


More information about the Digitalmars-d-learn mailing list