mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add a mutable each function
This commit is contained in:
parent
4716d73ee2
commit
30c117f129
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue