T102 Implement move constructor and move assignment for CWorkerPointer

so the connection to the worker's aboutToStart signal remains valid.
This commit is contained in:
Mathew Sutcliffe
2017-07-05 00:31:06 +01:00
parent a37b12c8bc
commit 7d7ce055ef
2 changed files with 43 additions and 4 deletions

View File

@@ -25,10 +25,8 @@ namespace BlackMisc
* be disconnected when the object is destroyed. So it can be used with lambdas or bind which feature
* non QObjects, if those might be destroyed before the signaling QObject.
*/
class BLACKMISC_EXPORT CConnectionGuard : public QObject
class BLACKMISC_EXPORT CConnectionGuard
{
Q_OBJECT
public:
//! Constructor
CConnectionGuard() = default;
@@ -36,6 +34,18 @@ namespace BlackMisc
//! Constructor
CConnectionGuard(const QMetaObject::Connection &connection);
//! Move constructor
CConnectionGuard(CConnectionGuard &&) = default;
//! Move assignment operator
CConnectionGuard &operator =(CConnectionGuard &&) = default;
//! Not copyable
//! @{
CConnectionGuard(const CConnectionGuard &) = delete;
CConnectionGuard &operator =(const CConnectionGuard &) = delete;
//! @}
//! Destructor
~CConnectionGuard();