PD: modernize C++: use range-based for loop

This commit is contained in:
wmayer
2023-08-15 17:30:08 +02:00
committed by Chris Hennes
parent 8c25886da2
commit 3e09b8ee2d
30 changed files with 126 additions and 132 deletions

View File

@@ -248,14 +248,14 @@ App::DocumentObjectExecReturn *Transformed::execute()
// Original separately. This way it is easier to discover what feature causes a fuse/cut
// to fail. The downside is that performance suffers when there are many originals. But it seems
// safe to assume that in most cases there are few originals and many transformations
for (std::vector<App::DocumentObject*>::const_iterator o = originals.begin(); o != originals.end(); ++o)
for (auto original : originals)
{
// Extract the original shape and determine whether to cut or to fuse
Part::TopoShape fuseShape;
Part::TopoShape cutShape;
if ((*o)->getTypeId().isDerivedFrom(PartDesign::FeatureAddSub::getClassTypeId())) {
PartDesign::FeatureAddSub* feature = static_cast<PartDesign::FeatureAddSub*>(*o);
if (original->getTypeId().isDerivedFrom(PartDesign::FeatureAddSub::getClassTypeId())) {
PartDesign::FeatureAddSub* feature = static_cast<PartDesign::FeatureAddSub*>(original);
feature->getAddSubShape(fuseShape, cutShape);
if (fuseShape.isNull() && cutShape.isNull())
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Shape of additive/subtractive feature is empty"));