Merge remote-tracking branch 'refs/remotes/origin/master' into enet_wip_nothing_to_see_here
This commit is contained in:
commit
c766387567
|
|
@ -84,7 +84,7 @@ namespace Nz
|
||||||
public:
|
public:
|
||||||
Connection() = default;
|
Connection() = default;
|
||||||
Connection(const Connection& connection) = default;
|
Connection(const Connection& connection) = default;
|
||||||
Connection(Connection&& connection) noexcept = default;
|
Connection(Connection&& connection) noexcept;
|
||||||
~Connection() = default;
|
~Connection() = default;
|
||||||
|
|
||||||
template<typename... ConnectArgs>
|
template<typename... ConnectArgs>
|
||||||
|
|
@ -94,7 +94,7 @@ namespace Nz
|
||||||
bool IsConnected() const;
|
bool IsConnected() const;
|
||||||
|
|
||||||
Connection& operator=(const Connection& connection) = default;
|
Connection& operator=(const Connection& connection) = default;
|
||||||
Connection& operator=(Connection&& connection) noexcept = default;
|
Connection& operator=(Connection&& connection) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection(const SlotPtr& slot);
|
Connection(const SlotPtr& slot);
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,18 @@ namespace Nz
|
||||||
* \brief Core class that represents a connection attached to a signal
|
* \brief Core class that represents a connection attached to a signal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Constructs a Signal::Connection object with by move semantic
|
||||||
|
*
|
||||||
|
* \param connection Connection object to move
|
||||||
|
*/
|
||||||
|
template<typename... Args>
|
||||||
|
Signal<Args...>::Connection::Connection(Connection&& connection) noexcept :
|
||||||
|
m_ptr(std::move(connection.m_ptr))
|
||||||
|
{
|
||||||
|
connection.m_ptr.reset(); //< Fuck you GCC 4.9
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructs a Signal::Connection object with a slot
|
* \brief Constructs a Signal::Connection object with a slot
|
||||||
*
|
*
|
||||||
|
|
@ -294,6 +306,20 @@ namespace Nz
|
||||||
return !m_ptr.expired();
|
return !m_ptr.expired();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Constructs a Signal::ConnectionGuard object by move semantic
|
||||||
|
*
|
||||||
|
* \param connection Connection to move
|
||||||
|
*/
|
||||||
|
template<typename... Args>
|
||||||
|
typename Signal<Args...>::Connection& Signal<Args...>::Connection::operator=(Connection&& connection) noexcept
|
||||||
|
{
|
||||||
|
m_ptr = std::move(connection.m_ptr);
|
||||||
|
connection.m_ptr.reset(); //< Fuck you GCC 4.9
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \class Nz::Signal::ConnectionGuard
|
* \class Nz::Signal::ConnectionGuard
|
||||||
* \brief Core class that represents a RAII for a connection attached to a signal
|
* \brief Core class that represents a RAII for a connection attached to a signal
|
||||||
|
|
@ -405,9 +431,12 @@ namespace Nz
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
typename Signal<Args...>::ConnectionGuard& Signal<Args...>::ConnectionGuard::operator=(Connection&& connection)
|
typename Signal<Args...>::ConnectionGuard& Signal<Args...>::ConnectionGuard::operator=(Connection&& connection)
|
||||||
|
{
|
||||||
|
if (&connection != this)
|
||||||
{
|
{
|
||||||
m_connection.Disconnect();
|
m_connection.Disconnect();
|
||||||
m_connection = std::move(connection);
|
m_connection = std::move(connection);
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
@ -421,9 +450,12 @@ namespace Nz
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
typename Signal<Args...>::ConnectionGuard& Signal<Args...>::ConnectionGuard::operator=(ConnectionGuard&& connection) noexcept
|
typename Signal<Args...>::ConnectionGuard& Signal<Args...>::ConnectionGuard::operator=(ConnectionGuard&& connection) noexcept
|
||||||
|
{
|
||||||
|
if (&connection != this)
|
||||||
{
|
{
|
||||||
m_connection.Disconnect();
|
m_connection.Disconnect();
|
||||||
m_connection = std::move(connection.m_connection);
|
m_connection = std::move(connection.m_connection);
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue