From a29fdaf5aaa16fcb6366003565738c9ef59c5944 Mon Sep 17 00:00:00 2001
From: RichardWaiteSTFC <richard.waite@stfc.ac.uk>
Date: Fri, 27 Mar 2020 09:04:05 +0000
Subject: [PATCH] Add const variables and iterators

---
 Framework/Crystal/src/IndexPeaks.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Framework/Crystal/src/IndexPeaks.cpp b/Framework/Crystal/src/IndexPeaks.cpp
index 979ecdc41e4..c9e1a53c0f2 100644
--- a/Framework/Crystal/src/IndexPeaks.cpp
+++ b/Framework/Crystal/src/IndexPeaks.cpp
@@ -413,18 +413,18 @@ std::map<std::string, std::string> IndexPeaks::validateInputs() {
   }
 
   // get all runs which have peaksin the table
-  bool commonUB = this->getProperty(Prop::COMMONUB);
+  const bool commonUB = this->getProperty(Prop::COMMONUB);
   if (commonUB) {
-    auto &allPeaks = ws->getPeaks();
+    const auto &allPeaks = ws->getPeaks();
     std::unordered_map<int, int> peaksPerRun;
-    auto it = allPeaks.begin();
-    while (peaksPerRun.size() < 2 && it != allPeaks.end()) {
+    auto it = allPeaks.cbegin();
+    while (peaksPerRun.size() < 2 && it != allPeaks.cend()) {
       peaksPerRun[it->getRunNumber()] = 1;
       ++it;
     };
     if (peaksPerRun.size() < 2) {
       helpMsgs[Prop::COMMONUB] =
-          "CommonUBForAll can only be True if there are peaks from more"
+          "CommonUBForAll can only be True if there are peaks from more "
           "than one run present in the peaks worksapce";
     };
   };
-- 
GitLab