From 09b340a45e4563d11a9a132c86693fb44f898b81 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 15 Oct 2021 17:41:01 +0200 Subject: [PATCH] Fix more unintended copies in range-based for loops Spotted by g++ 11. --- src/Encoding.cpp | 2 +- src/TocBackend.cpp | 2 +- src/frontends/qt4/TocModel.cpp | 2 +- src/insets/InsetInclude.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 35a93b40ec..d0046ecc06 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -267,7 +267,7 @@ vector Encoding::symbolsList() const // add all encodable characters copy(encodable_.begin(), encodable_.end(), back_inserter(symbols)); // now the ones from the unicodesymbols file that are not already there - for (pair const & elem : unicodesymbols) { + for (pair const & elem : unicodesymbols) { if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end()) symbols.push_back(elem.first); } diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index a253d57ca3..4bb91816e8 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -272,7 +272,7 @@ void TocBackend::resetOutlinerNames() { outliner_names_.clear(); // names from this document class - for (pair const & name + for (pair const & name : buffer_->params().documentClass().outlinerNames()) addName(name.first, translateIfPossible(name.second)); // Hardcoded types diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp index 0733c1f641..a5b5bc5538 100644 --- a/src/frontends/qt4/TocModel.cpp +++ b/src/frontends/qt4/TocModel.cpp @@ -353,7 +353,7 @@ void TocModels::reset(BufferView const * bv) names_->insertColumns(0, 1); // In the outliner, add Tocs from the master document TocBackend const & backend = bv->buffer().masterBuffer()->tocBackend(); - for (pair> const & toc : backend.tocs()) { + for (pair> const & toc : backend.tocs()) { QString const type = toqstr(toc.first); // First, fill in the toc models. diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 7bf2329814..dcfa73b08d 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -1288,7 +1288,7 @@ void InsetInclude::addToToc(DocIterator const & cpit, bool output_active, //Copy missing outliner names (though the user has been warned against //having different document class and module selection between master //and child). - for (pair const & name + for (pair const & name : childbuffer->params().documentClass().outlinerNames()) backend.addName(name.first, translateIfPossible(name.second)); }