Add comparator useful for natural comparisons on collections with
authorAlkis Evlogimenos <alkis@evlogimenos.com>
Sun, 30 May 2004 07:45:09 +0000 (07:45 +0000)
committerAlkis Evlogimenos <alkis@evlogimenos.com>
Sun, 30 May 2004 07:45:09 +0000 (07:45 +0000)
pointers to objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13909 91177308-0d34-0410-b5e6-96231b3b80d8

include/Support/STLExtras.h
include/llvm/ADT/STLExtras.h

index 233b7438a4d51a8142d4e59b35635fbfa7702f5c..961407f5040c84647ed1a187c8e7edc41f30527f 100644 (file)
@@ -53,6 +53,12 @@ struct bitwise_or : public std::binary_function<Ty, Ty, bool> {
   }
 };
 
+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: 
index 233b7438a4d51a8142d4e59b35635fbfa7702f5c..961407f5040c84647ed1a187c8e7edc41f30527f 100644 (file)
@@ -53,6 +53,12 @@ struct bitwise_or : public std::binary_function<Ty, Ty, bool> {
   }
 };
 
+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: