From 58318677b573aac8d44fb2e80ada5b4c2fd757ba Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Fri, 1 Aug 2014 17:16:56 +0100 Subject: [PATCH] refs #311 CDictionary: added move constructor and fixed move assignment --- src/blackmisc/dictionary.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/blackmisc/dictionary.h b/src/blackmisc/dictionary.h index 7ad30eb75..aae64115b 100644 --- a/src/blackmisc/dictionary.h +++ b/src/blackmisc/dictionary.h @@ -9,6 +9,7 @@ #include "valueobject.h" #include "iterator.h" #include +#include namespace BlackMisc { @@ -242,6 +243,9 @@ namespace BlackMisc //! Copy constructor CDictionary(const CDictionary &) = default; + //! Move constructor + CDictionary(CDictionary &&other) : m_impl(std::move(other.m_impl)) {} + //! Virtual destructor virtual ~CDictionary() {} @@ -345,7 +349,7 @@ namespace BlackMisc CDictionary &operator =(const CDictionary &other) { m_impl = other.m_impl; return *this; } //! Move assignment - CDictionary &operator =(CDictionary && other) { m_impl = other.m_impl; return *this; } + CDictionary &operator =(CDictionary && other) { m_impl = std::move(other.m_impl); return *this; } /*! * \brief Access an element by its key.