X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/1cd2b12bd4e4d86f6cd099240795f3ebeb3852b3..b2b89723a2427bba8290bd6967a1ab39cbb630be:/include/stg/subscriptions.h diff --git a/include/stg/subscriptions.h b/include/stg/subscriptions.h index a50cbba3..9ee9c64a 100644 --- a/include/stg/subscriptions.h +++ b/include/stg/subscriptions.h @@ -10,24 +10,23 @@ namespace STG class Connection { public: - Connection() noexcept : m_connected(false) {} + Connection() = default; Connection(const Connection&) = delete; Connection& operator=(const Connection&) = delete; Connection(Connection&&) = default; Connection& operator=(Connection&&) = default; - Connection(const std::function& f) noexcept : m_disconnect(f), m_connected(true) {} + Connection(const std::function& f) noexcept : m_disconnect(f) {} void disconnect() noexcept { - if (!m_connected) + if (!m_disconnect) return; m_disconnect(); - m_connected = false; + m_disconnect = {}; } private: std::function m_disconnect; - bool m_connected; }; class ScopedConnection