diff --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h --- a/llvm/include/llvm/ADT/SetVector.h +++ b/llvm/include/llvm/ADT/SetVector.h @@ -263,6 +263,11 @@ remove(*SI); } + void swap(SetVector &RHS) { + set_.swap(RHS.set_); + vector_.swap(RHS.vector_); + } + private: /// A wrapper predicate designed for use with std::remove_if. /// @@ -308,4 +313,22 @@ } // end namespace llvm +namespace std { + +/// Implement std::swap in terms of SetVector swap. +template +inline void +swap(llvm::SetVector &LHS, llvm::SetVector &RHS) { + LHS.swap(RHS); +} + +/// Implement std::swap in terms of SmallSetVector swap. +template +inline void +swap(llvm::SmallSetVector &LHS, llvm::SmallSetVector &RHS) { + LHS.swap(RHS); +} + +} // end namespace std + #endif // LLVM_ADT_SETVECTOR_H