From: Richard Kimberly Heck Date: Thu, 23 May 2019 01:27:24 +0000 (-0400) Subject: Use ranges. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=143f47ac0b099acabb4959f890d75d11a4d6f5da;p=features.git Use ranges. --- diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index 3f855c9313..08e2ad628d 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -1445,38 +1445,35 @@ void MenuDefinition::expandBranches(Buffer const * buf) return; } - BranchList::const_iterator mit = master_list.begin(); - BranchList::const_iterator const mend = master_list.end(); - for (int ii = 1; mit != mend; ++mit, ++ii) { + int ii = 1; + for (auto const & b : master_list) { + docstring const & bname = b.branch(); // NUM. Branch Name + "|", which triggers an empty shortcut in // case that character should be in the branch name - docstring label = convert(ii) + ". " + - mit->branch() + char_type('|'); + docstring label = convert(ii) + ". " + bname + char_type('|'); if (ii < 10) { // Add NUM as a keyboard shortcut label += convert(ii); } addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label), - FuncRequest(LFUN_BRANCH_INSERT, - mit->branch()))); + FuncRequest(LFUN_BRANCH_INSERT, bname))); + ++ii; } if (buf == buf->masterBuffer()) return; MenuDefinition child_branches; - BranchList::const_iterator ccit = child_list.begin(); - BranchList::const_iterator cend = child_list.end(); - for (int ii = 1; ccit != cend; ++ccit, ++ii) { - docstring label = convert(ii) + ". " + - ccit->branch() + char_type('|'); + ii = 1; + for (auto const & b : child_list) { + docstring const & bname = b.branch(); + docstring label = convert(ii) + ". " + bname + char_type('|'); if (ii < 10) { label += convert(ii); } child_branches.addWithStatusCheck(MenuItem(MenuItem::Command, - toqstr(label), - FuncRequest(LFUN_BRANCH_INSERT, - ccit->branch()))); + toqstr(label), FuncRequest(LFUN_BRANCH_INSERT, bname))); + ++ii; } if (!child_branches.empty()) {