Merge pull request #20142 from bofdahof/ranges

Apply C++20 std::ranges (mainly to std::find)
This commit is contained in:
Chris Hennes
2025-03-17 03:08:27 -05:00
committed by GitHub
93 changed files with 485 additions and 662 deletions

View File

@@ -212,11 +212,11 @@ bool TaskLoftParameters::referenceSelected(const Gui::SelectionChanges& msg) con
loft->Profile.setValue(obj, {msg.pSubName});
return true;
}
else if (selectionMode == refAdd || selectionMode == refRemove) {
if (selectionMode == refAdd || selectionMode == refRemove) {
// now check the sections
std::vector<App::DocumentObject*> refs = loft->Sections.getValues();
std::vector<App::DocumentObject*>::iterator f =
std::find(refs.begin(), refs.end(), obj);
const auto f = std::ranges::find(refs, obj);
if (selectionMode == refAdd) {
if (f != refs.end()) {
@@ -264,12 +264,10 @@ void TaskLoftParameters::onDeleteSection()
delete item;
// search inside the list of sections
if (auto loft = getObject<PartDesign::Loft>()) {
if (const auto loft = getObject<PartDesign::Loft>()) {
std::vector<App::DocumentObject*> refs = loft->Sections.getValues();
App::DocumentObject* obj = loft->getDocument()->getObject(data.constData());
std::vector<App::DocumentObject*>::iterator f =
std::find(refs.begin(), refs.end(), obj);
if (f != refs.end()) {
if (const auto f = std::ranges::find(refs, obj); f != refs.end()) {
loft->Sections.removeValue(obj);
recomputeFeature();