forked from OSchip/llvm-project
Implement the remove method for deleting entries from the SetVector.
llvm-svn: 16283
This commit is contained in:
parent
1b34fde1cc
commit
9cfa81662f
|
@ -20,6 +20,7 @@
|
|||
#include <set>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -108,6 +109,16 @@ public:
|
|||
vector_.push_back(*Start);
|
||||
}
|
||||
|
||||
/// @brief Remove an item from the set vector.
|
||||
void remove(const value_type& X) {
|
||||
if (0 < set_.erase(X)) {
|
||||
iterator I = find(vector_.begin(),vector_.end(),X);
|
||||
if (I != vector_.end())
|
||||
vector_.erase(I);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// @returns 0 if the element is not in the SetVector, 1 if it is.
|
||||
/// @brief Count the number of elements of a given key in the SetVector.
|
||||
size_type count(const key_type &key) const {
|
||||
|
|
Loading…
Reference in New Issue