From: Douglas Gregor Date: Tue, 9 Oct 2012 17:49:42 +0000 (+0000) Subject: Allow MapVector clients to specify the map and vector types, and add a X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=289c39965b1b799a22534d759fdf0a26302430d7;p=oota-llvm.git Allow MapVector clients to specify the map and vector types, and add a clear() method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165514 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/MapVector.h b/include/llvm/ADT/MapVector.h index bad207baa90..ffe1cd3eef3 100644 --- a/include/llvm/ADT/MapVector.h +++ b/include/llvm/ADT/MapVector.h @@ -26,10 +26,10 @@ namespace llvm { /// This class implements a map that also provides access to all stored values /// in a deterministic order. The values are kept in a std::vector and the /// mapping is done with DenseMap from Keys to indexes in that vector. -template +template, + typename VectorType = std::vector >> class MapVector { - typedef llvm::DenseMap MapType; - typedef std::vector > VectorType; typedef typename VectorType::size_type SizeType; MapType Map; @@ -63,6 +63,11 @@ public: return Vector.empty(); } + void clear() { + Map.clear(); + Vector.clear(); + } + ValueT &operator[](const KeyT &Key) { std::pair Pair = std::make_pair(Key, 0); std::pair Result = Map.insert(Pair);