D21121: Fix leaking of requests in ItemRetriever::exec()

Anthony Fieroni noreply at phabricator.kde.org
Sat May 11 18:09:28 BST 2019


anthonyfieroni added inline comments.

INLINE COMMENTS

> dfaure wrote in itemretriever.cpp:332-335
> A `for` loop better than `find_if`? What makes you say that?
> I want to find one element and process it.
> With a `for` loop I'd need to insert an `if()`, and a `break`... and it would mean mixing finding and processing. And the reader wouldn't be immediately sure that I'm only looking for one item, until finding the break much further down.
> 
> It's general consensus that using an algorithm is always better than writing a `for` loop.

I made a wrong assumption, i mean well readable

  for (auto it = requests.begin(); it != requests.end(); ++it) {
      if (it->get() == finishedRequest) {

REPOSITORY
  R165 Akonadi

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

To: dfaure, dvratil
Cc: anthonyfieroni, kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20190511/e875991e/attachment.html>


More information about the kde-pim mailing list