mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
make use of std::lower_bound and std::upper_bound when build with STL
this assumes that the STL library supports C++11 Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
da72643035
commit
59bf73f74f
1 changed files with 9 additions and 4 deletions
|
@ -351,13 +351,10 @@ inline void qDeleteAll(const Container &c)
|
|||
namespace QAlgorithmsPrivate {
|
||||
|
||||
template <typename RandomAccessIterator, typename T, typename LessThan>
|
||||
#ifndef QT_NO_STL
|
||||
Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T & , LessThan lessThan)
|
||||
#else
|
||||
Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan)
|
||||
#endif
|
||||
{
|
||||
#ifndef QT_NO_STL
|
||||
Q_UNUSED(t);
|
||||
std::sort(start, end, lessThan);
|
||||
#else
|
||||
top:
|
||||
|
@ -498,6 +495,9 @@ inline void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator e
|
|||
template <typename RandomAccessIterator, typename T, typename LessThan>
|
||||
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
|
||||
{
|
||||
#ifndef QT_NO_STL
|
||||
return std::lower_bound(begin, end, value, lessThan);
|
||||
#else
|
||||
RandomAccessIterator middle;
|
||||
int n = int(end - begin);
|
||||
int half;
|
||||
|
@ -513,12 +513,16 @@ Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator
|
|||
}
|
||||
}
|
||||
return begin;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template <typename RandomAccessIterator, typename T, typename LessThan>
|
||||
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
|
||||
{
|
||||
#ifndef QT_NO_STL
|
||||
return std::upper_bound(begin, end, value, lessThan);
|
||||
#else
|
||||
RandomAccessIterator middle;
|
||||
int n = end - begin;
|
||||
int half;
|
||||
|
@ -534,6 +538,7 @@ Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator
|
|||
}
|
||||
}
|
||||
return begin;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename RandomAccessIterator, typename T, typename LessThan>
|
||||
|
|
Loading…
Add table
Reference in a new issue