From: Fangrui Song Date: Mon, 22 Apr 2019 15:19:13 +0000 (+0000) Subject: STLExtras: add stable_sort wrappers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=28772f13e689a5dd83919b679e8d8599119149d3;p=llvm STLExtras: add stable_sort wrappers git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358893 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index d63b819715c..33aced92e3e 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -1305,6 +1305,16 @@ auto upper_bound(R &&Range, T &&Value, Compare C) std::forward(Value), C); } +template +void stable_sort(R &&Range) { + std::stable_sort(adl_begin(Range), adl_end(Range)); +} + +template +void stable_sort(R &&Range, Compare C) { + std::stable_sort(adl_begin(Range), adl_end(Range), C); +} + /// Binary search for the first index where a predicate is true. /// Returns the first I in [Lo, Hi) where C(I) is true, or Hi if it never is. /// Requires that C is always false below some limit, and always true above it.