[llvm-commits] CVS: llvm/include/Support/STLExtras.h

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun May 30 02:49:01 PDT 2004


Changes in directory llvm/include/Support:

STLExtras.h updated: 1.15 -> 1.16

---
Log message:

Add comparator useful for natural comparisons on collections with
pointers to objects.


---
Diffs of the changes:  (+6 -0)

Index: llvm/include/Support/STLExtras.h
diff -u llvm/include/Support/STLExtras.h:1.15 llvm/include/Support/STLExtras.h:1.16
--- llvm/include/Support/STLExtras.h:1.15	Mon Feb 23 21:47:25 2004
+++ llvm/include/Support/STLExtras.h	Sun May 30 02:45:09 2004
@@ -53,6 +53,12 @@
   }
 };
 
+template<class Ty>
+struct less_ptr : public std::binary_function<Ty, Ty, bool> {
+  bool operator()(const Ty* left, const Ty* right) const {
+    return *left < *right;
+  }
+};
 
 // deleter - Very very very simple method that is used to invoke operator
 // delete on something.  It is used like this: 





More information about the llvm-commits mailing list