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

@@ -202,11 +202,10 @@ void TaskShapeBinder::deleteItem()
PartDesign::ShapeBinder* binder = vp->getObject<PartDesign::ShapeBinder>();
PartDesign::ShapeBinder::getFilteredReferences(&binder->Support, obj, subs);
std::string subname = data.constData();
std::vector<std::string>::iterator it = std::find(subs.begin(), subs.end(), subname);
const std::string subname = data.constData();
// if something was found, delete it and update the support
if (it != subs.end()) {
if (const auto it = std::ranges::find(subs, subname); it != subs.end()) {
subs.erase(it);
binder->Support.setValue(obj, subs);
@@ -315,10 +314,11 @@ bool TaskShapeBinder::referenceSelected(const SelectionChanges& msg) const
if (selectionMode != refObjAdd) {
// ensure the new selected subref belongs to the same object
if (strcmp(msg.pObjectName, obj->getNameInDocument()) != 0)
if (strcmp(msg.pObjectName, obj->getNameInDocument()) != 0) {
return false;
}
std::vector<std::string>::iterator f = std::find(refs.begin(), refs.end(), subName);
const auto f = std::ranges::find(refs, subName);
if (selectionMode == refAdd) {
if (f == refs.end())