Menu

unreadVariable false positive when using iterators to change values in containers

2024-04-26
2024-04-26
  • Steve Albright

    Steve Albright - 2024-04-26

    The code probably could be better but shows that values are changing in the container so the unreadVariable warning should not apply.

    void Example(QMap<qstring, qobject*="">& moduleMap)
    {
    auto it = moduleMap.find("SomeKey");</qstring,>

    if(it != moduleMap.end())
    {
    delete it.value();
    it.value() = new QObject();
    }
    }

     
  • CHR

    CHR - 2024-04-26
     

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.