[llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 28 14:52:23 PDT 2006



Changes in directory llvm/include/llvm/ADT:

SmallVector.h updated: 1.16 -> 1.17
---
Log message:

Add 2nd form of resize


---
Diffs of the changes:  (+12 -0)

 SmallVector.h |   12 ++++++++++++
 1 files changed, 12 insertions(+)


Index: llvm/include/llvm/ADT/SmallVector.h
diff -u llvm/include/llvm/ADT/SmallVector.h:1.16 llvm/include/llvm/ADT/SmallVector.h:1.17
--- llvm/include/llvm/ADT/SmallVector.h:1.16	Tue Aug 22 12:28:57 2006
+++ llvm/include/llvm/ADT/SmallVector.h	Mon Aug 28 16:52:08 2006
@@ -124,6 +124,18 @@
     }
   }
   
+  void resize(unsigned N, const T &NV) {
+    if (N < size()) {
+      destroy_range(Begin+N, End);
+      End = Begin+N;
+    } else if (N > size()) {
+      if (Begin+N > Capacity)
+        grow(N);
+      construct_range(End, Begin+N, NV);
+      End = Begin+N;
+    }
+  }
+  
   void swap(SmallVectorImpl &RHS);
   
   /// append - Add the specified range to the end of the SmallVector.






More information about the llvm-commits mailing list