Core/Signal: Make movement noexcept
This commit is contained in:
parent
ef474fc3a4
commit
353ade3efd
|
|
@ -69,7 +69,7 @@ namespace Nz
|
||||||
SlotListIndex index;
|
SlotListIndex index;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Disconnect(const SlotPtr& slot);
|
void Disconnect(const SlotPtr& slot) noexcept;
|
||||||
|
|
||||||
SlotList m_slots;
|
SlotList m_slots;
|
||||||
mutable SlotListIndex m_slotIterator;
|
mutable SlotListIndex m_slotIterator;
|
||||||
|
|
@ -84,17 +84,17 @@ namespace Nz
|
||||||
public:
|
public:
|
||||||
Connection() = default;
|
Connection() = default;
|
||||||
Connection(const Connection& connection) = default;
|
Connection(const Connection& connection) = default;
|
||||||
Connection(Connection&& connection) = default;
|
Connection(Connection&& connection) noexcept = default;
|
||||||
~Connection() = default;
|
~Connection() = default;
|
||||||
|
|
||||||
template<typename... ConnectArgs>
|
template<typename... ConnectArgs>
|
||||||
void Connect(BaseClass& signal, ConnectArgs&&... args);
|
void Connect(BaseClass& signal, ConnectArgs&&... args);
|
||||||
void Disconnect();
|
void Disconnect() noexcept;
|
||||||
|
|
||||||
bool IsConnected() const;
|
bool IsConnected() const;
|
||||||
|
|
||||||
Connection& operator=(const Connection& connection) = default;
|
Connection& operator=(const Connection& connection) = default;
|
||||||
Connection& operator=(Connection&& connection) = default;
|
Connection& operator=(Connection&& connection) noexcept = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection(const SlotPtr& slot);
|
Connection(const SlotPtr& slot);
|
||||||
|
|
@ -113,12 +113,12 @@ namespace Nz
|
||||||
ConnectionGuard(const Connection& connection);
|
ConnectionGuard(const Connection& connection);
|
||||||
ConnectionGuard(const ConnectionGuard& connection) = delete;
|
ConnectionGuard(const ConnectionGuard& connection) = delete;
|
||||||
ConnectionGuard(Connection&& connection);
|
ConnectionGuard(Connection&& connection);
|
||||||
ConnectionGuard(ConnectionGuard&& connection) = default;
|
ConnectionGuard(ConnectionGuard&& connection) noexcept = default;
|
||||||
~ConnectionGuard();
|
~ConnectionGuard();
|
||||||
|
|
||||||
template<typename... ConnectArgs>
|
template<typename... ConnectArgs>
|
||||||
void Connect(BaseClass& signal, ConnectArgs&&... args);
|
void Connect(BaseClass& signal, ConnectArgs&&... args);
|
||||||
void Disconnect();
|
void Disconnect() noexcept;
|
||||||
|
|
||||||
Connection& GetConnection();
|
Connection& GetConnection();
|
||||||
|
|
||||||
|
|
@ -127,7 +127,7 @@ namespace Nz
|
||||||
ConnectionGuard& operator=(const Connection& connection);
|
ConnectionGuard& operator=(const Connection& connection);
|
||||||
ConnectionGuard& operator=(const ConnectionGuard& connection) = delete;
|
ConnectionGuard& operator=(const ConnectionGuard& connection) = delete;
|
||||||
ConnectionGuard& operator=(Connection&& connection);
|
ConnectionGuard& operator=(Connection&& connection);
|
||||||
ConnectionGuard& operator=(ConnectionGuard&& connection);
|
ConnectionGuard& operator=(ConnectionGuard&& connection) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection m_connection;
|
Connection m_connection;
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void Signal<Args...>::Disconnect(const SlotPtr& slot)
|
void Signal<Args...>::Disconnect(const SlotPtr& slot) noexcept
|
||||||
{
|
{
|
||||||
NazaraAssert(slot, "Invalid slot pointer");
|
NazaraAssert(slot, "Invalid slot pointer");
|
||||||
NazaraAssert(slot->index < m_slots.size(), "Invalid slot index");
|
NazaraAssert(slot->index < m_slots.size(), "Invalid slot index");
|
||||||
|
|
@ -277,7 +277,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void Signal<Args...>::Connection::Disconnect()
|
void Signal<Args...>::Connection::Disconnect() noexcept
|
||||||
{
|
{
|
||||||
if (SlotPtr ptr = m_ptr.lock())
|
if (SlotPtr ptr = m_ptr.lock())
|
||||||
ptr->signal->Disconnect(ptr);
|
ptr->signal->Disconnect(ptr);
|
||||||
|
|
@ -353,7 +353,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void Signal<Args...>::ConnectionGuard::Disconnect()
|
void Signal<Args...>::ConnectionGuard::Disconnect() noexcept
|
||||||
{
|
{
|
||||||
m_connection.Disconnect();
|
m_connection.Disconnect();
|
||||||
}
|
}
|
||||||
|
|
@ -420,7 +420,7 @@ namespace Nz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
typename Signal<Args...>::ConnectionGuard& Signal<Args...>::ConnectionGuard::operator=(ConnectionGuard&& connection)
|
typename Signal<Args...>::ConnectionGuard& Signal<Args...>::ConnectionGuard::operator=(ConnectionGuard&& connection) noexcept
|
||||||
{
|
{
|
||||||
m_connection.Disconnect();
|
m_connection.Disconnect();
|
||||||
m_connection = std::move(connection.m_connection);
|
m_connection = std::move(connection.m_connection);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue