[llvm-commits] [llvm] r52646 - /llvm/trunk/include/llvm/ADT/PriorityQueue.h

Dan Gohman gohman at apple.com
Mon Jun 23 14:46:21 PDT 2008


Author: djg
Date: Mon Jun 23 16:46:21 2008
New Revision: 52646

URL: http://llvm.org/viewvc/llvm-project?rev=52646&view=rev
Log:
Simplify erase_one slightly. It's not necessary to preserve
the value of the element to be erased while the heap is
being updated.

Modified:
    llvm/trunk/include/llvm/ADT/PriorityQueue.h

Modified: llvm/trunk/include/llvm/ADT/PriorityQueue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PriorityQueue.h?rev=52646&r1=52645&r2=52646&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/PriorityQueue.h (original)
+++ llvm/trunk/include/llvm/ADT/PriorityQueue.h Mon Jun 23 16:46:21 2008
@@ -51,7 +51,7 @@
     // 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;
     }
 





More information about the llvm-commits mailing list