add range version of insert()
authorChris Lattner <sabre@nondot.org>
Mon, 2 Apr 2007 01:21:19 +0000 (01:21 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 2 Apr 2007 01:21:19 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35572 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallPtrSet.h

index a85b4974f89b4338caea0b101a0cbacea8f61425..6bd4d0927fe4444238256efef1b59e995ba4022a 100644 (file)
@@ -90,6 +90,12 @@ public:
   /// was already in the set.
   bool insert(void *Ptr);
   
+  template <typename IterT>
+  void insert(IterT I, IterT E) {
+    for (; I != E; ++I)
+      insert((void*)*I);
+  }
+  
   /// erase - If the set contains the specified pointer, remove it and return
   /// true, otherwise return false.
   bool erase(void *Ptr);
@@ -212,8 +218,7 @@ public:
   template<typename It>
   SmallPtrSet(It I, It E)
     : SmallPtrSetImpl(NextPowerOfTwo<SmallSizePowTwo>::Val) {
-    for (; I != E; ++I)
-      insert(*I);
+    insert(I, E);
   }
   
   typedef SmallPtrSetIterator<PtrType> iterator;