Step 2 of 6
Lambdas
A lambda is an unnamed function you write inline:
auto square = [](int x) { return x * x; };
square(5); // 25
[]is the capture list (more soon)(int x)are the parameters- the return type is deduced
Lambdas shine as arguments to algorithms. Here std::sort takes a third argument: a comparison that says whether a should come before b.
Your turn: sort the words by length, shortest first.