From 23d7f6ee5dea3dd9f47f4ab538b25dc0ffe3df92 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 1 Nov 2012 21:47:25 +0100 Subject: Reimplement qBinaryFind in terms of std::lower_bound qBinaryFind is not going to be deprecated now. This commits prepares the deprecation of the qLowerBound function. Change-Id: I6131582c981c151d632ad44305fe602c76735e14 Reviewed-by: Thiago Macieira --- src/corelib/tools/qalgorithms.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 8337afcb9d..3bd3812e78 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -43,6 +43,7 @@ #define QALGORITHMS_H #include +#include QT_BEGIN_NAMESPACE @@ -292,7 +293,7 @@ template Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value) { // Implementation is duplicated from QAlgorithmsPrivate. - RandomAccessIterator it = qLowerBound(begin, end, value); + RandomAccessIterator it = std::lower_bound(begin, end, value); if (it == end || value < *it) return end; @@ -506,7 +507,7 @@ Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator template Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) { - RandomAccessIterator it = qLowerBoundHelper(begin, end, value, lessThan); + RandomAccessIterator it = std::lower_bound(begin, end, value, lessThan); if (it == end || lessThan(value, *it)) return end; -- cgit v1.2.3