template auto deduction

Alex sascha.orlov at gmail.com
Fri Oct 6 21:52:49 UTC 2017


On Friday, 6 October 2017 at 21:42:40 UTC, Steven Schveighoffer 
wrote:
>
> What you need is IFTI or "Implicit Function Template 
> Instantiation"
>
> Note the "Function" part of it, in that it's only valid for 
> functions.
>
> So you need a factory function:
>
> auto m(T)(T x)
> {
>   return M!(T)(x);
> }
>
> ...
>
> auto b = m(fs); // ok
>
> There is an enhancement request to make constructors have the 
> same mechanism. Not sure if or when it would be implemented.
>
> -Steve

Ha! Yes :)
Thanks a lot :)
That's what is meant by convenience methods inside the library, 
sometimes...


More information about the Digitalmars-d-learn mailing list