I have to use my operator as a comparator for the two pointer inputs but I am stuck on pushing those actual inputs in the queue as my comparator takes const int
as inputs while arrange takes int*
.
void arrange(int* a, int* b) {
std::priority_queue<int*, std::vector<int>, compr> q;
q.push(a);
q.push(b);
}
struct compr {
bool operator()(const int& lhs, const int& rhs) const {
if (lhs%2==0 && rhs%2==0) {
return lhs>rhs;
}
return false;
}
};