Closed adamkewley closed 1 year ago
The OpenSim pattern:
OpenSim::Joint* j = new WeldJoint{}; model.addJoint(j); osc.setSelected(j);
Is error-prone because it relies on creating naked pointers, where the naked pointer's lifetime isn't RAII controlled.
So instead, it would be better to have functions like:
namespace osc { template<typename TJoint, typename... Args> TJoint& AddJointOpenSim::Model const&, Args...); }
Where the caller can then write:
auto& j = AddJoint<OpenSim::WeldJoint>(model);
The OpenSim pattern:
Is error-prone because it relies on creating naked pointers, where the naked pointer's lifetime isn't RAII controlled.
So instead, it would be better to have functions like:
Where the caller can then write: