Revert "Reimplement qBinaryFind in terms of std::lower_bound"
After a bit of discussion, we should actually deprecate qBinaryFind too.
This puts the old code back (to avoid behavior changes / source
breaks).
This reverts commit 23d7f6ee5d
.
Task-number: QTBUG-33473
Change-Id: I7f7d25171e14061e51543c501c30a7b6b184a8fd
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
7d7e8ae3fa
commit
f4cc344e01
@ -43,7 +43,6 @@
|
||||
#define QALGORITHMS_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -293,7 +292,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 = std::lower_bound(begin, end, value);
|
||||
RandomAccessIterator it = qLowerBound(begin, end, value);
|
||||
|
||||
if (it == end || value < *it)
|
||||
return end;
|
||||
@ -507,7 +506,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 = std::lower_bound(begin, end, value, lessThan);
|
||||
RandomAccessIterator it = qLowerBoundHelper(begin, end, value, lessThan);
|
||||
|
||||
if (it == end || lessThan(value, *it))
|
||||
return end;
|
||||
|
Loading…
Reference in New Issue
Block a user