From 75fbd1c604b722c13c946c7268d40ec87a9196b8 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Mon, 22 Apr 2019 15:19:13 +0000 Subject: [PATCH] STLExtras: add stable_sort wrappers llvm-svn: 358893 --- llvm/include/llvm/ADT/STLExtras.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index d63b819..33aced9 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/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. -- 2.7.4