Revert "QTest: use nth_element to calculate the median"
This reverts commit 48586b2bac
.
This causes problems in QtCreator without anyone being able to say why.
Task-number: QTBUG-34397
Change-Id: I9ea5457724d5af8d87e0bc40e6615748daf9c04c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
parent
0884802bb5
commit
770ab026a8
@ -1631,14 +1631,13 @@ QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container)
|
||||
if (count == 1)
|
||||
return container.front();
|
||||
|
||||
QList<QBenchmarkResult> containerCopy = container;
|
||||
std::sort(containerCopy.begin(), containerCopy.end());
|
||||
|
||||
const int middle = count / 2;
|
||||
|
||||
QList<QBenchmarkResult> containerCopy = container;
|
||||
const QList<QBenchmarkResult>::iterator begin = containerCopy.begin(), mid = begin + middle, end = containerCopy.end();
|
||||
std::nth_element(begin, mid, end);
|
||||
|
||||
// ### handle even-sized containers here by doing an aritmetic mean of the two middle items.
|
||||
return *mid;
|
||||
return containerCopy.at(middle);
|
||||
}
|
||||
|
||||
struct QTestDataSetter
|
||||
|
Loading…
Reference in New Issue
Block a user