In C++14 something like this was made legal (for lambdas
) :-
auto l = [](auto x, auto y) { return x+y; };
However something like this is still not legal :-
auto sum (auto x, auto y)
{
return x+y;
}
My curiosity is why wasn't the second one added to the standard (though it is supposed to be added in C++17 hopefully) ? What were the pros & cons of the second one ?
It wasn't added because it's another thing to add and time is not infinite. We cannot expect all useful enhancements to be added in one go, can we? As you have identified, it will be in C++17.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With