D19298: Make it compile without foreach

David Faure noreply at phabricator.kde.org
Sat Mar 2 23:16:52 GMT 2019


dfaure accepted this revision.
dfaure added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> Polkit1Backend.cpp:203
>  {
> -    Q_FOREACH (const QString &action, m_cachedResults.keys()) {
> +    const auto listKeys = m_cachedResults.keys();
> +    for (const QString &action : listKeys) {

(pre-existing) bad, very slow, creates a temp container just to iterate.

  for (auto it = m_cachedResults.begin(); it != m_cachedResults.end(); ++it) {
      const QString action = it.key();
      if (it.value() != ....) {
          *it = ....;
           ...
      }
  }

REPOSITORY
  R283 KAuth

BRANCH
  compile_without_foreach (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D19298

To: mlaurent, dfaure
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190302/81b6ab4d/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list