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

This commit is contained in:
wmayer
2023-08-15 17:25:46 +02:00
committed by wwmayer
parent e1dce4e024
commit ce8cd4fe8b
5 changed files with 35 additions and 39 deletions

View File

@@ -48,11 +48,11 @@ App::DocumentObjectExecReturn *TrajectoryCompound::execute()
const std::vector<DocumentObject*> &Tracs = Source.getValues();
Robot::Trajectory result;
for (std::vector<DocumentObject*>::const_iterator it= Tracs.begin();it!=Tracs.end();++it) {
if ((*it)->getTypeId().isDerivedFrom(Robot::TrajectoryObject::getClassTypeId())){
const std::vector<Waypoint*> &wps = static_cast<Robot::TrajectoryObject*>(*it)->Trajectory.getValue().getWaypoints();
for (std::vector<Waypoint*>::const_iterator it2= wps.begin();it2!=wps.end();++it2) {
result.addWaypoint(**it2);
for (auto it : Tracs) {
if (it->getTypeId().isDerivedFrom(Robot::TrajectoryObject::getClassTypeId())){
const std::vector<Waypoint*> &wps = static_cast<Robot::TrajectoryObject*>(it)->Trajectory.getValue().getWaypoints();
for (auto wp : wps) {
result.addWaypoint(*wp);
}
}else
return new App::DocumentObjectExecReturn("Not all objects in compound are trajectories!");