diff --git a/src/storm/storage/SparseMatrix.cpp b/src/storm/storage/SparseMatrix.cpp index 559902e77..e346e2fbb 100644 --- a/src/storm/storage/SparseMatrix.cpp +++ b/src/storm/storage/SparseMatrix.cpp @@ -598,7 +598,7 @@ namespace storm { // If there is no current row grouping, we need to create it. if (!this->rowGroupIndices) { STORM_LOG_ASSERT(trivialRowGrouping, "Only trivial row-groupings can be constructed on-the-fly."); - this->rowGroupIndices = storm::utility::vector::buildVectorForRange(0, this->getRowGroupCount() + 1); + this->rowGroupIndices = storm::utility::vector::buildVectorForRange(static_cast(0), this->getRowGroupCount() + 1); } return rowGroupIndices.get(); } @@ -627,7 +627,7 @@ namespace storm { template void SparseMatrix::makeRowGroupingTrivial() { if (trivialRowGrouping) { - STORM_LOG_ASSERT(!rowGroupIndices || rowGroupIndices.get() == storm::utility::vector::buildVectorForRange(0, this->getRowGroupCount() + 1), "Row grouping is supposed to be trivial but actually it is not."); + STORM_LOG_ASSERT(!rowGroupIndices || rowGroupIndices.get() == storm::utility::vector::buildVectorForRange(static_cast(0), this->getRowGroupCount() + 1), "Row grouping is supposed to be trivial but actually it is not."); } else { trivialRowGrouping = true; rowGroupIndices = boost::none; diff --git a/src/storm/utility/vector.h b/src/storm/utility/vector.h index 6d3c1d281..53e89cacc 100644 --- a/src/storm/utility/vector.h +++ b/src/storm/utility/vector.h @@ -103,10 +103,11 @@ namespace storm { /*! * Constructs a vector [min, min+1, ...., max-1] */ - inline std::vector buildVectorForRange(uint_fast64_t min, uint_fast64_t max) { - STORM_LOG_ASSERT(min < max, "Invalid range."); - uint_fast64_t diff = max - min; - std::vector v; + template + inline std::vector buildVectorForRange(T min, T max) { + STORM_LOG_ASSERT(min <= max, "Invalid range."); + T diff = max - min; + std::vector v; v.reserve(diff); iota_n(std::back_inserter(v), diff, min); return v; @@ -119,7 +120,7 @@ namespace storm { */ template std::vector getSortedIndices(std::vector const& v){ - std::vector res = buildVectorForRange(0, v.size()); + std::vector res = buildVectorForRange(0, v.size()); std::sort(res.begin(), res.end(), [&v](uint_fast64_t index1, uint_fast64_t index2) { return v[index1] > v[index2];}); return res; }