From 2bd18402f1de8401511e4199e3b2113d9149ebdb Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 20 Sep 2016 11:30:38 +0200 Subject: cid#1371306: Add move semantics Change-Id: Id669a84742cc4ffa3bb9f225af7fa4d218999681 --- include/registry/registry.hxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx index a9be21d41aaa..0aea6fd86ed7 100644 --- a/include/registry/registry.hxx +++ b/include/registry/registry.hxx @@ -90,12 +90,24 @@ public: /// Copy constructor inline Registry(const Registry& toCopy); + Registry(Registry && other): m_pApi(other.m_pApi), m_hImpl(other.m_hImpl) + { other.m_hImpl = nullptr; } + /// Destructor. The Destructor close the registry if it is open. inline ~Registry(); /// Assign operator inline Registry& operator = (const Registry& toAssign); + Registry & operator =(Registry && other) { + if (m_hImpl != nullptr) { + m_pApi->release(m_hImpl); + } + m_hImpl = other.m_hImpl; + other.m_hImpl = nullptr; + return *this; + } + /// checks if the registry points to a valid registry data file. inline bool isValid() const; -- cgit