From 477a6ea70d0bb1b1dfe9cbd9a15b6dad0284ddeb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 21 Feb 2018 18:40:03 +0300 Subject: all another C++'11 iterators --- plugins/FloatingContacts/src/thumbs.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'plugins/FloatingContacts/src/thumbs.cpp') diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index 27f953a689..46a593c656 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -107,15 +107,14 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos) if (fcOpt.bMoveTogether) UndockThumbs(this, thumbList.FindThumb(dockOpt.hwndLeft)); - for (int i = 0; i < thumbList.getCount(); ++i) { - ThumbInfo *pCurThumb = &thumbList[i]; - if (pCurThumb == this) + for (auto &it : thumbList) { + if (it == this) continue; GetThumbRect(&rcThumb); OffsetRect(&rcThumb, nX - rcThumb.left, nY - rcThumb.top); - pCurThumb->GetThumbRect(&rc); + it->GetThumbRect(&rc); // These are rects we will dock into @@ -190,10 +189,10 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos) if (fcOpt.bMoveTogether) { if (bDockedRight) - DockThumbs(this, pCurThumb); + DockThumbs(this, it); if (bDockedLeft) - DockThumbs(pCurThumb, this); + DockThumbs(it, this); } // Lower-left @@ -776,9 +775,9 @@ ThumbInfo* ThumbList::FindThumb(HWND hwnd) { if (!hwnd) return nullptr; - for (int i = 0; i < getCount(); ++i) - if (items[i]->hwnd == hwnd) - return items[i]; + for (auto &it : *this) + if (it->hwnd == hwnd) + return it; return nullptr; } @@ -787,9 +786,9 @@ ThumbInfo *ThumbList::FindThumbByContact(MCONTACT hContact) { if (!hContact) return nullptr; - for (int i = 0; i < getCount(); ++i) - if (items[i]->hContact == hContact) - return items[i]; + for (auto &it : *this) + if (it->hContact == hContact) + return it; return nullptr; } -- cgit v1.2.3