D23813: Port away from foreach loops over arguments without calls to owner class

Friedrich W. H. Kossebau noreply at phabricator.kde.org
Thu Sep 12 14:50:48 BST 2019


kossebau added inline comments.

INLINE COMMENTS

> ahmadsamir wrote in kkeysequencewidget.cpp:127
> I understand. but I was talking about this case specifically, it's about foreach two arguments, and making them const as needed, so that seqAsString change is in inline with replacing foreach with range-for.

Is it?
This patch as is now has 3 changes:

- change a foreach loop over extracted key list of a QHash to then also access values (2 discouraged things) to iterator-based for loop over the QHash
- change a foreach loop over a QList to a range-based for loop over the QList
- cache the result of toString() outside of the inner loop

Each of those is an independent change. The first two both fall into the domain of "port away from foreach". The last one, as could be also seen in the first version of this patch, has nothing to do with them, `seq` was a const reference before and has been after (well, then represented/replaced by`it.key()`).

Where would you see that "making them const as needed" that you based your reply on? :)

REPOSITORY
  R263 KXmlGui

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

To: kossebau, dfaure
Cc: ahmadsamir, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190912/89665ed0/attachment.html>


More information about the Kde-frameworks-devel mailing list