[LyX/master] Do not for copies in range-based for loops.
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Tue Apr 28 11:07:37 UTC 2020
commit a85c48de5a15c4f70f79a53b451fbe0d083e9ece
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Tue Apr 28 13:27:50 2020 +0200
Do not for copies in range-based for loops.
Spotted by clang++ 10.
---
src/HunspellChecker.cpp | 4 ++--
src/LaTeX.cpp | 2 +-
src/tex2lyx/Preamble.cpp | 5 ++---
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/HunspellChecker.cpp b/src/HunspellChecker.cpp
index 593a123..c211b47 100644
--- a/src/HunspellChecker.cpp
+++ b/src/HunspellChecker.cpp
@@ -424,7 +424,7 @@ void HunspellChecker::suggest(WordLangTuple const & wl,
string const word_to_check = to_iconv_encoding(wl.word(), encoding);
#ifdef HAVE_HUNSPELL_CXXABI
vector<string> wlst = h->suggest(word_to_check);
- for (auto const s : wlst)
+ for (auto const & s : wlst)
suggestions.push_back(remap_result(from_iconv_encoding(s, encoding)));
#else
char ** suggestion_list;
@@ -449,7 +449,7 @@ void HunspellChecker::stem(WordLangTuple const & wl,
string const word_to_check = to_iconv_encoding(wl.word(), encoding);
#ifdef HAVE_HUNSPELL_CXXABI
vector<string> wlst = h->stem(word_to_check);
- for (auto const s : wlst)
+ for (auto const & s : wlst)
suggestions.push_back(from_iconv_encoding(s, encoding));
#else
char ** suggestion_list;
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index be94654..a34db97 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -238,7 +238,7 @@ int LaTeX::run(TeXErrors & terr)
// Also remove all children which are included
Buffer const * buf = theBufferList().getBufferFromTmp(file.absFileName());
if (buf && buf->params().maintain_unincluded_children == BufferParams::CM_Mostly) {
- for (auto const incfile : buf->params().getIncludedChildren()) {
+ for (auto const & incfile : buf->params().getIncludedChildren()) {
string const incm =
DocFileName(changeExtension(makeAbsPath(incfile, path)
.absFileName(), ".tex")).mangledFileName();
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 5b93f98..6f75752 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -2572,10 +2572,9 @@ void Preamble::parse(Parser & p, string const & forceclass,
if (i != string::npos)
h_paperfontsize.erase(i);
// Now those known specifically to the class
- string fsize;
vector<string> class_fsizes = getVectorFromString(tc.opt_fontsize(), "|");
string const fsize_format = tc.fontsizeformat();
- for (auto const fsize : class_fsizes) {
+ for (auto const & fsize : class_fsizes) {
string latexsize = subst(fsize_format, "$$s", fsize);
vector<string>::iterator it = find(opts.begin(), opts.end(), latexsize);
if (it != opts.end()) {
@@ -2642,7 +2641,7 @@ void Preamble::parse(Parser & p, string const & forceclass,
string paper;
vector<string> class_psizes = getVectorFromString(tc.opt_pagesize(), "|");
string const psize_format = tc.pagesizeformat();
- for (auto const psize : class_psizes) {
+ for (auto const & psize : class_psizes) {
string latexsize = subst(psize_format, "$$s", psize);
vector<string>::iterator it = find(opts.begin(), opts.end(), latexsize);
if (it != opts.end()) {
More information about the lyx-cvs
mailing list