]> git.lyx.org Git - lyx.git/commitdiff
Fix more unintended copies in range-based for loops
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 15 Oct 2021 15:41:01 +0000 (17:41 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 15 Oct 2021 15:43:12 +0000 (17:43 +0200)
Spotted by g++ 11.

src/Encoding.cpp
src/TocBackend.cpp
src/frontends/qt4/TocModel.cpp
src/insets/InsetInclude.cpp

index 35a93b40ecaa80b2fe346028fdfa2a2ef35225c1..d0046ecc068ee674d84776b6e672276de79140a0 100644 (file)
@@ -267,7 +267,7 @@ vector<char_type> 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<char_type, CharInfo> const & elem : unicodesymbols) {
+       for (pair<const char_type, CharInfo> const & elem : unicodesymbols) {
                if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end())
                        symbols.push_back(elem.first);
        }
index a253d57ca337ec2903d4ecc6b9b8f5d9975e82e9..4bb91816e89aca3906af2a5931ce690a24800072 100644 (file)
@@ -272,7 +272,7 @@ void TocBackend::resetOutlinerNames()
 {
        outliner_names_.clear();
        // names from this document class
-       for (pair<string, docstring> const & name
+       for (pair<const string, docstring> const & name
                     : buffer_->params().documentClass().outlinerNames())
                addName(name.first, translateIfPossible(name.second));
        // Hardcoded types
index 0733c1f6416b82548568c549d2ea189ce0682a54..a5b5bc5538d348276e560476235531b499f61fd7 100644 (file)
@@ -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<string, shared_ptr<Toc>> const & toc : backend.tocs()) {
+       for (pair<const string, shared_ptr<Toc>> const & toc : backend.tocs()) {
                QString const type = toqstr(toc.first);
 
                // First, fill in the toc models.
index 7bf23298148589ad97f8758e4ab04e63bf208b8b..dcfa73b08d5259d8cc1788b8abd26e0b4eb7e87c 100644 (file)
@@ -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<string, docstring> const & name
+               for (pair<const string, docstring> const & name
                             : childbuffer->params().documentClass().outlinerNames())
                        backend.addName(name.first, translateIfPossible(name.second));
        }