| 110 | // Add a new element to the end of the array and then heapify. This is an |
| 111 | // O(log n) operation. |
| 112 | void IR_ALWAYS_INLINE Push(const T& v) { |
| 113 | // Insert the new element v at the end. |
| 114 | elements_.emplace_back(v); |
| 115 | // Move up the new element and its ancestors if necessary (all the way to the |
| 116 | // element at index 0) to maintain the heap property. |
| 117 | HeapifySubtreeUp(0, Size() - 1); |
| 118 | } |
| 119 | |
| 120 | // Remove the top element from the priority queue and then heapify affected |
| 121 | // elements. This is an O(log n) operation. Must not be called when the queue |
no outgoing calls