From ca588f40db9cb1ba0e3f223ca031b18524be4a09 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 19 Feb 2012 20:55:09 +0100 Subject: QEasingCurve: implement copy assignment operator inline Implement the copy-assignment operator inline, using the copy-swap idiom. This makes assignment strongly exception safe, but also simplifies maintainence, because op= is formulated in terms of the copy constructor now. Change-Id: I803c9100a520d659b685992237cb76fd114222c8 Reviewed-by: Thiago Macieira --- src/corelib/tools/qeasingcurve.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools/qeasingcurve.h') diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index 64e4027fc4..f3c7c9b618 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -82,7 +82,8 @@ public: QEasingCurve(const QEasingCurve &other); ~QEasingCurve(); - QEasingCurve &operator=(const QEasingCurve &other); + QEasingCurve &operator=(const QEasingCurve &other) + { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; } #ifdef Q_COMPILER_RVALUE_REFS QEasingCurve(QEasingCurve &&other) : d_ptr(other.d_ptr) { other.d_ptr = 0; } QEasingCurve &operator=(QEasingCurve &&other) -- cgit v1.2.3