I'm trying to create a priority queue with a custom comparator:
std::priority_queue<int, std::vector<int>, MyComparator> pq;
My problem is that MyComparator has a method that stores additional state. Because MyComparator is copied to the priority queue (as far as I can tell), there's no way for me to call this method on the MyComparator instance held by the priority queue. Is there any way to either:
- get access to the MyComparator instance held by the priority queue, or:
- somehow pass the original MyComparator instance in by reference