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

Chris Lattner sabre at nondot.org
Sat Feb 3 16:30:56 PST 2007



Changes in directory llvm/include/llvm/ADT:

SetVector.h updated: 1.12 -> 1.13
---
Log message:

Make SmallSetVector useful


---
Diffs of the changes:  (+5 -4)

 SetVector.h |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/ADT/SetVector.h
diff -u llvm/include/llvm/ADT/SetVector.h:1.12 llvm/include/llvm/ADT/SetVector.h:1.13
--- llvm/include/llvm/ADT/SetVector.h:1.12	Sat Feb  3 17:56:03 2007
+++ llvm/include/llvm/ADT/SetVector.h	Sat Feb  3 18:30:40 2007
@@ -32,7 +32,7 @@
 /// order of insertion.
 /// @brief A vector that has set insertion semantics.
 template <typename T, typename Vector = std::vector<T>,
-                      typename Set = std::set<T> >
+                      typename Set = SmallSet<T, 16> >
 class SetVector {
 public:
   typedef T value_type;
@@ -99,7 +99,7 @@
   /// @returns true iff the element was inserted into the SetVector.
   /// @brief Insert a new element into the SetVector.
   bool insert(const value_type &X) {
-    bool result = set_.insert(X).second;
+    bool result = set_.insert(X);
     if (result)
       vector_.push_back(X);
     return result;
@@ -109,13 +109,13 @@
   template<typename It>
   void insert(It Start, It End) {
     for (; Start != End; ++Start)
-      if (set_.insert(*Start).second)
+      if (set_.insert(*Start))
         vector_.push_back(*Start);
   }
 
   /// @brief Remove an item from the set vector.
   void remove(const value_type& X) {
-    if (0 < set_.erase(X)) {
+    if (set_.erase(X)) {
       typename vector_type::iterator I =
         std::find(vector_.begin(), vector_.end(), X);
       assert(I != vector_.end() && "Corrupted SetVector instances!");
@@ -152,6 +152,7 @@
 /// a certain size.
 template <typename T, unsigned N>
 class SmallSetVector : public SetVector<T, SmallVector<T, N>, SmallSet<T, N> > {
+public:
   SmallSetVector() {}
   
   /// @brief Initialize a SmallSetVector with a range of elements






More information about the llvm-commits mailing list