From ace81b6fed6d976eaef390419e7831f31d485c23 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sat, 17 Feb 2018 19:45:57 +0330 Subject: [PATCH] check c++11 for move constructor --- src/phrase.cpp | 5 +++-- src/phrase.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/phrase.cpp b/src/phrase.cpp index ef2c143..874137f 100644 --- a/src/phrase.cpp +++ b/src/phrase.cpp @@ -258,11 +258,12 @@ ConditionalPhrase::ConditionalPhrase(const ConditionalPhrase &other) this->data = new PhraseData(other.data); } +#if __cplusplus >= 201103L ConditionalPhrase::ConditionalPhrase(const ConditionalPhrase &&other) { - qDebug() << "************* ctor called:"; - this->data = new PhraseData(other.data); + this->data = std::move(other.data); } +#endif ConditionalPhrase::ConditionalPhrase(const PhraseData *data) { diff --git a/src/phrase.h b/src/phrase.h index 52bc187..5aa782c 100644 --- a/src/phrase.h +++ b/src/phrase.h @@ -160,7 +160,9 @@ public: QSharedPointer rightDataPointer; ConditionalPhrase(); ConditionalPhrase(const ConditionalPhrase &other); +#if __cplusplus >= 201103L ConditionalPhrase(const ConditionalPhrase &&other); +#endif ConditionalPhrase(const PhraseData *data); ConditionalPhrase(AbstractFieldPhrase *, PhraseData::Condition); ConditionalPhrase(AbstractFieldPhrase *, PhraseData::Condition, const QVariant &v);