cppcheck algorithm suggestions

Miklos Vajna vmiklos at collabora.com
Mon Jan 25 08:23:39 UTC 2021


Hi Dave,

On Sat, Jan 23, 2021 at 09:36:57PM +0000, "Dr. David Alan Gilbert" <dave at treblig.org> wrote:
>   What are peoples feelings for cppcheck's suggestions for stl algorithms?
> In https://gerrit.libreoffice.org/c/core/+/109846 I did a 'any_of'
> and a 'accumulate' that it suggested;  the any_of does look better,
> the accumulate seems marginally better.
> 
> Does the project/people have general preferences on whether it's
> worth tackling these suggestions?
> 
> I was less sure what to do with the suggestions for 'transform';
> some of them were replacing very simple loops; another
> was using emplace_back to add the results to the destination and I wasn't
> sure what I'd pass into transform for the equivalent.

I think replacing pre-C++11 code with these is an improvement, but if we
already use a range-based for loop, then we don't gain much from one
more similar refactor.

Regards,

Miklos


More information about the LibreOffice mailing list