c++ pass a with set comparator code example
Example: c++ set comparator
set<int, less<int>> st;
// or
set<int, greater<int>> st;
// c++ 11
auto cmp = [](int a, int b) { return ... };
set<int, decltype(cmp)> s(cmp);
set<int, less<int>> st;
// or
set<int, greater<int>> st;
// c++ 11
auto cmp = [](int a, int b) { return ... };
set<int, decltype(cmp)> s(cmp);