Modernizing; Use std::accumulate instead of for loop
This commit is contained in:
parent
9c5d24c551
commit
74fad6ce05
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue