cleanup: replace constructs of the type &vector[0] by vector.data()

It appears that some misguided compiler / library combinations crash
on &vector[0] for empty vectors. Even though very unfriendly, they are
technically correct, so let's remove these constructs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-04-21 09:34:40 +02:00 committed by Dirk Hohndel
parent a8aa897117
commit 9b8eed7821
3 changed files with 6 additions and 6 deletions

View file

@ -548,8 +548,8 @@ void CylindersModel::remove(QModelIndex index)
endRemoveRows();
std::vector<int> mapping = get_cylinder_map_for_remove(d->cylinders.nr + 1, index.row());
cylinder_renumber(d, &mapping[0]);
DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]);
cylinder_renumber(d, mapping.data());
DivePlannerPointsModel::instance()->cylinderRenumber(mapping.data());
}
void CylindersModel::cylinderAdded(struct dive *changed, int pos)
@ -601,9 +601,9 @@ void CylindersModel::moveAtFirst(int cylid)
std::iota(mapping.begin(), mapping.begin() + cylid, 1);
mapping[cylid] = 0;
std::iota(mapping.begin() + (cylid + 1), mapping.end(), cylid);
cylinder_renumber(d, &mapping[0]);
cylinder_renumber(d, mapping.data());
if (inPlanner)
DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]);
DivePlannerPointsModel::instance()->cylinderRenumber(mapping.data());
endMoveRows();
}