-// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
if (aConstraintsMsg.get()) {
myObjectsToRemove = aConstraintsMsg->constraints();
- std::set<ObjectPtr>::const_iterator
- anIt = myObjectsToRemove.begin(), aLast = myObjectsToRemove.end();
+ std::set<ObjectPtr>::const_iterator anIt = myObjectsToRemove.begin();
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
- for (; anIt != aLast; anIt++)
+ for (; anIt != myObjectsToRemove.end(); )
{
ObjectPtr anObject = *anIt;
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
if ((aType == SketchPlugin_ConstraintHorizontal::ID() ||
aType == SketchPlugin_ConstraintVertical::ID()) &&
!aModule->sketchReentranceMgr()->isLastAutoConstraint(*anIt))
- myObjectsToRemove.erase(*anIt);
+ anIt = myObjectsToRemove.erase(anIt);
+ else
+ anIt++;
}
if (myObjectsToRemove.empty())