From 670b872f3076fb998e16d3539bb851800faff419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sun, 21 Aug 2022 17:02:03 +0200 Subject: [PATCH] implemented move constructor for `TemplateSimplifier::TokenAndName` (#4390) --- lib/templatesimplifier.cpp | 8 ++++++++ lib/templatesimplifier.h | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index a9e5ec5d6..02a021d21 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -234,6 +234,14 @@ TemplateSimplifier::TokenAndName::TokenAndName(const TokenAndName& other) : mToken->templateSimplifierPointer(this); } +TemplateSimplifier::TokenAndName::TokenAndName(TokenAndName&& other) : + mToken(other.mToken), mScope(std::move(other.mScope)), mName(std::move(other.mName)), mFullName(std::move(other.mFullName)), + mNameToken(other.mNameToken), mParamEnd(other.mParamEnd), mFlags(other.mFlags) +{ + if (mToken) + mToken->templateSimplifierPointer(this); +} + TemplateSimplifier::TokenAndName::~TokenAndName() { if (mToken && mToken->templateSimplifierPointers()) diff --git a/lib/templatesimplifier.h b/lib/templatesimplifier.h index 68e4693be..900403361 100644 --- a/lib/templatesimplifier.h +++ b/lib/templatesimplifier.h @@ -148,6 +148,7 @@ public: */ TokenAndName(Token *token, std::string scope, const Token *nameToken, const Token *paramEnd); TokenAndName(const TokenAndName& other); + TokenAndName(TokenAndName&& other); ~TokenAndName(); bool operator == (const TokenAndName & rhs) const {