summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-11-20 22:18:10 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-11-20 22:18:10 +0100
commitfe412ea187ac6762ac48b0caf2c5bd873f6b9d76 (patch)
tree27907cbbca31ec022d9ef13a29cf69b6e32a908a
parent44fa03c1bf8eb60d38256b48720f9958c735aadc (diff)
Use range based for loops.
-rw-r--r--plugingui/notifier.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugingui/notifier.h b/plugingui/notifier.h
index 57ca453..328ab7d 100644
--- a/plugingui/notifier.h
+++ b/plugingui/notifier.h
@@ -84,8 +84,9 @@ class Listener {
public:
virtual ~Listener()
{
- for(auto signal = signals.begin(); signal != signals.end(); ++signal) {
- (*signal)->disconnect(this);
+ for(auto signal : signals)
+ {
+ signal->disconnect(this);
}
}
@@ -111,8 +112,9 @@ public:
//! \brief When dtor is called it will automatically disconnect all its listeners.
~Notifier()
{
- for(auto slot = slots.begin(); slot != slots.end(); ++slot) {
- (*slot).first->unregisterNotifier(this);
+ for(auto& slot : slots)
+ {
+ slot.first->unregisterNotifier(this);
}
}
@@ -123,7 +125,8 @@ public:
void connect(O* p, const F& fn)
{
slots[p] = std::move(construct_mem_fn(fn, p, aux::gen_int_sequence<sizeof...(Args)>{}));
- if(p && dynamic_cast<Listener*>(p)) {
+ if(p && dynamic_cast<Listener*>(p))
+ {
dynamic_cast<Listener*>(p)->registerNotifier(this);
}
}
@@ -138,8 +141,9 @@ public:
//! Example: Notifier<int> foo; foo(42);
void operator()(Args... args)
{
- for(auto slot = slots.begin(); slot != slots.end(); ++slot) {
- (*slot).second(args...);
+ for(auto& slot : slots)
+ {
+ slot.second(args...);
}
}