From 74adb1900a7f6f219339bd4ed2a74b5816b63d64 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 8 Feb 2016 01:47:00 +0100 Subject: QEasingCurve: add some strategic std::move() Move instead of copy the bezierCurves and tcbPoints containers when updating 'config' in setType_helper(). In Qt 5, we still have the unsharable container issue which causes code for deep copies to be emitted for most copy operations. A move is always just re-seating a pointer. Change-Id: Icff7415dd0ce44df0602273ff42370b26d831b85 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qeasingcurve.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index f1ad27b4c9..2851dc81d6 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1333,8 +1333,8 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) amp = config->_a; period = config->_p; overshoot = config->_o; - bezierCurves = config->_bezierCurves; - tcbPoints = config->_tcbPoints; + bezierCurves = std::move(config->_bezierCurves); + tcbPoints = std::move(config->_tcbPoints); delete config; config = 0; @@ -1349,8 +1349,8 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) config->_p = period; if (overshoot != -1.0) config->_o = overshoot; - config->_bezierCurves = bezierCurves; - config->_tcbPoints = tcbPoints; + config->_bezierCurves = std::move(bezierCurves); + config->_tcbPoints = std::move(tcbPoints); func = 0; } else if (newType != QEasingCurve::Custom) { func = curveToFunc(newType); -- cgit v1.2.3