Idea: Reverse Type Inference
Enamex via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jun 3 16:37:24 PDT 2017
On Wednesday, 24 May 2017 at 15:02:05 UTC, Steven Schveighoffer
wrote:
> In fact, you could simulate overloading of return values based
> on IFTI instantiation:
>
> void fooImpl(ref int retval, int x) { ... }
> void fooImpl(ref string retval, int x) { ... }
>
> T foo(T)(int x) { T t; fooImpl(t, x); return t; }
> int x = foo(1);
> string y = foo(2);
>
> -Steve
https://dpaste.dzfl.pl/7d8351fe2f07
What am I doing wrong?
More information about the Digitalmars-d
mailing list