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:
I have
What about:
class PeopleBrowser
{
public:
void AddPerson (Person& p)
{
name_change_connections[&p] = p.NameChange.connect(...);
}
void RemovePerson(Person& p)
{
name_change_connections.erase(&p);
}
private:
std::map name_change_connections;
};
You might also want to take a look at automatic connection management.