diff --git a/include/exiv2/tags.hpp b/include/exiv2/tags.hpp index cfcff104..7c735a82 100644 --- a/include/exiv2/tags.hpp +++ b/include/exiv2/tags.hpp @@ -308,6 +308,9 @@ class EXIV2API ExifKey : public Key { ~ExifKey() override; //@} + ExifKey(ExifKey&& rhs); + ExifKey& operator=(ExifKey&& rhs); + //! @name Manipulators //@{ /*! diff --git a/src/tags.cpp b/src/tags.cpp index cbb6b0d2..f508faf0 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -264,6 +264,9 @@ ExifKey::ExifKey(const std::string& key) : p_(std::make_unique()) { ExifKey::ExifKey(const ExifKey& rhs) : p_(std::make_unique(*rhs.p_)) { } +ExifKey::ExifKey(ExifKey&& rhs) : p_(std::make_unique(*rhs.p_)) { +} + ExifKey::~ExifKey() = default; ExifKey& ExifKey::operator=(const ExifKey& rhs) { @@ -274,6 +277,14 @@ ExifKey& ExifKey::operator=(const ExifKey& rhs) { return *this; } +ExifKey& ExifKey::operator=(ExifKey&& rhs) { + if (this == &rhs) + return *this; + *p_ = *rhs.p_; + Key::operator=(std::move(rhs)); + return *this; +} + void ExifKey::setIdx(int idx) { p_->idx_ = idx; }