QScopedValueRollback: add two strategic qMove()s
Use moves instead of copies when the rhs is no longer needed afterwards. Change-Id: If053bfce03b886099688452ada74f6a6f36db5c2 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
fb144aabbf
commit
1ae657344c
@ -50,12 +50,12 @@ public:
|
||||
explicit QScopedValueRollback(T &var, T value) :
|
||||
varRef(var), oldValue(var)
|
||||
{
|
||||
varRef = value;
|
||||
varRef = qMove(value);
|
||||
}
|
||||
|
||||
~QScopedValueRollback()
|
||||
{
|
||||
varRef = oldValue;
|
||||
varRef = qMove(oldValue);
|
||||
}
|
||||
|
||||
void commit()
|
||||
|
Loading…
Reference in New Issue
Block a user