From a7e5e613f86963c8bf82248ab044e0ea36e42fbc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Mar 2018 12:09:30 +0300 Subject: LIST<>::indexOf(T**) - fast index calculation for direct iterators --- plugins/TopToolBar/src/toolbar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/TopToolBar') diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 380daf02dd..a0a77b8536 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -25,11 +25,11 @@ LIST Buttons(8, sortfunc); TopButtonInt *idtopos(int id, int *pPos) { - for (int i = 0; i < Buttons.getCount(); i++) - if (Buttons[i]->id == id) { + for (auto &it : Buttons) + if (it->id == id) { if (pPos) - *pPos = i; - return Buttons[i]; + *pPos = Buttons.indexOf(&it); + return it; } if (pPos) -- cgit v1.2.3