Your code will cause a std::list copy constructor, I would rather not do that.
Consider again, pass the reference of `attach_listeners_` or  `detach_listeners_` to PostMessageToAllListeners
```
  void PostMessageToAllListeners(const DeviceCapabilitiesEventsList& listeners,
                                 const char* result) {
    DeviceCapabilitiesEventsList::iterator it = listeners.begin();
    for (; it != listeners.end(); ++it) {
      (*it)->PostMessage(result);
    }
  }
```