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(); } }
See https://trac.cppcheck.net/ticket/12662
Log in to post a comment.
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();
}
}
See https://trac.cppcheck.net/ticket/12662