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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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 watching all bug changes.

Reply via email to