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://review.tizen.org/git/?a=commitdiff_plain;h=62692ce7f3a4f5a69dc65bef888f4cc79c26a203;p=platform%2Fupstream%2Fllvm.git Allow MapVector clients to specify the map and vector types, and add a clear() method. llvm-svn: 165514 --- diff --git a/llvm/include/llvm/ADT/MapVector.h b/llvm/include/llvm/ADT/MapVector.h index bad207b..ffe1cd3 100644 --- a/llvm/include/llvm/ADT/MapVector.h +++ b/llvm/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);