C++ 23 · Containers and algorithms
Sort with a custom order
Sort descending by passing a lambda comparator.
std::sort(v.begin(), v.end(), [](int a, int b) { return a > b; });
C++ 23 · Containers and algorithms
Sort descending by passing a lambda comparator.
std::sort(v.begin(), v.end(), [](int a, int b) { return a > b; });
Was this page helpful?