diff --git a/ChangeLog.md b/ChangeLog.md index 2909afceb..945d1f3ab 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -171,6 +171,7 @@ Nazara Engine: - Fixed missing static Vector4::DotProduct implementation - ⚠ **By default, Nazara computes the mass center of all 2D physics object when calling SetGeom** - ⚠ Added Collider2D::ComputeCenterOfMass +- Signal now implement a copy constructor and copy assignation operator for convenience Nazara Development Kit: - Added ImageWidget (#139) diff --git a/include/Nazara/Core/Signal.hpp b/include/Nazara/Core/Signal.hpp index 1569c5d0e..973181e47 100644 --- a/include/Nazara/Core/Signal.hpp +++ b/include/Nazara/Core/Signal.hpp @@ -32,7 +32,7 @@ namespace Nz class ConnectionGuard; Signal(); - Signal(const Signal&) = delete; + Signal(const Signal&); Signal(Signal&& signal) noexcept; ~Signal() = default; @@ -47,7 +47,7 @@ namespace Nz void operator()(Args... args) const; - Signal& operator=(const Signal&) = delete; + Signal& operator=(const Signal&); Signal& operator=(Signal&& signal) noexcept; private: diff --git a/include/Nazara/Core/Signal.inl b/include/Nazara/Core/Signal.inl index c4e89bd40..47d490a09 100644 --- a/include/Nazara/Core/Signal.inl +++ b/include/Nazara/Core/Signal.inl @@ -18,13 +18,23 @@ namespace Nz /*! * \brief Constructs a Signal object by default */ - template Signal::Signal() : m_slotIterator(0) { } + /*! + * \brief Constructs a Signal object by default + * + * \remark It doesn't make sense to copy a signal, this is only available for convenience to allow compiler-generated copy constructors + */ + template + Signal::Signal(const Signal&) : + Signal() + { + } + /*! * \brief Constructs a Signal object by move semantic * @@ -174,13 +184,24 @@ namespace Nz m_slots[m_slotIterator]->callback(args...); } + /*! + * \brief Doesn't do anything + * \return A reference to this + * + * \remark This is only for convenience to allow compiled-generated assignation operator + */ + template + Signal& Signal::operator=(const Signal&) + { + return *this; + } + /*! * \brief Moves the signal into this * \return A reference to this * * \param signal Signal to move in this */ - template Signal& Signal::operator=(Signal&& signal) noexcept {