This is workaround for http gcc gnu org bugzilla show_bug cgi id 58800

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// This is a workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800
// Avoid using std::nth_element for stdlibc++ <= 4.7.3 || (>= 4.8.0 && <= 4.8.2)
#if defined(__GLIBCXX__) && (__GLIBCXX__ <= 20130411 || (__GLIBCXX__ >= 20130322 && __GLIBCXX__ <= 20131016))
QVector<T> sorted = values;
std::sort(sorted.begin(), sorted.end());
currentMedian = sorted.at(bufferSize / 2);
#else
QVector<T> copy = values;
typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end();
std::nth_element(begin, mid, end);
currentMedian = *mid;
#endif
// (c) Qt5.2.1/5.2.1/Src/qtbase/src/concurrent/qtconcurrentmedian.h