The priority_queue interface doesn’t have a clear() method (for no good reason I’ve ever been able to discern). A simple way to clear it is just to assign a new, empty queue:
priority_queue <int> q;
// use it
q = priority_queue <int>(); // reset it
The priority_queue interface doesn’t have a clear() method (for no good reason I’ve ever been able to discern). A simple way to clear it is just to assign a new, empty queue:
priority_queue <int> q;
// use it
q = priority_queue <int>(); // reset it