Modernizing; Use std::accumulate instead of for loop

This commit is contained in:
Daniel Marjamäki 2019-04-28 11:25:43 +02:00
parent 9c5d24c551
commit 74fad6ce05
1 changed files with 6 additions and 6 deletions

View File

@ -36,7 +36,7 @@
#include <tinyxml2.h>
#include <algorithm>
#include <cstdlib>
#include <numeric>
#include <numeric> // std::accumulate
#include <sstream>
#include <stack>
#include <utility>
@ -508,9 +508,9 @@ ValueFlow::Value CheckBufferOverrun::getBufferSize(const Token *bufTok) const
if (!var)
return ValueFlow::Value(-1);
MathLib::bigint dim = 1;
for (const Dimension &d : var->dimensions())
dim *= d.num;
MathLib::bigint dim = std::accumulate(var->dimensions().begin(), var->dimensions().end(), 1LL, [](MathLib::bigint i1, const Dimension &dim) {
return i1 * dim.num;
});
ValueFlow::Value v;
v.setKnown();