QtConcurrent::Median: add some qMove()

In case this code is ever instantiated with a type that actually benefits from moving.

'value' is save to move since it was passed to the function by value.
'*mid' is save to move since it originates in a container that will be
 discarded on the next line anyway.

Change-Id: I13587be10974ba6cf95d56e0f8912ff88167b60b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2013-09-12 13:25:38 +02:00 committed by The Qt Project
parent 16a52882e7
commit 12bd604f24

View File

@ -90,7 +90,7 @@ public:
dirty = true; dirty = true;
} }
values[currentIndex] = value; values[currentIndex] = qMove(value);
} }
bool isMedianValid() const bool isMedianValid() const
@ -105,7 +105,7 @@ public:
QVector<T> copy = values; QVector<T> copy = values;
typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end(); typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end();
std::nth_element(begin, mid, end); std::nth_element(begin, mid, end);
currentMedian = *mid; currentMedian = qMove(*mid);
} }
return currentMedian; return currentMedian;
} }