[ADT] Add a sum type abstraction for pointer-like types.
[oota-llvm.git] / include / llvm / ADT / MapVector.h
index 0727383310a0cf49b607f1f34673b9bf2d1a4529..f19a50b7ba8450cce8c0d2c630abf220fdd170c6 100644 (file)
@@ -67,6 +67,11 @@ public:
     Vector.clear();
   }
 
+  void swap(MapVector &RHS) {
+    std::swap(Map, RHS.Map);
+    std::swap(Vector, RHS.Vector);
+  }
+
   ValueT &operator[](const KeyT &Key) {
     std::pair<KeyT, unsigned> Pair = std::make_pair(Key, 0);
     std::pair<typename MapType::iterator, bool> Result = Map.insert(Pair);
@@ -185,11 +190,9 @@ void MapVector<KeyT, ValueT, MapType, VectorType>::remove_if(Function Pred) {
 /// \brief A MapVector that performs no allocations if smaller than a certain
 /// size.
 template <typename KeyT, typename ValueT, unsigned N>
-class SmallMapVector
-    : public MapVector<KeyT, ValueT, SmallDenseMap<KeyT, unsigned, N>,
-                       SmallVector<std::pair<KeyT, ValueT>, N>> {
-public:
-  SmallMapVector() {}
+struct SmallMapVector
+    : MapVector<KeyT, ValueT, SmallDenseMap<KeyT, unsigned, N>,
+                SmallVector<std::pair<KeyT, ValueT>, N>> {
 };
 
 } // end namespace llvm