Lambdas¶
An anonymous function object created inline.
Syntax¶
[captures](params) mutable noexcept -> return_type { body }
Comparator Example¶
std::sort(v.begin(), v.end(), [](int a, int b){ return a>b; });
Captures¶
[]none,[=]by value,[&]by reference,[x]specific,[=,&y]mixed.mutablepermits modifying value-captures inside the lambda.