diff options
Diffstat (limited to 'Observer.cpp')
-rw-r--r-- | Observer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Observer.cpp b/Observer.cpp index 7d5dc22..39a8245 100644 --- a/Observer.cpp +++ b/Observer.cpp @@ -3,6 +3,7 @@ #include "Observer.h" void Subject::attach(Observer * obs){ + // std::cout << "added" << std::endl; this->observers.push_back(obs); } @@ -11,12 +12,12 @@ void Subject::detach(Observer *){ } int Subject::size() { + // std::cout << "subject list size " << this->observers.size() << std::endl; return this->observers.size(); } -// TODO possibly add foo input as update value? void Subject::notify() { - for (int i = 0; i < this->observers.size(); i++) - this->observers[i]->update(); + for (auto observer : this->observers) + observer->update(); } |