Return type deduction

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 5 03:25:55 PDT 2016


Dne 5.9.2016 v 11:59 Andrea Fontana via Digitalmars-d napsal(a):

> I asked this some time (years?) ago. Time for a second try :)
>
> Consider this:
>
> ---
>
> T simple(T)() { return T.init; }
>
>
> void main()
> {
>     int test = simple!int(); // it compiles
>     int test2 = simple();    // it doesn't
> }
>
> ---
>
> Is there any chance to implement this kind of deduction?
> Please notice that it doesn't break any existing code, I guess.
> ...
> Andrea

AFAIK this is impossible



More information about the Digitalmars-d mailing list