H. S. Teoh:

What's wrong with just writing auto?

        auto sqr = a => a^^2;
        auto r = [1,2,3].map!sqr;

auto is used to use the type of the value on the right. But "a => a^^2" is not a value, it can't be assigned to a variable, because it's not a lambda.

To use auto you need to give a type, creating a lambda:

auto sqr = (int a) => a ^^ 2;

Bye,
bearophile

Reply via email to