Menu

building a string_view from a c_str() is invalid

2023-07-06
2023-07-07
  • Gaetano Mendola

    Gaetano Mendola - 2023-07-06

    cppcheck 2.11 claims that in the following snippet the construction of a string_view via c_str is redundant.

    std::string myLine;
    ...
    std::string_view myKey(myLine.data(), 13);
    
     

    Last edit: Gaetano Mendola 2023-07-06
  • CHR

    CHR - 2023-07-07

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11819

     

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.