From 12bd604f241d41d52ab3fde9f4a8f4f5c2f3fa6d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 12 Sep 2013 13:25:38 +0200 Subject: 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 --- src/concurrent/qtconcurrentmedian.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/concurrent/qtconcurrentmedian.h') diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h index b39b3ed32b..29342e6402 100644 --- a/src/concurrent/qtconcurrentmedian.h +++ b/src/concurrent/qtconcurrentmedian.h @@ -90,7 +90,7 @@ public: dirty = true; } - values[currentIndex] = value; + values[currentIndex] = qMove(value); } bool isMedianValid() const @@ -105,7 +105,7 @@ public: 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; + currentMedian = qMove(*mid); } return currentMedian; } -- cgit v1.2.3