Add a mutable each function

This commit is contained in:
Rasmus Karlsson 2018-06-06 01:28:42 +02:00
parent 4716d73ee2
commit 30c117f129

View file

@ -78,6 +78,18 @@ public:
}
}
void each(std::function<void(const TKey &name, TValue &value)> func)
{
QMutexLocker lock(&this->mutex);
QMutableMapIterator<TKey, TValue> it(this->data);
while (it.hasNext()) {
it.next();
func(it.key(), it.value());
}
}
private:
mutable QMutex mutex;
QMap<TKey, TValue> data;