// 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 sorted = values; std::sort(sorted.begin(), sorted.end()); currentMedian = sorted.at(bufferSize / 2); #else QVector copy = values; typename QVector::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