From: Benjamin Kramer Date: Wed, 19 Dec 2012 11:08:33 +0000 (+0000) Subject: MapVector: Add lookup(). X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44ba3753ad49330daf5c6f60ef35cafa5bffbf84;p=platform%2Fupstream%2Fllvm.git MapVector: Add lookup(). llvm-svn: 170527 --- diff --git a/llvm/include/llvm/ADT/MapVector.h b/llvm/include/llvm/ADT/MapVector.h index 42f8e55..c34e32a 100644 --- a/llvm/include/llvm/ADT/MapVector.h +++ b/llvm/include/llvm/ADT/MapVector.h @@ -79,6 +79,11 @@ public: return Vector[I].second; } + ValueT lookup(const KeyT &Key) const { + typename MapType::const_iterator Pos = Map.find(Key); + return Pos == Map.end()? ValueT() : Vector[Pos->second].second; + } + unsigned count(const KeyT &Key) const { typename MapType::const_iterator Pos = Map.find(Key); return Pos == Map.end()? 0 : 1;