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

Chris Lattner sabre at nondot.org
Sun Apr 1 18:21:36 PDT 2007



Changes in directory llvm/include/llvm/ADT:

SmallPtrSet.h updated: 1.9 -> 1.10
---
Log message:

add range version of insert()


---
Diffs of the changes:  (+7 -2)

 SmallPtrSet.h |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/ADT/SmallPtrSet.h
diff -u llvm/include/llvm/ADT/SmallPtrSet.h:1.9 llvm/include/llvm/ADT/SmallPtrSet.h:1.10
--- llvm/include/llvm/ADT/SmallPtrSet.h:1.9	Sat Mar  3 22:04:43 2007
+++ llvm/include/llvm/ADT/SmallPtrSet.h	Sun Apr  1 20:21:19 2007
@@ -90,6 +90,12 @@
   /// 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 @@
   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;






More information about the llvm-commits mailing list