[llvm-commits] [llvm] r170527 - /llvm/trunk/include/llvm/ADT/MapVector.h
Benjamin Kramer
benny.kra at googlemail.com
Wed Dec 19 03:08:33 PST 2012
Author: d0k
Date: Wed Dec 19 05:08:33 2012
New Revision: 170527
URL: http://llvm.org/viewvc/llvm-project?rev=170527&view=rev
Log:
MapVector: Add lookup().
Modified:
llvm/trunk/include/llvm/ADT/MapVector.h
Modified: llvm/trunk/include/llvm/ADT/MapVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/MapVector.h?rev=170527&r1=170526&r2=170527&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/MapVector.h (original)
+++ llvm/trunk/include/llvm/ADT/MapVector.h Wed Dec 19 05:08:33 2012
@@ -79,6 +79,11 @@
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;
More information about the llvm-commits
mailing list