I'm trying to make a vector of pairs of set: vector<pair<set<int>, set<int>>>
but I want to use different lambda comparators for the two sets.
I tried doing:
#include <bits/stdc++.h>
using namespace std;
int main() {
auto cmp = [&] (int a, int b) -> bool {
return a > b;
};
auto hi = [&] (int a, int b) -> bool {
return a < b;
};
vector<pair<set<int, decltype(cmp)>, set<int, decltype(hi)>>> lol(cmp, hi);
return 0;
}
but it gave me this error:
test.cpp:11:75: error: no matching function for call to ‘std::vector<std::pair<std::set<int, main()::<lambda(int, int)> >, std::set<int, main()::<lambda(int, int)> > > >::vector(main()::<lambda(int, int)>&, main()::<lambda(int, int)>&)’
ype(cmp)>, set<int, decltype(hi)>>> lol(cmp, hi);
^
compilation terminated due to -Wfatal-errors.
Also, is there any way to initialize the size of the vector as well? Please help.