Use Vector::remove() in a place I wished I had it earlier.

This commit is contained in:
Andreas Kling 2018-10-13 01:19:25 +02:00
parent 7777c8844b
commit 9a387d96da

View file

@ -43,13 +43,12 @@ void Object::addChild(Object& object)
void Object::removeChild(Object& object)
{
// Oh geez, Vector needs a remove() huh...
Vector<Object*> newList;
for (auto* child : m_children) {
if (child != &object)
newList.append(child);
for (unsigned i = 0; i < m_children.size(); ++i) {
if (m_children[i] == &object) {
m_children.remove(i);
return;
}
}
m_children = std::move(newList);
}
void Object::onTimer(TimerEvent&)