cannot deduce template lambda from argument
aliak
something at something.com
Tue Dec 5 23:01:43 UTC 2017
Hi,
Having a little trouble understanding lambda type deduction. I
have this lambda:
immutable lambda(T) = (T n) => n * n;
and if I call it with an explicit type it works else it errors
with: lambda cannot deduce function from argument types !()(int)
auto x = lambda!int(2); // ok
auto x = lambda(2); // errors
But if it's a normal template function then calling it without
explicit type is ok.
Thanks for any help!
More information about the Digitalmars-d-learn
mailing list