Referencing What is a lambda (function)?
I noticed there was not a C++ solution among the interesting answers.
So I played a little with a C++ solution.
I wonder if this code is a valid C++ version of the adder()
function ?
//to accept the 19 i need a rvalue ref.
auto adder = [](int&& x) { auto rv = [&x](int y) {return x + y; };return rv;};
//the similar line to most examples:
auto add5 = adder(19);
std::cout<<"val : "<<add5(4);