refs #311 CDictionary: added move constructor and fixed move assignment

This commit is contained in:
Mathew Sutcliffe
2014-08-01 17:16:56 +01:00
parent 600ea2b803
commit 58318677b5

View File

@@ -9,6 +9,7 @@
#include "valueobject.h" #include "valueobject.h"
#include "iterator.h" #include "iterator.h"
#include <QHash> #include <QHash>
#include <utility>
namespace BlackMisc namespace BlackMisc
{ {
@@ -242,6 +243,9 @@ namespace BlackMisc
//! Copy constructor //! Copy constructor
CDictionary(const CDictionary &) = default; CDictionary(const CDictionary &) = default;
//! Move constructor
CDictionary(CDictionary &&other) : m_impl(std::move(other.m_impl)) {}
//! Virtual destructor //! Virtual destructor
virtual ~CDictionary() {} virtual ~CDictionary() {}
@@ -345,7 +349,7 @@ namespace BlackMisc
CDictionary &operator =(const CDictionary &other) { m_impl = other.m_impl; return *this; } CDictionary &operator =(const CDictionary &other) { m_impl = other.m_impl; return *this; }
//! Move assignment //! 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. * \brief Access an element by its key.