Core/Signal: Implement copy constructor/copy assignation operator
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -18,13 +18,23 @@ namespace Nz
|
||||
/*!
|
||||
* \brief Constructs a Signal object by default
|
||||
*/
|
||||
|
||||
template<typename... Args>
|
||||
Signal<Args...>::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<typename ...Args>
|
||||
Signal<Args...>::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<typename... Args>
|
||||
Signal<Args...>& Signal<Args...>::operator=(const Signal&)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the signal into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param signal Signal to move in this
|
||||
*/
|
||||
|
||||
template<typename... Args>
|
||||
Signal<Args...>& Signal<Args...>::operator=(Signal&& signal) noexcept
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user