map: use value semantics for MapLocation

This makes memory management more simple, as not explicit deletion
is necessary.

A rather large commit, because changing QVector<> to std::vector<>
is propagated up the call chain.

Adds a new range_contains() helper function for collection
types such as std::vector<>. I didn't want to call it
contains(), since we already have a contains function
for strings and let's keep argument overloading simple.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-11 13:21:53 +02:00 committed by bstoeger
parent e39dea3d68
commit 6b835710bc
17 changed files with 84 additions and 75 deletions

View file

@ -79,10 +79,10 @@ bool MapWidget::editMode() const
return isReady && m_mapHelper->editMode();
}
void MapWidget::setSelected(const QVector<dive_site *> &divesites)
void MapWidget::setSelected(std::vector<dive_site *> divesites)
{
CHECK_IS_READY_RETURN_VOID();
m_mapHelper->setSelected(divesites);
m_mapHelper->setSelected(std::move(divesites));
m_mapHelper->centerOnSelectedDiveSite();
}
@ -97,7 +97,7 @@ void MapWidget::selectedDivesChanged(const QList<int> &list)
if (dive *d = get_dive(idx))
selection.push_back(d);
}
setSelection(selection, current_dive, -1);
setSelection(std::move(selection), current_dive, -1);
}
void MapWidget::coordinatesChanged(struct dive_site *ds, const location_t &location)