MapVector: Add lookup().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170527 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2012-12-19 11:08:33 +00:00
parent fdbeb057b8
commit fc8657be34

View File

@ -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;