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