This question already has an answer here:
- What is a lambda expression in C++11? 9 answers
See for example (taken from Haker Rank)
string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) {
return x == y and x == ' ';
});
I understand that the third arguement of the unique() method is a function --- is this just a way of defining a function inside calling a function? What is this type of formatting called, so I can read more about it. And what is the []
mean in this case?
Aucun commentaire:
Enregistrer un commentaire