Use std::accumulate instead of manually adding
This commit is contained in:
parent
e89f157bac
commit
c065b04cbe
@ -283,12 +283,6 @@ const CheckableItem &CheckableTestModel::getItem(const QModelIndex &index) const
|
||||
|
||||
unsigned int CheckableTestModel::getPoints() const
|
||||
{
|
||||
unsigned int points = 0;
|
||||
|
||||
for (const auto &test : m_tests)
|
||||
{
|
||||
points += test.getPoints();
|
||||
}
|
||||
|
||||
return points;
|
||||
return std::accumulate(std::begin(m_tests), std::end(m_tests), 0,
|
||||
[](int base, const CheckableTest &test) { return base + test.getPoints(); });
|
||||
}
|
||||
|
Reference in New Issue
Block a user