summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-04 00:30:40 +0000
committerChris Lattner <sabre@nondot.org>2007-02-04 00:30:40 +0000
commit5fcaf3ed141a3f0246e41f45077dbb7d7d0b11d3 (patch)
treec071ab8132ad9c8c9badacdd633460c14d705501
parent00755df36c1448ac4728a74d907aa09e3d8b2d49 (diff)
downloadllvm-5fcaf3ed141a3f0246e41f45077dbb7d7d0b11d3.tar.gz
llvm-5fcaf3ed141a3f0246e41f45077dbb7d7d0b11d3.tar.bz2
llvm-5fcaf3ed141a3f0246e41f45077dbb7d7d0b11d3.tar.xz
Make SmallSetVector useful
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33854 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/SetVector.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/ADT/SetVector.h b/include/llvm/ADT/SetVector.h
index ec3fd536b3..7675534025 100644
--- a/include/llvm/ADT/SetVector.h
+++ b/include/llvm/ADT/SetVector.h
@@ -32,7 +32,7 @@ namespace llvm {
/// 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 @@ public:
/// @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 @@ public:
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 @@ private:
/// 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