From bf1844a2f51477ce0fa39edf6c9a77de224a5150 Mon Sep 17 00:00:00 2001 From: Hleb Valoshka <375gnu@gmail.com> Date: Tue, 16 Apr 2019 13:14:30 +0300 Subject: [PATCH] wip --- src/celutil/watchable.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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