summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2012-11-01 21:47:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-07 00:31:20 +0200
commit23d7f6ee5dea3dd9f47f4ab538b25dc0ffe3df92 (patch)
tree99c07a6a638a8b7805d0d9698148176e7538dbc8
parent94a757665885443eaa199649492855aa75d4c5ec (diff)
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 <thiago.macieira@intel.com>
-rw-r--r--src/corelib/tools/qalgorithms.h5
1 files 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 <QtCore/qglobal.h>
+#include <algorithm>
QT_BEGIN_NAMESPACE
@@ -292,7 +293,7 @@ template <typename RandomAccessIterator, typename T>
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 <typename RandomAccessIterator, typename T, typename LessThan>
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;