[LyX/master] Use ranges, fix warnings

Richard Kimberly Heck rikiheck at lyx.org
Fri Feb 28 06:23:34 UTC 2020


commit 3f9aa8145206025d9fb63bdab4214dd8bee2775f
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Fri Feb 28 01:25:30 2020 -0500

    Use ranges, fix warnings
---
 src/CiteEnginesList.cpp |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/CiteEnginesList.cpp b/src/CiteEnginesList.cpp
index f58fa72..53ec83e 100644
--- a/src/CiteEnginesList.cpp
+++ b/src/CiteEnginesList.cpp
@@ -102,7 +102,7 @@ string LyXCiteEngine::getDefaultBiblio(CiteEngineType const & cet) const
 bool LyXCiteEngine::isDefaultBiblio(string const & bf) const
 {
 	string const bfs = ":" + bf;
-	for (string const &s: default_biblios_)
+	for (string const & s: default_biblios_)
 		if (suffixIs(s, bfs) || bf == s)
 			return true;
 
@@ -294,25 +294,21 @@ LyXCiteEnginesList::iterator CiteEnginesList::end()
 
 LyXCiteEngine const * CiteEnginesList::operator[](string const & str) const
 {
-	LyXCiteEnginesList::const_iterator it = englist_.begin();
-	for (; it != englist_.end(); ++it)
-		if (it->getID() == str) {
-			LyXCiteEngine const & eng = *it;
+	for (auto const & eng : englist_)
+		if (eng.getID() == str) {
 			return ŋ
 		}
-	return 0;
+	return nullptr;
 }
 
 
 LyXCiteEngine * CiteEnginesList::operator[](string const & str)
 {
-	LyXCiteEnginesList::iterator it = englist_.begin();
-	for (; it != englist_.end(); ++it)
-		if (it->getID() == str) {
-			LyXCiteEngine & eng = *it;
+	for (auto & eng : englist_)
+		if (eng.getID() == str) {
 			return ŋ
 		}
-	return 0;
+	return nullptr;
 }
 
 } // namespace lyx


More information about the lyx-cvs mailing list