From e7c285e3423ddd660447f6a6fc6bbae25f99f386 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 26 Jan 2024 16:21:43 +0100 Subject: Apply C++11 fixits modernize-loop-convert modernize-deprecated-headers --- src/particlecontainer.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/particlecontainer.cpp') diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp index 002d4488..b3798a33 100644 --- a/src/particlecontainer.cpp +++ b/src/particlecontainer.cpp @@ -87,9 +87,8 @@ void ParticleList::removeLocally(Particle *particle) void ParticleList::clearLocally() { - for (auto it = mElements.begin(); - it != mElements.end(); it++) - (*it)->kill(); + for (auto &element : mElements) + element->kill(); mElements.clear(); } @@ -160,17 +159,16 @@ void ParticleVector::moveTo(float x, float y) { ParticleContainer::moveTo(x, y); - for (auto it = mIndexedElements.begin(); - it != mIndexedElements.end(); it++) + for (auto &indexedElement : mIndexedElements) { - if (*it) + if (indexedElement) { - (*it)->moveTo(x, y); + indexedElement->moveTo(x, y); - if ((*it)->isExtinct()) + if (indexedElement->isExtinct()) { - (*it)->kill(); - *it = NULL; + indexedElement->kill(); + indexedElement = NULL; } } } -- cgit v1.2.3-70-g09d2