forked from qt-creator/qt-creator
Wizards: Add move semantics to shared data class template
Fixes: QTCREATORBUG-30526 Change-Id: I9a3423fcbbc19a26876bf1d6c863285639449df3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
%{JS: Cpp.licenseTemplate()}\
|
||||
#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}"
|
||||
|
||||
@if '%{IncludeQSharedData}'
|
||||
#include <utility>
|
||||
|
||||
@endif
|
||||
%{JS: Cpp.openNamespaces('%{Class}')}
|
||||
@if '%{IncludeQSharedData}'
|
||||
class %{CN}Data : public QSharedData
|
||||
@@ -32,10 +37,23 @@ public:
|
||||
|
||||
}
|
||||
|
||||
%{CN}::%{CN}(%{CN} &&rhs)
|
||||
: data{std::move(rhs.data)}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
%{CN} &%{CN}::operator=(const %{CN} &rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
data.operator=(rhs.data);
|
||||
data = rhs.data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
%{CN} &%{CN}::operator=(%{CN} &&rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
data = std::move(rhs.data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,9 @@ public:
|
||||
@endif
|
||||
@if '%{IncludeQSharedData}'
|
||||
%{CN}(const %{CN} &);
|
||||
%{CN}(%{CN} &&);
|
||||
%{CN} &operator=(const %{CN} &);
|
||||
%{CN} &operator=(%{CN} &&);
|
||||
~%{CN}();
|
||||
@endif
|
||||
@if %{isQObject}
|
||||
|
Reference in New Issue
Block a user