I have the following code that works
auto comp = [&](const auto &x, const auto &y) {
return a[x] < a[y] || (a[x] == a[y] && x < y);
};
priority_queue <int, vector <int>, decltype(comp)> q(comp); // works
And I want to create two of the PQs here like this:
auto comp = [&](const auto &x, const auto &y) {
return a[x] < a[y] || (a[x] == a[y] && x < y);
};
priority_queue <int, vector <int>, decltype(comp)> q(comp)[2]; // doesn't work
so I can't seem to understand what are the semantics here.
For simple PQ declaring an array of them works:
priority_queue <int> q[2]; // works :(
Just looking for way to create two lambda queues with indexing q[0] and q[1], but can't seem grasp documentation on it.
*Edit: Thank you everyone!
Could I ask follow up here: what to do if I wanted more queues, some q[N]?