Skip to content

Commit

Permalink
simplified iterator/index arithmetics using static casts. re gentryx#49
Browse files Browse the repository at this point in the history
  • Loading branch information
seb-ehm committed Nov 4, 2017
1 parent 00f8f26 commit 627a545
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/libgeodecomp/storage/reorderingunstructuredgrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ class ReorderingUnstructuredGrid : public GridBase<typename DELEGATE_GRID::CellT
}

for (RowLengthVec::iterator i = reorderedRowLengths.begin(); i != reorderedRowLengths.end(); ) {
std::size_t currentIndex = i - reorderedRowLengths.begin();
std::size_t nextIndex = (std::min)(currentIndex + SIGMA, reorderedRowLengths.size());
RowLengthVec::iterator nextStop = reorderedRowLengths.begin() + currentIndex;
RowLengthVec::iterator nextStop = static_cast<RowLengthVec::iterator>((std::min)(static_cast<RowLengthVec::size_type>(i) + SIGMA, reorderedRowLengths.end()));

std::stable_sort(i, nextStop, [](const IntPair& a, const IntPair& b) {
return a.second > b.second;
Expand Down

0 comments on commit 627a545

Please sign in to comment.