]> git.tdb.fi Git - libs/core.git/blobdiff - source/time/timer.cpp
Use braced initializer lists in place of constructors when possible
[libs/core.git] / source / time / timer.cpp
index 04c3074494e921d39f3edb54e53e378c8623e826..eda782e0d92c5bf82c00418584e12917d03fa673 100644 (file)
@@ -22,7 +22,7 @@ Timer::Slot &Timer::add(const TimeDelta &td)
 {
        Slot *s = new Slot(td);
        MutexLock l(mutex);
-       slots.push_back(s);
+       slots.push_back({ s });
        push_heap(slots.begin(), slots.end());
        if(blocking)
                sem.signal();
@@ -33,7 +33,7 @@ Timer::Slot &Timer::add(const TimeStamp &ts)
 {
        Slot *s = new Slot(ts);
        MutexLock l(mutex);
-       slots.push_back(s);
+       slots.push_back({ s });
        push_heap(slots.begin(), slots.end());
        if(blocking)
                sem.signal();
@@ -113,7 +113,7 @@ void Timer::do_tick(const TimeDelta &timeout)
                if(next->signal_timeout.emit() && next->increment())
                {
                        MutexLock l(mutex);
-                       slots.push_back(next);
+                       slots.push_back({ next });
                        push_heap(slots.begin(), slots.end());
                }
                else
@@ -152,10 +152,6 @@ bool Timer::Slot::increment()
 }
 
 
-Timer::SlotProxy::SlotProxy(Slot *s):
-       slot(s)
-{ }
-
 bool Timer::SlotProxy::operator<(const SlotProxy &sp) const
 {
        return slot->get_timeout()>sp.slot->get_timeout();