]> git.lyx.org Git - lyx.git/commitdiff
Avoid some more copies in range-based for loops
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 15 Oct 2021 14:10:04 +0000 (16:10 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 15 Oct 2021 15:43:12 +0000 (17:43 +0200)
This triggers warnings with clang++ 10 and gcc 11.

(cherry-picked from commit 7035e230caa69a2e35f16dcf0d9696c59cef5c4c)

src/frontends/qt4/Menus.cpp

index 5f9eb9068d8d580bec800287294b2258259d12c8..a2505dc250b95c24421773223f3ed5a712ebd27c 100644 (file)
@@ -1337,7 +1337,7 @@ void MenuDefinition::expandToc(Buffer const * buf)
        // In the navigation menu, only add tocs from this document
        TocBackend const & backend = buf->tocBackend();
        TocList const & toc_list = backend.tocs();
-       for (pair<string, shared_ptr<Toc>> const & toc : toc_list) {
+       for (pair<const string, shared_ptr<Toc>> const & toc : toc_list) {
                // Handle table of contents later
                if (toc.first == "tableofcontents" || toc.second->empty())
                        continue;
@@ -1695,7 +1695,7 @@ void MenuDefinition::expandCaptions(Buffer const * buf, bool switchcap)
 
        DocumentClass const & dc = buf->params().documentClass();
        vector< pair<docstring, FuncRequest> > caps;
-       for (pair<docstring, InsetLayout> const & il : dc.insetLayouts()) {
+       for (pair<const docstring, InsetLayout> const & il : dc.insetLayouts()) {
                docstring instype;
                docstring const type = split(il.first, instype, ':');
                if (instype == from_ascii("Caption")) {