Paul Fultz - 2018-08-21

Hi,

I would like to add a check to recommend a C++ algorithm if possible instead
of a raw loop. That is, something like:

std::vector<int> v;
int total = 0;
for(auto x:v)
    total += x;

And then it would recommend to use std::accumulate for this loop. Is this
something that could be integrated directly into cppcheck? Would we want to
use new category or reuse a current one(such as style or performance)?

I guess an addon could be added but these are not that easy to use and aren't
installed with cmake installation. I would like something integrated into
cppcheck.

Thanks,
Paul

 

Last edit: Paul Fultz 2018-08-21