Merge pull request #20142 from bofdahof/ranges
Apply C++20 std::ranges (mainly to std::find)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user