From: David Blaikie Date: Thu, 13 Sep 2018 00:02:03 +0000 (+0000) Subject: STLExtras: Add some more algorithm wrappers X-Git-Tag: llvmorg-8.0.0-rc1~8837 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=911907ca3c77df7a80d19e1979586ec076798eb4;p=platform%2Fupstream%2Fllvm.git STLExtras: Add some more algorithm wrappers llvm-svn: 342102 --- diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 8b8a355..4c73a55 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -977,6 +977,10 @@ inline void sort(IteratorTy Start, IteratorTy End) { std::sort(Start, End); } +template inline void sort(Container &&C) { + llvm::sort(adl_begin(C), adl_end(C)); +} + template inline void sort(IteratorTy Start, IteratorTy End, Compare Comp) { #ifdef EXPENSIVE_CHECKS @@ -986,6 +990,11 @@ inline void sort(IteratorTy Start, IteratorTy End, Compare Comp) { std::sort(Start, End, Comp); } +template +inline void sort(Container &&C, Compare Comp) { + llvm::sort(adl_begin(C), adl_end(C), Comp); +} + //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===// @@ -1137,6 +1146,11 @@ auto upper_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range)) { return std::upper_bound(adl_begin(Range), adl_end(Range), I); } +template +auto upper_bound(R &&Range, ForwardIt I, Compare C) + -> decltype(adl_begin(Range)) { + return std::upper_bound(adl_begin(Range), adl_end(Range), I, C); +} /// Wrapper function around std::equal to detect if all elements /// in a container are same. template