Add move constructors for OwningPtr and OwningArrayPtr.
[oota-llvm.git] / include / llvm / ADT / MapVector.h
index ffe1cd3eef3a6cb8b9a71555bdad822296828850..6aacca5a6f0fc5c17c87ae1f9fb9fb4dd868cee4 100644 (file)
@@ -28,7 +28,7 @@ namespace llvm {
 /// mapping is done with DenseMap from Keys to indexes in that vector.
 template<typename KeyT, typename ValueT,
          typename MapType = llvm::DenseMap<KeyT, unsigned>,
-         typename VectorType = std::vector<std::pair<KeyT, ValueT> >>
+         typename VectorType = std::vector<std::pair<KeyT, ValueT> > >
 class MapVector {
   typedef typename VectorType::size_type SizeType;
 
@@ -78,6 +78,11 @@ public:
     }
     return Vector[I].second;
   }
+
+  unsigned count(const KeyT &Key) const {
+    typename MapType::const_iterator Pos = Map.find(Key);
+    return Pos == Map.end()? 0 : 1;
+  }
 };
 
 }