0

I have defined a bunch of boost::signal2 in a class and connected them to some slots on class construction. Is there an api call in boost that disconnects all the signals owned by a class, like disconnect_all()?

so that I don't need to disconnect each signal one by one.

jiawen
  • 1,198
  • 2
  • 17
  • 29
  • do you have list of these? Otherwise, how would the compiler "know" which signals are "owned"? We don't have reflection. Although I'm pretty sure there are auto-disconnecting signals in RAII style... – sehe Mar 13 '15 at 07:32

1 Answers1

0

There is the boost::signals2::signal::disconnect_all_slots() method. It looks like what you are looking for.

Edit based on a comment clarification

As far as I know the boost::signals2 has no 'one-method-call' feature to disconnect all signals either of a class or of a whole program. A possible solution is described in this SO topic.

Community
  • 1
  • 1
megabyte1024
  • 8,482
  • 4
  • 30
  • 44
  • I am aware of disconnect_all_slots(). It disconnects all the slots on a particular signal, which isn't quite what I want. I want something like disconnect_all_signals(); – jiawen Mar 12 '15 at 21:19