diff options
Diffstat (limited to 'include/llvm/ADT/STLExtras.h')
-rw-r--r-- | include/llvm/ADT/STLExtras.h | 8 |
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 |