9 #ifndef slimsig_connection_h
10 #define slimsig_connection_h
18 template <
class Signal>
21 template <
class ThreadPolicy,
class Allocator,
class F>
25 template <
class Signal>
27 using slot =
typename Signal::slot;
28 using slot_type = slot;
29 using slot_list_iterator =
typename Signal::slot_list::iterator;
30 using slot_storage =
typename Signal::slot_list;
31 using slot_id =
typename slot::slot_id;
32 using signal_holder =
typename Signal::signal_holder;
33 connection(std::weak_ptr<signal_holder> slots,
const slot_type& slot) :
connection(std::move(slots), slot.m_slot_id) {};
34 connection(std::weak_ptr<signal_holder> slots,
unsigned long long slot_id) : m_slots(std::move(slots)), m_slot_id(slot_id) {};
45 m_slot_id = rhs.m_slot_id;
46 m_slots = rhs.m_slots;
52 swap(m_slots, other.m_slots);
53 swap(m_slot_id, other.m_slot_id);
56 explicit operator bool()
const {
return connected(); };
58 const auto slots = m_slots.lock();
59 if (slots && slots->signal !=
nullptr) {
60 return slots->signal->connected(m_slot_id);
68 std::shared_ptr<signal_holder> slots = m_slots.lock();
69 if (slots !=
nullptr && slots->signal !=
nullptr) {
70 slots->signal->disconnect(m_slot_id);
75 template <
class ThreadPolicy,
class Allocator,
class F>
77 template <
class T,
class IDGenerator,
class FlagType,
class Allocator>
82 std::weak_ptr<signal_holder> m_slots;
86 template <
class connection>
102 m_connection.
swap(other.m_connection);
106 m_connection.
swap(ret);
116 template <
class connection>