diff --git a/src/celutil/watchable.h b/src/celutil/watchable.h index 60f6120d8..fe992ff9b 100644 --- a/src/celutil/watchable.h +++ b/src/celutil/watchable.h @@ -3,14 +3,15 @@ #include "watcher.h" #include #include +#include //namespace celutil //{ template class Watchable { public: - void addWatcher(Watcher* watcher); - void removeWatcher(Watcher* watcher); + inline void addWatcher(Watcher* watcher); + inline void removeWatcher(Watcher* watcher); void notifyWatchers(int) const; private: std::vector*> watchers; @@ -24,9 +25,8 @@ template void Watchable::addWatcher(Watcher* watcher) template void Watchable::removeWatcher(Watcher* watcher) { - auto iter = find(watchers.begin(), watchers.end(), watcher); - if (iter != watchers.end()) - watchers.erase(iter); + std::remove_if(watchers.begin(), watchers.end(), + [&watcher](Watcher* w) { return w == watcher; }); } template void Watchable::notifyWatchers(int property) const