[llvm] r343937 - [clangd] NFC: Migrate to LLVM STLExtras API where possible
Kirill Bobyrev via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 7 07:49:41 PDT 2018
Author: omtcyfz
Date: Sun Oct 7 07:49:41 2018
New Revision: 343937
URL: http://llvm.org/viewvc/llvm-project?rev=343937&view=rev
Log:
[clangd] NFC: Migrate to LLVM STLExtras API where possible
This patch improves readability by migrating `std::function(ForwardIt
start, ForwardIt end, ...)` to LLVM's STLExtras range-based equivalent
`llvm::function(RangeT &&Range, ...)`.
Similar change in Clang: D52576.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D52650
Modified:
llvm/trunk/include/llvm/ADT/STLExtras.h
Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=343937&r1=343936&r2=343937&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Sun Oct 7 07:49:41 2018
@@ -1139,6 +1139,12 @@ auto lower_bound(R &&Range, ForwardIt I)
return std::lower_bound(adl_begin(Range), adl_end(Range), I);
}
+template <typename R, typename ForwardIt, typename Compare>
+auto lower_bound(R &&Range, ForwardIt I, Compare C)
+ -> decltype(adl_begin(Range)) {
+ return std::lower_bound(adl_begin(Range), adl_end(Range), I, C);
+}
+
/// Provide wrappers to std::upper_bound which take ranges instead of having to
/// pass begin/end explicitly.
template <typename R, typename ForwardIt>
More information about the llvm-commits
mailing list