aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-15 19:52:43 +0000
committerChris Lattner <sabre@nondot.org>2009-11-15 19:52:43 +0000
commit3ecb882db35446d5ee649d4d75b5e2de542c8c40 (patch)
tree18a0a20cb5feee7a0c5aad0079274dad43800730 /include
parent78799101733621457222fe31d32291664e8aa350 (diff)
downloadexternal_llvm-3ecb882db35446d5ee649d4d75b5e2de542c8c40.zip
external_llvm-3ecb882db35446d5ee649d4d75b5e2de542c8c40.tar.gz
external_llvm-3ecb882db35446d5ee649d4d75b5e2de542c8c40.tar.bz2
add a version of array_pod_sort that takes a custom comparator function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/STLExtras.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h
index 6f47692..a8b6133 100644
--- a/include/llvm/ADT/STLExtras.h
+++ b/include/llvm/ADT/STLExtras.h
@@ -270,6 +270,14 @@ static inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
get_array_pad_sort_comparator(*Start));
}
+template<class IteratorTy>
+static inline void array_pod_sort(IteratorTy Start, IteratorTy End,
+ int (*Compare)(const void*, const void*)) {
+ // Don't dereference start iterator of empty sequence.
+ if (Start == End) return;
+ qsort(&*Start, End-Start, sizeof(*Start), Compare);
+}
+
} // End llvm namespace
#endif