Make SmallPtrSet iterators real iterators
[oota-llvm.git] / include / llvm / ADT / ImmutableMap.h
index 1b1014ea46bb0f5da86be1712450f173de71f748..52708bc8a10873ae2e11f9c08b5b60d46f5afc67 100644 (file)
@@ -18,8 +18,8 @@
 
 namespace llvm {
 
-/// ImutKeyValueInfo -Traits class used by ImmutableMap.  While both the first and
-/// second elements in a pair are used to generate profile information,
+/// ImutKeyValueInfo -Traits class used by ImmutableMap.  While both the first
+/// and second elements in a pair are used to generate profile information,
 /// only the first element (the key) is used by isEqual and isLess.
 template <typename T, typename S>
 struct ImutKeyValueInfo {
@@ -202,6 +202,13 @@ public:
 
     return 0;
   }
+  
+  /// getMaxElement - Returns the <key,value> pair in the ImmutableMap for
+  ///  which key is the highest in the ordering of keys in the map.  This
+  ///  method returns NULL if the map is empty.
+  value_type* getMaxElement() const {
+    return Root ? &(Root->getMaxElement()->getValue()) : 0;
+  }
 
   //===--------------------------------------------------===//
   // Utility methods.