summaryrefslogtreecommitdiff
path: root/llvm/include/llvm/ADT/SetVector.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/ADT/SetVector.h')
-rw-r--r--llvm/include/llvm/ADT/SetVector.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h
index d0a0d28d1c813..91ad72143ed35 100644
--- a/llvm/include/llvm/ADT/SetVector.h
+++ b/llvm/include/llvm/ADT/SetVector.h
@@ -174,7 +174,7 @@ public:
set_.erase(V);
// FIXME: No need to use the non-const iterator when built with
- // std:vector.erase(const_iterator) as defined in C++11. This is for
+ // std::vector.erase(const_iterator) as defined in C++11. This is for
// compatibility with non-standard libstdc++ up to 4.8 (fixed in 4.9).
auto NI = vector_.begin();
std::advance(NI, std::distance<iterator>(NI, I));
@@ -263,6 +263,11 @@ public:
remove(*SI);
}
+ void swap(SetVector<T, Vector, Set> &RHS) {
+ set_.swap(RHS.set_);
+ vector_.swap(RHS.vector_);
+ }
+
private:
/// A wrapper predicate designed for use with std::remove_if.
///
@@ -308,4 +313,22 @@ public:
} // end namespace llvm
+namespace std {
+
+/// Implement std::swap in terms of SetVector swap.
+template<typename T, typename V, typename S>
+inline void
+swap(llvm::SetVector<T, V, S> &LHS, llvm::SetVector<T, V, S> &RHS) {
+ LHS.swap(RHS);
+}
+
+/// Implement std::swap in terms of SmallSetVector swap.
+template<typename T, unsigned N>
+inline void
+swap(llvm::SmallSetVector<T, N> &LHS, llvm::SmallSetVector<T, N> &RHS) {
+ LHS.swap(RHS);
+}
+
+} // end namespace std
+
#endif // LLVM_ADT_SETVECTOR_H