cleanup: use range based loops in model

There were a number of classical "for (i = 0; i < size; ++i)"
loops. Replace them either by plain range based loops if the index
is not used or by enumerated_range() loops.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-10-30 21:24:13 +01:00
parent 727d519046
commit b63073e203
2 changed files with 22 additions and 20 deletions

View file

@ -206,8 +206,8 @@ void DivePictureModel::picturesAdded(dive *d, QVector<PictureObj> picsIn)
// Convert the picture-data into our own format
std::vector<PictureEntry> pics;
pics.reserve(picsIn.size());
for (int i = 0; i < picsIn.size(); ++i)
pics.push_back(PictureEntry(d, picsIn[i]));
for (const PictureObj &pic: picsIn)
pics.push_back(PictureEntry(d, pic));
// Insert batch-wise to avoid too many reloads
pictures.reserve(pictures.size() + pics.size());