X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FADT%2FPriorityQueue.h;h=a8809dc0b267629e77e66041efc0f24e85509528;hb=6de603071879bdc5d7d663826354c24a9d176469;hp=1cff0f2a0ceeaf0ca062a8e6209e18cb944c72bd;hpb=3627e34486db088661bc7fb6c0dde6a18a543217;p=oota-llvm.git diff --git a/include/llvm/ADT/PriorityQueue.h b/include/llvm/ADT/PriorityQueue.h index 1cff0f2a0ce..a8809dc0b26 100644 --- a/include/llvm/ADT/PriorityQueue.h +++ b/include/llvm/ADT/PriorityQueue.h @@ -20,7 +20,7 @@ namespace llvm { /// PriorityQueue - This class behaves like std::priority_queue and /// provides a few additional convenience functions. -/// +/// template, class Compare = std::less > @@ -51,7 +51,7 @@ public: // Logarithmic-time heap bubble-up. while (i != 0) { typename Sequence::size_type parent = (i - 1) / 2; - std::swap(this->c[i], this->c[parent]); + this->c[i] = this->c[parent]; i = parent; } @@ -70,6 +70,12 @@ public: void reheapify() { std::make_heap(this->c.begin(), this->c.end(), this->comp); } + + /// clear - Erase all elements from the queue. + /// + void clear() { + this->c.clear(); + } }; } // End llvm namespace