message: add move constructor

This commit is contained in:
Dirk-Jan C. Binnema
2022-04-22 08:08:51 +03:00
parent 4a135e70fb
commit f0bfb38ff2
2 changed files with 33 additions and 8 deletions

View File

@ -129,13 +129,28 @@ Message::Message(Message::Options opts, const std::string& text, const std::stri
fill_document(*priv_);
}
Message::Message(Message&& msg) = default;
Message::Message(Document& doc):
Message::Message(Message&& other) noexcept
{
*this = std::move(other);
}
Message&
Message::operator=(Message&& other) noexcept
{
if (this != &other)
priv_ = std::move(other.priv_);
return *this;
}
Message::Message(Document&& doc):
priv_{std::make_unique<Private>()}
{
priv_->doc = doc;
priv_->doc = std::move(doc);
}
Message::~Message() = default;
const Mu::Document&