From 1da7e8e0b3cfc1d3c399da4cdd7dc5c087c9f0d3 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Sun, 30 May 2004 07:45:09 +0000 Subject: [PATCH] Add comparator useful for natural comparisons on collections with pointers to objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13909 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/Support/STLExtras.h | 6 ++++++ include/llvm/ADT/STLExtras.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/include/Support/STLExtras.h b/include/Support/STLExtras.h index 233b7438a4d..961407f5040 100644 --- a/include/Support/STLExtras.h +++ b/include/Support/STLExtras.h @@ -53,6 +53,12 @@ struct bitwise_or : public std::binary_function { } }; +template +struct less_ptr : public std::binary_function { + 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: diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index 233b7438a4d..961407f5040 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -53,6 +53,12 @@ struct bitwise_or : public std::binary_function { } }; +template +struct less_ptr : public std::binary_function { + 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: -- 2.34.1