[clazy] [Bug 359306] New: new check idea: avoid using Q_FOREACH to iterate over QMap/QHash keys and retrieve values inside loop
Nyall Dawson via KDE Bugzilla
bugzilla_noreply at kde.org
Fri Feb 12 09:37:55 GMT 2016
https://bugs.kde.org/show_bug.cgi?id=359306
Bug ID: 359306
Summary: new check idea: avoid using Q_FOREACH to iterate over
QMap/QHash keys and retrieve values inside loop
Product: clazy
Version: unspecified
Platform: Other
OS: Linux
Status: UNCONFIRMED
Severity: wishlist
Priority: NOR
Component: general
Assignee: unassigned-bugs at kde.org
Reporter: nyall.dawson at gmail.com
CC: smartins at kde.org
Eg:
QMap<QString,QString> map;
Q_FOREACH( const QString& key, map.keys() )
{
QString val = map.value(key);
...
}
It's inefficient, and it'd be nice to catch this and suggest using
QMap::iterator/QHash::Iterator to iterate over both the keys and values at the
same time to avoid the unnecessary lookup.
Reproducible: Always
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Unassigned-bugs
mailing list