From: Alkis Evlogimenos Date: Sun, 30 May 2004 07:45:09 +0000 (+0000) Subject: Add comparator useful for natural comparisons on collections with X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1da7e8e0b3cfc1d3c399da4cdd7dc5c087c9f0d3;p=oota-llvm.git 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 --- 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: