Menu

Performance warning for std::string_view passed by value

2022-03-04
2022-03-04
  • Martin Taylor

    Martin Taylor - 2022-03-04

    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

     
  • CHR

    CHR - 2022-03-04
     
    • Martin Taylor

      Martin Taylor - 2022-03-04

      Thanks for the quick reply, and I see the same article was used for their background reading :-)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.