Read more about C++11 at least (or C++14 or C++17), e.g. some good C++ programming book (any standard older than C++11 is obsolete, and C++11 has evolved a lot since its predecessors, so you should almost consider C++11 as a new programming language). Look also some C++ reference site.
[](const string &left, const string &right)
starts a lambda expression, that is an anonymous function implemented as a closure.
Then you have a range-for loop: for (const string &s : a)
which could even be for (const auto& s: a)
or in your case for (auto s: a)
because the auto
specifier brings a limited form of type inference.
Read also SICP to improve your views on programming (it is not about C++, but an excellent and freely downloadable introduction to programming).
2
solved Compare inline function in std::sort()