Woolfrey / software_robot_library

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

Use structured bindings for `std::map` objects #97

Closed Woolfrey closed 9 months ago

Woolfrey commented 9 months ago

Instead of using something like:

std::map<std::string,RigidBody> rigidBodyList;
auto container = rigidBodyList.begin();
// container->first gives the string
// container->second gives the RigidBody object

it can be replaced with structured bindings for readability:

auto &[name, rigidBody] = rigidBodyList.begin;
// name is the string
// rigidBody is the object

Particularly useful in the KinematicTree class.

Woolfrey commented 9 months ago

Replaced everything in KinematicTree.h.