Woolfrey / software_robot_library

Custom classes for robot control.
GNU General Public License v3.0
2 stars 1 forks source link

Replace index-based `for` loops with range-based `for` loops #96

Closed Woolfrey closed 9 months ago

Woolfrey commented 9 months ago

Replace, for example, this code:

for(int i = 0; i < this->_numberOfJoints; i++)
{
          std::cout << this->_link[i].name() << "\n";
}

with this kind of code:

for(const auto &number : this->_link)
{
          std::cout << this->_link[number].name() << "\n";
}

This prevents incorrect indexing. Particularly important in the KinematicTree class.

Woolfrey commented 9 months ago

Replaced everything in the KinematicTree class. Still need to compile and test.

Don't recall that there were any others in any other classes...