title: Handle connection/disconnection of many signals/slots with boost::signals2
body: <p>I've started using boost::signals2 instead of my old signals-code. I'm having a problem with administering multiple connections though. Here's my problem:</p>
  
  <p>I have many instances of the class Person:</p>
  
  <pre><code>class Person {
  public:
      void SetName (string new_name)
      {
          name = new_name;
          NameChange (name);
      }
  
      string name;
      boost::signals2::signal&lt;Person*&gt; NameChange;
  };
  </code></pre>
  
  <p>I also have a people-browser, that must monitor a subset of all available people for changes. Since people can come and go from that subset I must have a way to handle the connection objects, and I've created a class (ConnectionList) to handle that:</p>
  
  <pre><code>class ConnectionList
  {
  public:
      virtual ~ConnectionList () // drops all connections in "list"
      void add (boost::signals2::connection&amp; conn); // adds "conn" to "list"
  private:
      std::vector&lt;boost::signals2::connection&gt; list;
  };
  
  class PeopleBrowser
  {
  public:
      void AddPerson (Person&amp; p)
      {
          name_change_connections.add (p.NameChange.connect (...));
      }
  private:
      ConnectionList name_change_connections;
  };
  </code></pre>
  
  <p>This is all well, the connections are dropped when PeopleBrowser is deleted and there is a nice way to add new connections.</p>
  
  <p>However, we need to add another method, RemovePerson, and that method must remove the connections to the NameChange-signal of that Person-instance.</p>
  
  <p>This is where I'm stuck. I guess I could make ConnectionList a template and use a list that holds a struct with a reference to the signal as well as the connection, and then add a method that drops all connections to that signal.</p>
  
  <p>But it seems that this is such a common case (at least in my world, I have like 20 classes in this single app that needs this functionality), so I think there must be a better way to handle this?</p>
  
  <p>At the very least, is there any way to get a reference to the connected signal from a connection object?</p>
  
  <p>Perhaps libsigc++ handle this better/differently?</p>