forked from OSchip/llvm-project
add a version of array_pod_sort that takes a custom comparator function.
llvm-svn: 88861
This commit is contained in:
parent
7ade203c6c
commit
8938c85eb5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue