CAM: apply std::ranges

This commit is contained in:
bofdahof
2025-03-12 17:47:33 +10:00
committed by Chris Hennes
parent 192ae4a152
commit 474b0314b3

View File

@@ -129,16 +129,17 @@ EndMill* MillSimulation::GetTool(int toolId)
return nullptr;
}
void MillSimulation::RemoveTool(int toolId)
void MillSimulation::RemoveTool(const int toolId)
{
EndMill* tool;
if ((tool = GetTool(toolId)) != nullptr) {
auto it = std::find(mToolTable.begin(), mToolTable.end(), tool);
if (it != mToolTable.end()) {
mToolTable.erase(it);
}
delete tool;
EndMill* tool = GetTool(toolId);
if (tool == nullptr) {
return;
}
if (const auto it = std::ranges::find(mToolTable, tool); it != mToolTable.end()) {
mToolTable.erase(it);
}
delete tool;
}