Add a clear method to SmallVector
authorChris Lattner <sabre@nondot.org>
Mon, 7 Aug 2006 05:45:34 +0000 (05:45 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 7 Aug 2006 05:45:34 +0000 (05:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29542 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallVector.h

index 9b760949e9566068a80b2382b18c2869b1861121..34c915039fe453ddaceb40cecf60ecaa19009daa 100644 (file)
@@ -125,6 +125,13 @@ public:
     End->~T();
   }
   
+  void clear() {
+    while (End != Begin) {
+      End->~T();
+      --End;
+    }
+  }
+  
   /// append - Add the specified range to the end of the SmallVector.
   ///
   template<typename in_iter>