Hi,
std::string_view arguments are generally considered to be more efficient when passed by value rather than by const reference (eg see https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/).
std::span serves a similar purpose for arrays.
But when passed by value cppcheck flags it as a performance issue. Is this intentional, or otherwise something that could be addressed?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
std::string_view arguments are generally considered to be more efficient when passed by value rather than by const reference (eg see https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/).
std::span serves a similar purpose for arrays.
But when passed by value cppcheck flags it as a performance issue. Is this intentional, or otherwise something that could be addressed?
Thanks
This was fixed by https://github.com/danmar/cppcheck/pull/3817
Thanks for the quick reply, and I see the same article was used for their background reading :-)