diff --git a/src/blackmisc/iterator.h b/src/blackmisc/iterator.h index 18bd9914e..458ce9506 100644 --- a/src/blackmisc/iterator.h +++ b/src/blackmisc/iterator.h @@ -34,6 +34,7 @@ namespace BlackMisc //! @{ explicit OutputIterator(const F &func) : m_func(func) {} explicit OutputIterator(F &&func) : m_func(std::move(func)) {} + OutputIterator(const OutputIterator &other) : m_func(other.m_func) {} //! @} //! Advance the iterator (no-op) diff --git a/src/plugins/simulator/fs9/hostnode.cpp b/src/plugins/simulator/fs9/hostnode.cpp index a8d02ed18..b8095fd11 100644 --- a/src/plugins/simulator/fs9/hostnode.cpp +++ b/src/plugins/simulator/fs9/hostnode.cpp @@ -28,5 +28,16 @@ namespace BlackSimPlugin { SafeRelease(m_hostAddress); } + + CHostNode &CHostNode::operator=(const CHostNode &other) + { + // check for self-assignment + if(&other == this) { return *this; } + + m_appDesc = other.m_appDesc; + m_sessionName = other.m_sessionName; + other.m_hostAddress->Duplicate(&m_hostAddress); + return *this; + } } } diff --git a/src/plugins/simulator/fs9/hostnode.h b/src/plugins/simulator/fs9/hostnode.h index e6e76a365..b92646166 100644 --- a/src/plugins/simulator/fs9/hostnode.h +++ b/src/plugins/simulator/fs9/hostnode.h @@ -52,14 +52,15 @@ namespace BlackSimPlugin //! Set the session name void setSessionName(const QString &name) { m_sessionName = name; } + //! Copy assignment operator + CHostNode &operator=(const CHostNode &other); + private: - - IDirectPlay8Address *m_hostAddress = nullptr; - DPN_APPLICATION_DESC m_appDesc; - QString m_sessionName; - + IDirectPlay8Address *m_hostAddress = nullptr; + DPN_APPLICATION_DESC m_appDesc; + QString m_sessionName; }; } } -#endif //BLACKSIMPLUGIN_FS9_HOST_NODE_H +#endif //guard