[LyX/master] Avoid some more copies in range-based for loops

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Apr 28 13:08:17 UTC 2020


commit 7035e230caa69a2e35f16dcf0d9696c59cef5c4c
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Apr 28 15:28:21 2020 +0200

    Avoid some more copies in range-based for loops
    
    This triggers warnings with clang++ 10.
---
 src/frontends/qt/Menus.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index b77164b..cb30e07 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -1356,7 +1356,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;
@@ -1761,7 +1761,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")) {


More information about the lyx-cvs mailing list