c++signals-slotsboost-signals2

Storing a boost::signals2 signal in a map?


I am facing the following problem: I want to store a number of boost::signals2 signal variables in a map. Since these signals are non-copyable, this obviously will not work. How can I work around this? I have already found this older question. In it, a poster suggests storing the signals as a shared_ptr. Is this the only way of doing it? Does it have any drawbacks, or, more important, is it safe?


Solution

  • As has been pointed out by some commentators: Using shared_ptrs for signals is perfectly safe. My implementation works and has been thoroughly tested in the meantime and I am happy to report that there are indeed no problems :)