Add greater_ptr functor.
authorAlkis Evlogimenos <alkis@evlogimenos.com>
Wed, 21 Jul 2004 08:38:06 +0000 (08:38 +0000)
committerAlkis Evlogimenos <alkis@evlogimenos.com>
Wed, 21 Jul 2004 08:38:06 +0000 (08:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15070 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 961407f5040c84647ed1a187c8e7edc41f30527f..b6379d26232c725d1ca877e5475e29f73072c79a 100644 (file)
@@ -60,6 +60,13 @@ struct less_ptr : public std::binary_function<Ty, Ty, bool> {
   }
 };
 
+template<class Ty>
+struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
+  bool operator()(const Ty* left, const Ty* right) const {
+    return *right < *left;
+  }
+};
+
 // deleter - Very very very simple method that is used to invoke operator
 // delete on something.  It is used like this: 
 //
index 961407f5040c84647ed1a187c8e7edc41f30527f..b6379d26232c725d1ca877e5475e29f73072c79a 100644 (file)
@@ -60,6 +60,13 @@ struct less_ptr : public std::binary_function<Ty, Ty, bool> {
   }
 };
 
+template<class Ty>
+struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
+  bool operator()(const Ty* left, const Ty* right) const {
+    return *right < *left;
+  }
+};
+
 // deleter - Very very very simple method that is used to invoke operator
 // delete on something.  It is used like this: 
 //