diff --git a/Framework/API/inc/MantidAPI/Expression.h b/Framework/API/inc/MantidAPI/Expression.h index d547ee5f9a3985dc8596057f18125e3f9ddda505..1452f9f4caa088946deaa548a967df4b6e61964d 100644 --- a/Framework/API/inc/MantidAPI/Expression.h +++ b/Framework/API/inc/MantidAPI/Expression.h @@ -75,7 +75,7 @@ public: /// string but recreates it. std::string str() const; /// Returns true if the expression is a function (i.e. has arguments) - bool isFunct() const { return m_terms.size() > 0; } + bool isFunct() const { return !m_terms.empty(); } /// Returns the name of the expression which is a function or variable name. std::string name() const { return m_funct; } /// Returns the the expression's binary operator on its left. Can be an empty diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp index 27e8d0fd4b3f6e17dd9759c695ef275a2b0224b1..fb3bd5804ee1c0150612305972b3f811b3dc4bf5 100644 --- a/Framework/API/src/CompositeFunction.cpp +++ b/Framework/API/src/CompositeFunction.cpp @@ -383,7 +383,7 @@ size_t CompositeFunction::addFunction(IFunction_sptr f) { m_IFunction.insert(m_IFunction.end(), f->nParams(), m_functions.size()); m_functions.push_back(f); //?f->init(); - if (m_paramOffsets.size() == 0) { + if (m_paramOffsets.empty()) { m_paramOffsets.push_back(0); m_nParams = f->nParams(); } else { diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp index ec8ba7247905b98852c8cd68caa01b1f7ad6f9ff..8f3564fde4e93dc29190707ca58c71d439160f0a 100644 --- a/Framework/API/src/Expression.cpp +++ b/Framework/API/src/Expression.cpp @@ -134,7 +134,7 @@ void Expression::parse(const std::string &str) { tokenize(); - if (m_tokens.size() == 0) { + if (m_tokens.empty()) { setFunct(m_expr); return; } @@ -310,7 +310,7 @@ void Expression::tokenize() { } // for i - if (tokens.size()) { + if (!tokens.empty()) { // remove operators of higher prec m_tokens.push_back(Token(tokens[0])); for (size_t i = 0; i < tokens.size(); i++) { @@ -328,7 +328,7 @@ void Expression::tokenize() { } std::string Expression::GetToken(size_t i) { - if (m_tokens.size() == 0) + if (m_tokens.empty()) return m_expr; if (i < m_tokens.size()) { @@ -345,7 +345,7 @@ std::string Expression::GetToken(size_t i) { } std::string Expression::GetOp(size_t i) { - if (m_tokens.size() == 0 || i >= m_tokens.size()) + if (m_tokens.empty() || i >= m_tokens.size()) return ""; Token &tok = m_tokens[i]; @@ -354,7 +354,7 @@ std::string Expression::GetOp(size_t i) { void Expression::logPrint(const std::string &pads) const { std::string myPads = pads + " "; - if (m_terms.size()) { + if (!m_terms.empty()) { std::cerr << myPads << m_op << '[' << m_funct << ']' << "(" << '\n'; for (const auto &term : m_terms) term.logPrint(myPads); @@ -442,7 +442,7 @@ std::string Expression::str() const { brackets = true; } - if (m_terms.size()) { + if (!m_terms.empty()) { if (brackets) res << '('; for (const auto &term : m_terms) { diff --git a/Framework/API/src/FileFinder.cpp b/Framework/API/src/FileFinder.cpp index c0f449adb2ea615a54195a9734164a28c0a7d544..84c7facade5ba818e6362c83a143f333cdea00ad 100644 --- a/Framework/API/src/FileFinder.cpp +++ b/Framework/API/src/FileFinder.cpp @@ -760,7 +760,7 @@ FileFinderImpl::getPath(const std::vector<IArchiveSearch_sptr> &archs, } // Search the archive - if (archs.size() != 0) { + if (!archs.empty()) { g_log.debug() << "Search the archives\n"; std::string path = getArchivePath(archs, filenames, exts); try { diff --git a/Framework/API/src/FileProperty.cpp b/Framework/API/src/FileProperty.cpp index f151c90941820779f97ce5491ed0a8b716fdfc3f..becae0781d35b6090b06746bf2f9b186d024df14 100644 --- a/Framework/API/src/FileProperty.cpp +++ b/Framework/API/src/FileProperty.cpp @@ -78,7 +78,7 @@ FileProperty::FileProperty(const std::string &name, unsigned int direction) : PropertyWithValue<std::string>(name, defaultValue, createValidator(action, exts), direction), - m_action(action), m_defaultExt((exts.size() > 0) ? exts.front() : ""), + m_action(action), m_defaultExt((!exts.empty()) ? exts.front() : ""), m_runFileProp(isLoadProperty() && extsMatchRunFiles()), m_oldLoadPropValue(""), m_oldLoadFoundFile("") {} diff --git a/Framework/API/src/GridDomain.cpp b/Framework/API/src/GridDomain.cpp index c500deb3e9b245b985c50bbff3ca706c478c1797..997c78444f6e7db54bf75c698305007ed4dc3059 100644 --- a/Framework/API/src/GridDomain.cpp +++ b/Framework/API/src/GridDomain.cpp @@ -16,7 +16,7 @@ Kernel::Logger g_log("GridDomain"); /// number of points in the grid size_t GridDomain::size() const { - if (!m_grids.size()) + if (m_grids.empty()) return 0; else return std::accumulate( diff --git a/Framework/API/src/HistoryView.cpp b/Framework/API/src/HistoryView.cpp index a65e221f6aef8c1b568f4d178f70959675eaeca3..b7a194c3032411baef2570e07c5596a6add26565 100644 --- a/Framework/API/src/HistoryView.cpp +++ b/Framework/API/src/HistoryView.cpp @@ -59,7 +59,7 @@ void HistoryView::unroll(std::vector<HistoryItem>::iterator &it) { const auto history = it->getAlgorithmHistory(); const auto childHistories = history->getChildHistories(); - if (!it->isUnrolled() && childHistories.size() > 0) { + if (!it->isUnrolled() && !childHistories.empty()) { // mark this record as being ignored by the script builder it->unrolled(true); diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index cdbceb9cc80cb238767b7199ac78e472201da083..f0d7f8e1cdc0e3a9c64d5b8e453416aaa6a66807 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -328,7 +328,7 @@ protected: /// Apply if vector std::string apply(const std::vector<double> &v) const override { std::string res = "("; - if (v.size() > 0) { + if (!v.empty()) { for (size_t i = 0; i < v.size() - 1; ++i) { res += boost::lexical_cast<std::string>(v[i]) + ","; } diff --git a/Framework/API/src/ISpectrum.cpp b/Framework/API/src/ISpectrum.cpp index 60cea66c7430679436e15d7f5276168e2bf74b39..8611bb9f0b00f258e2abe8b6d3c34f814aeb87f4 100644 --- a/Framework/API/src/ISpectrum.cpp +++ b/Framework/API/src/ISpectrum.cpp @@ -128,7 +128,7 @@ void ISpectrum::addDetectorID(const detid_t detID) { * @param detIDs :: set of detector IDs to insert in set. */ void ISpectrum::addDetectorIDs(const std::set<detid_t> &detIDs) { - if (detIDs.size() == 0) + if (detIDs.empty()) return; this->detectorIDs.insert(detIDs.begin(), detIDs.end()); } @@ -138,7 +138,7 @@ void ISpectrum::addDetectorIDs(const std::set<detid_t> &detIDs) { * @param detIDs :: vector of detector IDs to insert in set. */ void ISpectrum::addDetectorIDs(const std::vector<detid_t> &detIDs) { - if (detIDs.size() == 0) + if (detIDs.empty()) return; this->detectorIDs.insert(detIDs.begin(), detIDs.end()); } diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index b2049f54117eaad597f248577311a32e89c1a6ed..9d084f23591c309bc18137bf975c4970b5f8263a 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -707,7 +707,7 @@ void MatrixWorkspace::getIntegratedSpectra(std::vector<double> &out, const Mantid::MantidVec &x = this->readX(wksp_index); const Mantid::MantidVec &y = this->readY(wksp_index); // If it is a 1D workspace, no need to integrate - if ((x.size() <= 2) && (y.size() >= 1)) { + if ((x.size() <= 2) && (!y.empty())) { out[wksp_index] = y[0]; } else { // Iterators for limits - whole range by default diff --git a/Framework/API/src/MultiDomainFunction.cpp b/Framework/API/src/MultiDomainFunction.cpp index e8a343ca1686c5d69e8bff7a0902e229df1a9b13..15afb0e0ab7b5fa07e426ea93ef29a99c91b8575 100644 --- a/Framework/API/src/MultiDomainFunction.cpp +++ b/Framework/API/src/MultiDomainFunction.cpp @@ -45,7 +45,7 @@ void MultiDomainFunction::setDomainIndices( void MultiDomainFunction::countNumberOfDomains() { std::set<size_t> dSet; for (auto &domain : m_domains) { - if (domain.second.size()) { + if (!domain.second.empty()) { dSet.insert(domain.second.begin(), domain.second.end()); } } diff --git a/Framework/API/src/MultiPeriodGroupAlgorithm.cpp b/Framework/API/src/MultiPeriodGroupAlgorithm.cpp index 8ca6cc170638c5b861dcce618986c5e9023c54fd..ededeac2a6104b5028449c11d2015e78ebde29f1 100644 --- a/Framework/API/src/MultiPeriodGroupAlgorithm.cpp +++ b/Framework/API/src/MultiPeriodGroupAlgorithm.cpp @@ -35,7 +35,7 @@ bool MultiPeriodGroupAlgorithm::checkGroups() { m_worker.reset(new MultiPeriodGroupWorker(propName)); } m_multiPeriodGroups = m_worker->findMultiPeriodGroups(this); - bool useDefaultGroupingBehaviour = m_multiPeriodGroups.size() == 0; + bool useDefaultGroupingBehaviour = m_multiPeriodGroups.empty(); /* * Give the opportunity to treat this as a regular group workspace. */ diff --git a/Framework/API/src/MultiPeriodGroupWorker.cpp b/Framework/API/src/MultiPeriodGroupWorker.cpp index faf3100ca97abad3601361e87b2146859a02c73d..2c9b14b33dad0b7b527bdf11583d39b05e57125f 100644 --- a/Framework/API/src/MultiPeriodGroupWorker.cpp +++ b/Framework/API/src/MultiPeriodGroupWorker.cpp @@ -193,7 +193,7 @@ bool MultiPeriodGroupWorker::processGroups( Algorithm *const sourceAlg, const VecWSGroupType &vecMultiPeriodGroups) const { // If we are not processing multiperiod groups, use the base behaviour. - if (vecMultiPeriodGroups.size() < 1) { + if (vecMultiPeriodGroups.empty()) { return false; // Indicates that this is not a multiperiod group workspace. } Property *outputWorkspaceProperty = sourceAlg->getProperty("OutputWorkspace"); diff --git a/Framework/API/src/MultipleFileProperty.cpp b/Framework/API/src/MultipleFileProperty.cpp index c4bbb342cfa3c6ab4ed790d6fd70b8a3220f2822..6cf79b583aaeb58b412c0e192bc2803dedf72892 100644 --- a/Framework/API/src/MultipleFileProperty.cpp +++ b/Framework/API/src/MultipleFileProperty.cpp @@ -262,7 +262,7 @@ MultipleFileProperty::setValueAsMultipleFiles(const std::string &propValue) { // load a single (and possibly existing) file within a token, but which // has unexpected zero // padding, or some other anomaly. - if (flattenFileNames(f).size() == 0) + if (flattenFileNames(f).empty()) f.push_back(std::vector<std::string>(1, *plusTokenString)); if (plusTokenStrings.size() > 1) { diff --git a/Framework/API/src/ParameterTie.cpp b/Framework/API/src/ParameterTie.cpp index af5326381517bcd6474e89f8611de39a9d8114b2..b88ffb79c1a91e7ea1826280409256ea7ad7f43b 100644 --- a/Framework/API/src/ParameterTie.cpp +++ b/Framework/API/src/ParameterTie.cpp @@ -65,7 +65,7 @@ void ParameterTie::set(const std::string &expr) { it != m_varMap.end(); ++it) { delete it->first; } - if (m_varMap.size()) { + if (!m_varMap.empty()) { m_varMap.clear(); } try { // Set the expression and initialize the variables @@ -137,7 +137,7 @@ std::string ParameterTie::asString(const IFunction *fun) const { try { res_expression = fun->parameterName(fun->getParameterIndex(*this)) + "="; - if (m_varMap.size() == 0) { // constants + if (m_varMap.empty()) { // constants return res_expression + m_expression; ; } diff --git a/Framework/API/src/TableRow.cpp b/Framework/API/src/TableRow.cpp index 52b9a9438fd8642329226df01527423ec1cd785e..e75dfdac2f1b27a0cb9455726eb1a9a28118ea4a 100644 --- a/Framework/API/src/TableRow.cpp +++ b/Framework/API/src/TableRow.cpp @@ -11,7 +11,7 @@ TableRow::TableRow(const TableRowHelper &trh) : m_row(trh.m_row), m_col(0), m_sep(",") { for (size_t i = 0; i < trh.m_workspace->columnCount(); i++) m_columns.push_back(trh.m_workspace->getColumn(i)); - if (m_columns.size()) + if (!m_columns.empty()) m_nrows = int(m_columns[0]->size()); else m_nrows = 0; @@ -69,7 +69,7 @@ const TableRow &TableRow::operator>>(bool &t) const { @return stream representation of row */ std::ostream &operator<<(std::ostream &s, const TableRow &row) { - if (row.m_columns.size() == 0) + if (row.m_columns.empty()) return s; if (row.m_columns.size() == 1) { row.m_columns[0]->print(row.row(), s); diff --git a/Framework/API/src/WorkspaceGroup.cpp b/Framework/API/src/WorkspaceGroup.cpp index 60daf6e06c7068b5388546a785ddec59c457e2e7..86d7afd2c04abd35a4a9dbfc3b5a26a4fa816c9a 100644 --- a/Framework/API/src/WorkspaceGroup.cpp +++ b/Framework/API/src/WorkspaceGroup.cpp @@ -328,7 +328,7 @@ Determine in the WorkspaceGroup is multiperiod. */ bool WorkspaceGroup::isMultiperiod() const { std::lock_guard<std::recursive_mutex> _lock(m_mutex); - if (m_workspaces.size() < 1) { + if (m_workspaces.empty()) { g_log.debug("Not a multiperiod-group with < 1 nested workspace."); return false; } diff --git a/Framework/Algorithms/src/AsymmetryCalc.cpp b/Framework/Algorithms/src/AsymmetryCalc.cpp index 3e164376285467a08af3c5ad1c4a544e49b0d99f..86728b1d34a7907ca3f503d4705ae91a4431abf5 100644 --- a/Framework/Algorithms/src/AsymmetryCalc.cpp +++ b/Framework/Algorithms/src/AsymmetryCalc.cpp @@ -73,8 +73,8 @@ std::map<std::string, std::string> AsymmetryCalc::validateInputs() { void AsymmetryCalc::exec() { std::vector<int> forward_list = getProperty("ForwardSpectra"); std::vector<int> backward_list = getProperty("BackwardSpectra"); - int forward = forward_list.size() ? forward_list[0] : 1; - int backward = backward_list.size() ? backward_list[0] : 2; + int forward = !forward_list.empty() ? forward_list[0] : 1; + int backward = !backward_list.empty() ? backward_list[0] : 2; double alpha = getProperty("Alpha"); // Get original workspace diff --git a/Framework/Algorithms/src/CalculateFlatBackground.cpp b/Framework/Algorithms/src/CalculateFlatBackground.cpp index efbddf393e7a9e4e2ade076b0a61de133d0bc767..72dfbb41d19fdecc51ecd7deac6f6ab8c628a631 100644 --- a/Framework/Algorithms/src/CalculateFlatBackground.cpp +++ b/Framework/Algorithms/src/CalculateFlatBackground.cpp @@ -311,7 +311,7 @@ void CalculateFlatBackground::checkRange(double &startX, double &endX) { */ void CalculateFlatBackground::getSpecInds(std::vector<int> &output, const int workspaceTotal) { - if (output.size() > 0) { + if (!output.empty()) { return; } diff --git a/Framework/Algorithms/src/CalculateResolution.cpp b/Framework/Algorithms/src/CalculateResolution.cpp index 33894c9409d3f3011d035fb78a08499e9fedb434..c68d0746e7a55a0c1f9a5fe2ed03128f8b6f982a 100644 --- a/Framework/Algorithms/src/CalculateResolution.cpp +++ b/Framework/Algorithms/src/CalculateResolution.cpp @@ -127,12 +127,12 @@ void CalculateResolution::exec() { std::vector<double> slit1VGParam = slit1->getNumberParameter(vGapParam); std::vector<double> slit2VGParam = slit2->getNumberParameter(vGapParam); - if (slit1VGParam.size() < 1) + if (slit1VGParam.empty()) throw std::runtime_error("Could not find a value for the first slit's " "vertical gap with given parameter name: '" + vGapParam + "'."); - if (slit2VGParam.size() < 1) + if (slit2VGParam.empty()) throw std::runtime_error("Could not find a value for the second slit's " "vertical gap with given parameter name: '" + vGapParam + "'."); diff --git a/Framework/Algorithms/src/ConvertEmptyToTof.cpp b/Framework/Algorithms/src/ConvertEmptyToTof.cpp index 2eaeffc61bf590706d506ba5dcc42a826388d77c..ebb030ae73777b3a5518b60b58bd34727fcac8bd 100644 --- a/Framework/Algorithms/src/ConvertEmptyToTof.cpp +++ b/Framework/Algorithms/src/ConvertEmptyToTof.cpp @@ -165,7 +165,7 @@ void ConvertEmptyToTof::exec() { */ void ConvertEmptyToTof::validateSpectraIndices(std::vector<int> &v) { auto nHist = m_inputWS->getNumberHistograms(); - if (v.size() == 0) { + if (v.empty()) { g_log.information("No spectrum index given. Using all spectra to calculate " "the elastic peak."); // use all spectra indices @@ -190,7 +190,7 @@ void ConvertEmptyToTof::validateSpectraIndices(std::vector<int> &v) { */ void ConvertEmptyToTof::validateChannelIndices(std::vector<int> &v) { auto blockSize = m_inputWS->blocksize() + 1; - if (v.size() == 0) { + if (v.empty()) { g_log.information("No channel index given. Using all channels (full " "spectrum!) to calculate the elastic peak."); // use all channel indices diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp index 35aacaaeeb4915c04c25412d2b338cd4e335102f..c065e40172e6884d4ca5a52a197b35ef32493285 100644 --- a/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Framework/Algorithms/src/ConvertUnits.cpp @@ -149,7 +149,7 @@ void ConvertUnits::exec() { // If the units conversion has flipped the ascending direction of X, reverse // all the vectors - if (outputWS->dataX(0).size() && + if (!outputWS->dataX(0).empty() && (outputWS->dataX(0).front() > outputWS->dataX(0).back() || outputWS->dataX(m_numberOfSpectra / 2).front() > outputWS->dataX(m_numberOfSpectra / 2).back())) { diff --git a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp index 1d95c33d4abd0c6c0365a2063fc28984c35bcc0e..9e2d4fc2b8a20d509b58d8eb337bc35f459f3fbe 100644 --- a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp +++ b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp @@ -163,7 +163,7 @@ void ConvertUnitsUsingDetectorTable::exec() { // If the units conversion has flipped the ascending direction of X, reverse // all the vectors - if (outputWS->dataX(0).size() && + if (!outputWS->dataX(0).empty() && (outputWS->dataX(0).front() > outputWS->dataX(0).back() || outputWS->dataX(m_numberOfSpectra / 2).front() > outputWS->dataX(m_numberOfSpectra / 2).back())) { diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp index 6ea43bfd9ef8b81fd567cacd53ea53401e6d590e..80f938c68bd5a1f7502a43992509e0cff5320ca5 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp @@ -253,7 +253,7 @@ double CreateTransmissionWorkspaceAuto::checkForDefault( auto algProperty = this->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getNumberParameter(idf_name); - if (defaults.size() == 0) { + if (defaults.empty()) { throw std::runtime_error("No data could be retrieved from the parameters " "and argument wasn't provided: " + propName); diff --git a/Framework/Algorithms/src/CreateWorkspace.cpp b/Framework/Algorithms/src/CreateWorkspace.cpp index e6a09e78f544665e4d69c382436d6a1e8bcfef9d..e3f866d844dbbd90261339c13b232226322bb80a 100644 --- a/Framework/Algorithms/src/CreateWorkspace.cpp +++ b/Framework/Algorithms/src/CreateWorkspace.cpp @@ -75,7 +75,7 @@ std::map<std::string, std::string> CreateWorkspace::validateInputs() { const std::string vUnit = getProperty("VerticalAxisUnit"); const std::vector<std::string> vAxis = getProperty("VerticalAxisValues"); - if (vUnit == "SpectraNumber" && vAxis.size() > 0) + if (vUnit == "SpectraNumber" && !vAxis.empty()) issues["VerticalAxisValues"] = "Axis values cannot be provided when using a spectra axis"; diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp index f9ee393c4ea1384617716f7a17f4b7d6645885ac..97cb3d885e94d62a89b7f733323c42561baf3b24 100644 --- a/Framework/Algorithms/src/DiffractionFocussing2.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp @@ -493,7 +493,7 @@ void DiffractionFocussing2::execEvent() { } // Now you set the X axis to the X you saved before. - if (group2xvector.size() > 0) { + if (!group2xvector.empty()) { auto git = group2xvector.find(group); if (git != group2xvector.end()) out->setX(workspaceIndex, (git->second)); diff --git a/Framework/Algorithms/src/ExtractMaskToTable.cpp b/Framework/Algorithms/src/ExtractMaskToTable.cpp index 1ce01764bcd0e978476a6c75b86aead9c4814fe9..14a1521f75eeb3493d1e89a6513bd54dcd4f2a71 100644 --- a/Framework/Algorithms/src/ExtractMaskToTable.cpp +++ b/Framework/Algorithms/src/ExtractMaskToTable.cpp @@ -343,7 +343,7 @@ void ExtractMaskToTable::addToTableWorkspace(TableWorkspace_sptr outws, } // Exclude previously masked detectors IDs from masked detectors IDs - if (prevmaskedids.size() > 0) { + if (!prevmaskedids.empty()) { sort(prevmaskedids.begin(), prevmaskedids.end()); maskeddetids = subtractVector(maskeddetids, prevmaskedids); numdetids = maskeddetids.size(); diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index 1ca94bebd066b14bfcb4363ec18b37d42bf7c84c..af65c4c35a92fd5f176a73fc1d568e770b005cfd 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -920,7 +920,7 @@ void FilterEvents::filterEventsBySplitters(double progressamount) { << "; Number of splitters = " << splitters.size() << ".\n"; // Skip output workspace has ZERO splitters - if (splitters.size() == 0) { + if (splitters.empty()) { g_log.warning() << "[FilterEvents] Workspace " << opws->name() << " Indexed @ " << wsindex << " won't have logs splitted due to zero splitter size. " diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp index 3c585b09f6b780e42c8f94dc1a815ff9713f0020..4481502f2ab645a7839488c4bc11e0937f29a961 100644 --- a/Framework/Algorithms/src/FindPeakBackground.cpp +++ b/Framework/Algorithms/src/FindPeakBackground.cpp @@ -193,7 +193,7 @@ void FindPeakBackground::exec() { if (mask[l] != mask[l - 1] && mask[l] == 1) { peaks.push_back(cont_peak()); peaks[peaks.size() - 1].start = l + l0; - } else if (peaks.size() > 0) { + } else if (!peaks.empty()) { size_t ipeak = peaks.size() - 1; if (mask[l] != mask[l - 1] && mask[l] == 0) { peaks[ipeak].stop = l + l0; @@ -205,7 +205,7 @@ void FindPeakBackground::exec() { size_t min_peak, max_peak; double a0 = 0., a1 = 0., a2 = 0.; int goodfit; - if (peaks.size() > 0) { + if (!peaks.empty()) { g_log.debug() << "Peaks' size = " << peaks.size() << " -> esitmate background. \n"; if (peaks[peaks.size() - 1].stop == 0) @@ -225,8 +225,8 @@ void FindPeakBackground::exec() { goodfit = 2; } - estimateBackground(inpX, inpY, l0, n, min_peak, max_peak, - (peaks.size() > 0), a0, a1, a2); + estimateBackground(inpX, inpY, l0, n, min_peak, max_peak, (!peaks.empty()), + a0, a1, a2); // Add a new row API::TableRow t = m_outPeakTableWS->getRow(0); diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp index 1b76818d6e031bd0b7792b8c4c0167ac40a0d094..482d875a7f97a2031740a8856b19648ef280567e 100644 --- a/Framework/Algorithms/src/FindPeaks.cpp +++ b/Framework/Algorithms/src/FindPeaks.cpp @@ -253,7 +253,7 @@ void FindPeaks::processAlgorithmProperties() { // Specified peak positions, which is optional m_vecPeakCentre = getProperty("PeakPositions"); - if (m_vecPeakCentre.size() > 0) + if (!m_vecPeakCentre.empty()) std::sort(m_vecPeakCentre.begin(), m_vecPeakCentre.end()); m_vecFitWindows = getProperty("FitWindows"); diff --git a/Framework/Algorithms/src/FitPeak.cpp b/Framework/Algorithms/src/FitPeak.cpp index 443e310694ce1bc901fcc0ea8067efb607c2d8b7..0b1e300373410824e1f979854cd6db9ee24263c2 100644 --- a/Framework/Algorithms/src/FitPeak.cpp +++ b/Framework/Algorithms/src/FitPeak.cpp @@ -195,7 +195,7 @@ void FitOneSinglePeak::setupGuessedFWHM(double usrwidth, int minfwhm, // From user specified minimum value to maximim value if (!fitwithsteppedfwhm) { - if (m_vecFWHM.size() == 0) + if (m_vecFWHM.empty()) throw runtime_error("Logic error in setup guessed FWHM. "); m_sstream << "No FWHM is not guessed by stepped FWHM. " << "\n"; @@ -1423,9 +1423,9 @@ void FitPeak::createFunctions() { // Set background function parameter values m_bkgdParameterNames = getProperty("BackgroundParameterNames"); - if (usedefaultbkgdparorder && m_bkgdParameterNames.size() == 0) { + if (usedefaultbkgdparorder && m_bkgdParameterNames.empty()) { m_bkgdParameterNames = m_bkgdFunc->getParameterNames(); - } else if (m_bkgdParameterNames.size() == 0) { + } else if (m_bkgdParameterNames.empty()) { throw runtime_error("In the non-default background parameter name mode, " "user must give out parameter names. "); } @@ -1456,7 +1456,7 @@ void FitPeak::createFunctions() { // Peak parameters' names m_peakParameterNames = getProperty("PeakParameterNames"); - if (m_peakParameterNames.size() == 0) { + if (m_peakParameterNames.empty()) { if (defaultparorder) { // Use default peak parameter names' order m_peakParameterNames = m_peakFunc->getParameterNames(); diff --git a/Framework/Algorithms/src/FixGSASInstrumentFile.cpp b/Framework/Algorithms/src/FixGSASInstrumentFile.cpp index 25c61f98424e1e7556be5ff123a6dcfe6fffdc61..baa214941d69c168bac345fca094078350ec3220 100644 --- a/Framework/Algorithms/src/FixGSASInstrumentFile.cpp +++ b/Framework/Algorithms/src/FixGSASInstrumentFile.cpp @@ -82,7 +82,7 @@ void FixGSASInstrumentFile::exec() { // Split "\n" vector<string> fields; boost::algorithm::split(fields, line, boost::algorithm::is_any_of("\n")); - if (fields.size() == 0) + if (fields.empty()) throw runtime_error("Impossible to have an empty line. "); vec_line.push_back(fields[0]); } diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index 87bb497e4682531fc3b1c78b36e1f0d6f82ee5fb..22694e356958dac943693b20ed98bf2e0fa2671e 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -380,7 +380,7 @@ void GenerateEventsFilter::setFilterByTimeOnly() { vector<double> vec_timeintervals = this->getProperty("TimeInterval"); bool singleslot = false; - if (vec_timeintervals.size() == 0) + if (vec_timeintervals.empty()) singleslot = true; // Progress @@ -1420,7 +1420,7 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog( // To fill the blanks at the end of log to make last entry of splitter is stop // time // To make it non-empty - if (vecSplitTime.size() == 0) { + if (vecSplitTime.empty()) { start = m_dblLog->nthTime(istart); stop = m_dblLog->nthTime(iend); lastindex = -1; @@ -1686,7 +1686,7 @@ void GenerateEventsFilter::addNewTimeFilterSplitter( if (m_forFastLog) { // For MatrixWorkspace splitter // Start of splitter - if (m_vecSplitterTime.size() == 0) { + if (m_vecSplitterTime.empty()) { // First splitter m_vecSplitterTime.push_back(starttime); } else if (m_vecSplitterTime.back() < starttime) { diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp index 41e1505e39177cc5e9e8590b8108024372406c6e..298026b1e37223fac72ab8546df368516948c457 100644 --- a/Framework/Algorithms/src/GeneratePeaks.cpp +++ b/Framework/Algorithms/src/GeneratePeaks.cpp @@ -748,7 +748,7 @@ API::MatrixWorkspace_sptr GeneratePeaks::createOutputWorkspace() { MatrixWorkspace_sptr GeneratePeaks::createDataWorkspace(std::vector<double> binparameters) { // Check validity - if (m_spectraSet.size() == 0) + if (m_spectraSet.empty()) throw std::invalid_argument( "Input spectra list is empty. Unable to generate a new workspace."); diff --git a/Framework/Algorithms/src/GetAllEi.cpp b/Framework/Algorithms/src/GetAllEi.cpp index 4609e6c59ffaa363617918d6320c13f375b762b6..d09392e861a20cfe5b89e113873e8f696740c400 100644 --- a/Framework/Algorithms/src/GetAllEi.cpp +++ b/Framework/Algorithms/src/GetAllEi.cpp @@ -192,7 +192,7 @@ void GetAllEi::exec() { auto phase = m_chopper->getNumberParameter("initial_phase"); - if (phase.size() == 0) { + if (phase.empty()) { throw std::runtime_error("Can not find initial_phase parameter" " attached to the chopper-position component"); } @@ -250,7 +250,7 @@ void GetAllEi::exec() { std::vector<double> guess_opening; this->findGuessOpeningTimes(TOF_range, TOF0, Period, guess_opening); - if (guess_opening.size() == 0) { + if (guess_opening.empty()) { throw std::runtime_error( "Can not find any chopper opening time within TOF range: " + boost::lexical_cast<std::string>(TOF_range.first) + ':' + @@ -858,7 +858,7 @@ void GetAllEi::findBinRanges(const MantidVec &eBins, const MantidVec &signal, } // if array decreasing rather then increasing, indexes behave differently. // Will it still work? - if (irangeMax.size() > 0) { + if (!irangeMax.empty()) { if (irangeMax[0] < irangeMin[0]) { irangeMax.swap(irangeMin); } @@ -1022,7 +1022,7 @@ GetAllEi::getAvrgLogValue(const API::MatrixWorkspace_sptr &inputWS, propertyName); } - if (splitter.size() == 0) { + if (splitter.empty()) { auto TimeStart = inputWS->run().startTime(); auto TimeEnd = inputWS->run().endTime(); pTimeSeries->filterByTime(TimeStart, TimeEnd); @@ -1193,7 +1193,7 @@ bool check_time_series_property( if (boost::iequals(LogName, "Defined in IDF")) { try { auto theLogs = chopper->getStringParameter(prop_name); - if (theLogs.size() == 0) { + if (theLogs.empty()) { if (fail) result[prop_name] = "Can not retrieve parameter " + prop_name + " from the instrument definition file."; diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index 89a8d1b264e353f82c4f4b14dc9ab8fe83e2be00..ced49ee642a3bf435586fe31737758bbcf060bff 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -293,7 +293,7 @@ void GetDetOffsetsMultiPeaks::processProperties() { // the peak positions and where to fit m_peakPositions = getProperty("DReference"); - if (m_peakPositions.size() == 0) + if (m_peakPositions.empty()) throw std::runtime_error("There is no input referenced peak position."); std::sort(m_peakPositions.begin(), m_peakPositions.end()); @@ -324,7 +324,7 @@ void GetDetOffsetsMultiPeaks::processProperties() { g_log.information(infoss.str()); - if (m_fitWindows.size() == 0) + if (m_fitWindows.empty()) g_log.warning() << "Input FitWindowMaxWidth = " << maxwidth << " No FitWidows will be generated." << "\n"; @@ -423,7 +423,7 @@ void GetDetOffsetsMultiPeaks::importFitWindowTableWorkspace( if (spec < 0 && founduniversal) { throw std::runtime_error("There are more than 1 universal spectrum (spec " "< 0) in TableWorkspace."); - } else if (spec >= 0 && m_vecFitWindow[spec].size() != 0) { + } else if (spec >= 0 && !m_vecFitWindow[spec].empty()) { std::stringstream ess; ess << "Peak fit windows at row " << i << " has spectrum " << spec << ", which appears before in fit window table workspace. "; @@ -455,7 +455,7 @@ void GetDetOffsetsMultiPeaks::importFitWindowTableWorkspace( } else if (founduniversal) { // Fill the universal for (size_t i = 0; i < m_inputWS->getNumberHistograms(); ++i) - if (m_vecFitWindow[i].size() == 0) + if (m_vecFitWindow[i].empty()) m_vecFitWindow[i] = vec_univFitWindow; } diff --git a/Framework/Algorithms/src/MaskBins.cpp b/Framework/Algorithms/src/MaskBins.cpp index 5400e3c05bd2820e10bf44c3100acf4b9f11a8f5..30110ebb23e86d26c59d48f592096ea7289b568e 100644 --- a/Framework/Algorithms/src/MaskBins.cpp +++ b/Framework/Algorithms/src/MaskBins.cpp @@ -77,7 +77,7 @@ void MaskBins::exec() { //--------------------------------------------------------------------------------- // what spectra (workspace indices) to load. Optional. this->spectra_list = this->getProperty("SpectraList"); - if (this->spectra_list.size() > 0) { + if (!this->spectra_list.empty()) { const int numHist = static_cast<int>(inputWS->getNumberHistograms()); //--- Validate spectra list --- for (auto wi : this->spectra_list) { @@ -123,7 +123,7 @@ void MaskBins::exec() { // Parallel running has problems with a race condition, leading to // occaisional test failures and crashes - bool useSpectraList = (this->spectra_list.size() > 0); + bool useSpectraList = (!this->spectra_list.empty()); // Alter the for loop ending based on what we are looping on int for_end = numHists; @@ -172,7 +172,7 @@ void MaskBins::execEvent() { outputWS->sortAll(Mantid::DataObjects::TOF_SORT, &progress); // Go through all histograms - if (this->spectra_list.size() > 0) { + if (!this->spectra_list.empty()) { // Specific spectra were specified PARALLEL_FOR1(outputWS) for (int i = 0; i < static_cast<int>(this->spectra_list.size()); ++i) { diff --git a/Framework/Algorithms/src/MaskBinsFromTable.cpp b/Framework/Algorithms/src/MaskBinsFromTable.cpp index d8f25495f978d19689bc65db6ed4f09da82bad67..b848e0439de26a168d1ffcfebb78d053cb6269c9 100644 --- a/Framework/Algorithms/src/MaskBinsFromTable.cpp +++ b/Framework/Algorithms/src/MaskBinsFromTable.cpp @@ -252,7 +252,7 @@ MaskBinsFromTable::convertToSpectraList(API::MatrixWorkspace_sptr dataws, } // Sort the vector - if (wsindexvec.size() == 0) + if (wsindexvec.empty()) throw runtime_error("There is no spectrum found for input detectors list."); sort(wsindexvec.begin(), wsindexvec.end()); diff --git a/Framework/Algorithms/src/MergeRuns.cpp b/Framework/Algorithms/src/MergeRuns.cpp index 158aa8d0d95e993c159ca1662d55271d6ac29883..2b6882980516825d6310a2bb7958f2ceebe51c21 100644 --- a/Framework/Algorithms/src/MergeRuns.cpp +++ b/Framework/Algorithms/src/MergeRuns.cpp @@ -133,7 +133,7 @@ void MergeRuns::exec() { * Throws an error if there is any incompatibility. */ void MergeRuns::buildAdditionTables() { - if (m_inEventWS.size() <= 0) + if (m_inEventWS.empty()) throw std::invalid_argument("MergeRuns: No workspaces found to merge."); // This'll hold the addition tables. diff --git a/Framework/Algorithms/src/MuonGroupDetectors.cpp b/Framework/Algorithms/src/MuonGroupDetectors.cpp index 3bc6963fcb0cf2dc4158ce11c18a07accce7c222..a2b2edca4ded9e948e77749802b8086241dee071 100644 --- a/Framework/Algorithms/src/MuonGroupDetectors.cpp +++ b/Framework/Algorithms/src/MuonGroupDetectors.cpp @@ -73,11 +73,11 @@ void MuonGroupDetectors::exec() { // First pass to determine how many non-empty groups we have for (size_t row = 0; row < table->rowCount(); ++row) { - if (table->cell<std::vector<int>>(row, 0).size() != 0) + if (!table->cell<std::vector<int>>(row, 0).empty()) nonEmptyRows.push_back(row); } - if (nonEmptyRows.size() == 0) + if (nonEmptyRows.empty()) throw std::invalid_argument( "Detector Grouping Table doesn't contain any non-empty groups"); diff --git a/Framework/Algorithms/src/PerformIndexOperations.cpp b/Framework/Algorithms/src/PerformIndexOperations.cpp index 0ed841acc3d53698253a939c30336986f9d28690..7613d5d8f20f00a2d862d53cc09beb2ad00ce38c 100644 --- a/Framework/Algorithms/src/PerformIndexOperations.cpp +++ b/Framework/Algorithms/src/PerformIndexOperations.cpp @@ -72,7 +72,7 @@ public: MatrixWorkspace_sptr execute(MatrixWorkspace_sptr inputWS) const override { MatrixWorkspace_sptr outWS; - if (m_indexes.size() > 0) { + if (!m_indexes.empty()) { Mantid::API::AlgorithmManagerImpl &factory = Mantid::API::AlgorithmManager::Instance(); auto sumSpectraAlg = factory.create("SumSpectra"); diff --git a/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp b/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp index 42ca93d80e8a0f36043d558a94320c08df85981b..b8899accdc3a41612e45eaa1bc4b78de6148da42 100644 --- a/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp +++ b/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp @@ -174,7 +174,7 @@ void PlotAsymmetryByLogValue::exec() { } // Create the 2D workspace for the output - int nplots = m_greenY.size() ? 4 : 1; + int nplots = !m_greenY.empty() ? 4 : 1; size_t npoints = m_logValue.size(); MatrixWorkspace_sptr outWS = WorkspaceFactory::Instance().create( "Workspace2D", diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp index fd381c3bc25c532b6161940088b0157b2bc2df58..13eb6c9b10ef254c31711ebfc77aace3d06e8e0c 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp @@ -501,7 +501,7 @@ double ReflectometryReductionOneAuto::checkForDefault( auto algProperty = this->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getNumberParameter(idf_name); - if (defaults.size() == 0) { + if (defaults.empty()) { throw std::runtime_error("No data could be retrieved from the parameters " "and argument wasn't provided: " + propName); diff --git a/Framework/Algorithms/src/RenameWorkspaces.cpp b/Framework/Algorithms/src/RenameWorkspaces.cpp index 714d422cccd2ed0be1f78be8e78377fe3e5555a8..672daee0960323c7b82443d62ea32590c351c687 100644 --- a/Framework/Algorithms/src/RenameWorkspaces.cpp +++ b/Framework/Algorithms/src/RenameWorkspaces.cpp @@ -53,11 +53,11 @@ void RenameWorkspaces::exec() { std::string suffix = getPropertyValue("Suffix"); // Check properties - if (newWsName.size() == 0 && prefix == "" && suffix == "") { + if (newWsName.empty() && prefix == "" && suffix == "") { throw std::invalid_argument( "No list of Workspace names, prefix or suffix has been supplied."); } - if (newWsName.size() > 0 && (prefix != "" || suffix != "")) { + if (!newWsName.empty() && (prefix != "" || suffix != "")) { throw std::invalid_argument("Both a list of workspace names and a prefix " "or suffix has been supplied."); } @@ -73,7 +73,7 @@ void RenameWorkspaces::exec() { } size_t nWs = inputWsName.size(); - if (newWsName.size() > 0) { + if (!newWsName.empty()) { // We are using a list of new names if (nWs > newWsName.size()) { nWs = newWsName.size(); diff --git a/Framework/Algorithms/src/SetInstrumentParameter.cpp b/Framework/Algorithms/src/SetInstrumentParameter.cpp index 79455512ca367e0aacd0d4472a1a69a4e66879b3..556186a2929737776fff56cc120c2178b61b1fde 100644 --- a/Framework/Algorithms/src/SetInstrumentParameter.cpp +++ b/Framework/Algorithms/src/SetInstrumentParameter.cpp @@ -106,7 +106,7 @@ void SetInstrumentParameter::exec() { addParameter(paramMap, det.get(), paramName, paramType, paramValue); } } else { - if (cmptList.size() > 0) { + if (!cmptList.empty()) { for (auto &cmpt : cmptList) { addParameter(paramMap, cmpt.get(), paramName, paramType, paramValue); } diff --git a/Framework/Algorithms/src/SpatialGrouping.cpp b/Framework/Algorithms/src/SpatialGrouping.cpp index 414d5c5359427cce97d71b764f0f54fd46a05ed5..001ebed33df63deeb596e24a9ea8a66fcdc4fb14 100644 --- a/Framework/Algorithms/src/SpatialGrouping.cpp +++ b/Framework/Algorithms/src/SpatialGrouping.cpp @@ -135,7 +135,7 @@ void SpatialGrouping::exec() { m_groups.push_back(group); } - if (m_groups.size() == 0) { + if (m_groups.empty()) { g_log.warning() << "No groups generated." << std::endl; return; } diff --git a/Framework/Algorithms/src/Stitch1DMany.cpp b/Framework/Algorithms/src/Stitch1DMany.cpp index de3a34b42ba93a3a3373a568896aec1a5e424fce..ac33223869f903a578eea16a2a5916575528a5c7 100644 --- a/Framework/Algorithms/src/Stitch1DMany.cpp +++ b/Framework/Algorithms/src/Stitch1DMany.cpp @@ -85,7 +85,7 @@ std::map<std::string, std::string> Stitch1DMany::validateInputs() { } // Check that all the workspaces are of the same type - if (m_inputWorkspaces.size() > 0) { + if (!m_inputWorkspaces.empty()) { const std::string id = m_inputWorkspaces[0]->id(); for (auto &inputWorkspace : m_inputWorkspaces) { if (inputWorkspace->id() != id) { @@ -118,8 +118,7 @@ std::map<std::string, std::string> Stitch1DMany::validateInputs() { m_startOverlaps = this->getProperty("StartOverlaps"); m_endOverlaps = this->getProperty("EndOverlaps"); - if (m_startOverlaps.size() > 0 && - m_startOverlaps.size() != m_numWorkspaces - 1) + if (!m_startOverlaps.empty() && m_startOverlaps.size() != m_numWorkspaces - 1) errors["StartOverlaps"] = "If given, StartOverlaps must have one fewer " "entries than the number of input workspaces."; @@ -132,7 +131,7 @@ std::map<std::string, std::string> Stitch1DMany::validateInputs() { m_manualScaleFactor = this->getProperty("ManualScaleFactor"); m_params = this->getProperty("Params"); - if (m_params.size() < 1) + if (m_params.empty()) errors["Params"] = "At least one parameter must be given."; if (!m_scaleRHSWorkspace) { diff --git a/Framework/Algorithms/src/UpdateScriptRepository.cpp b/Framework/Algorithms/src/UpdateScriptRepository.cpp index c6b2a587a5957fa7f48286622efee2b64b6e3940..e34d24ccb9e35e686f0afa2875ef24fa265d9bc3 100644 --- a/Framework/Algorithms/src/UpdateScriptRepository.cpp +++ b/Framework/Algorithms/src/UpdateScriptRepository.cpp @@ -54,7 +54,7 @@ void UpdateScriptRepository::exec() { return; // it means that the ScriptRepository was not installed. std::vector<std::string> f_list = repo_ptr->check4Update(); - if (f_list.size() > 0) { + if (!f_list.empty()) { std::stringstream info; info << "Information about ScriptRepository:\n" << " A more recent version of the following files was installed:\n"; diff --git a/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h b/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h index 9369716ccad532dd7749da018f5b3f747cdcb073..81f67fd8d4a984400d852d717297598258f5b1dc 100644 --- a/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h +++ b/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h @@ -33,7 +33,7 @@ public: if (intensity < 0) { throw std::invalid_argument("SXPeak: Cannot have an intensity < 0"); } - if (spectral.size() == 0) { + if (spectral.empty()) { throw std::invalid_argument( "SXPeak: Cannot have zero sized spectral list"); } diff --git a/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h b/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h index 23d86a048562f7ffb7e4fc7164d89353bdd0a5d4..2d93cc4fba82fe71b73df5261ca4ab2f3836ed6c 100644 --- a/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h +++ b/Framework/Crystal/inc/MantidCrystal/IndexSXPeaks.h @@ -101,7 +101,7 @@ public: _hkls = s; } void setFirst() { - if (_hkls.size() > 0) { + if (!_hkls.empty()) { auto it = _hkls.begin(); // Take the first possiblity it++; _hkls.erase(it, _hkls.end()); // Erase all others! diff --git a/Framework/Crystal/src/AnvredCorrection.cpp b/Framework/Crystal/src/AnvredCorrection.cpp index 5ab009d0c6cae96fb3e9ec7ade26d33d21cdb692..af9a61ecee54864d6b01d8271c85cc6991f314de 100644 --- a/Framework/Crystal/src/AnvredCorrection.cpp +++ b/Framework/Crystal/src/AnvredCorrection.cpp @@ -553,8 +553,8 @@ void AnvredCorrection::BuildLamdaWeights() { // GetSpectrumWeights( spectrum_file_name, m_lamda_weight); - if (m_lamda_weight.size() == 0) // loading spectrum failed so use - { // array of 1's + if (m_lamda_weight.empty()) // loading spectrum failed so use + { // array of 1's // power = power_ns; // This is commented out, so we // don't override user specified // value. diff --git a/Framework/Crystal/src/Cluster.cpp b/Framework/Crystal/src/Cluster.cpp index 60cb15a1cb76792bc9d12b8d712219c86102dcb8..b64629b5be1a2a832843a2a4806c3a574a287e13 100644 --- a/Framework/Crystal/src/Cluster.cpp +++ b/Framework/Crystal/src/Cluster.cpp @@ -84,7 +84,7 @@ Cluster::integrate(Mantid::API::IMDHistoWorkspace_const_sptr ws) const { * @param disjointSet */ void Cluster::toUniformMinimum(VecElements &disjointSet) { - if (m_indexes.size() > 0) { + if (!m_indexes.empty()) { size_t parentIndex = m_rootCluster->getRepresentitiveIndex(); for (size_t i = 1; i < m_indexes.size(); ++i) { diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp index 3684edd154afe64750b68192a1192144d1599840..0790a4dfaaafc028dc25c444aaae181456ab3abc 100644 --- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp +++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp @@ -494,7 +494,7 @@ void IntegratePeakTimeSlices::exec() { auto XXX = boost::make_shared<DataModeHandler>(*m_AttributeValues); m_AttributeValues = XXX; - if (X.size() > 0) + if (!X.empty()) m_AttributeValues->setTime((X[chanMax] + X[chanMin]) / 2.0); } else // lastAttributeList exists @@ -2391,7 +2391,7 @@ bool DataModeHandler::IsEnoughData(const double *ParameterValues, // Check if flat double Varx, Vary, Cov; - if (StatBase.size() <= 0) + if (StatBase.empty()) return false; double ncells = static_cast<int>(StatBase[IIntensities]); diff --git a/Framework/Crystal/src/SortHKL.cpp b/Framework/Crystal/src/SortHKL.cpp index b70c93222949d18fe63014c97ca80d831644ec32..09c736aa0d7633905af6f3d12552e8569bf89af7 100644 --- a/Framework/Crystal/src/SortHKL.cpp +++ b/Framework/Crystal/src/SortHKL.cpp @@ -82,7 +82,7 @@ void SortHKL::exec() { const std::vector<Peak> &inputPeaks = inputPeaksWorkspace->getPeaks(); std::vector<Peak> peaks = getNonZeroPeaks(inputPeaks); - if (peaks.size() == 0) { + if (peaks.empty()) { g_log.error() << "Number of peaks should not be 0 for SortHKL.\n"; return; } @@ -329,7 +329,7 @@ double PeaksStatistics::getRMS(const std::vector<double> &data) const { /// Returns the lowest and hights wavelength in the peak list. std::pair<double, double> PeaksStatistics::getLambdaLimits(const std::vector<Peak> &peaks) const { - if (peaks.size() == 0) { + if (peaks.empty()) { return std::make_pair(0.0, 0.0); } @@ -502,7 +502,7 @@ void UniqueReflection::removeOutliers(double sigmaCritical) { } } - if (outlierIndices.size() > 0) { + if (!outlierIndices.empty()) { for (auto it = outlierIndices.rbegin(); it != outlierIndices.rend(); ++it) { m_peaks.erase(m_peaks.begin() + (*it)); diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index b6e7a99e935832d2575600bd53d969981d26b9b4..5118bac9b219817dcfee78f121fbddbdbfabaee9 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -339,8 +339,7 @@ void FitPowderDiffPeaks::processInputProperties() { m_rightmostPeakRightBound = getProperty("RightMostPeakRightBound"); if (m_fitMode == ROBUSTFIT) { - if (m_rightmostPeakHKL.size() == 0 || - m_rightmostPeakLeftBound == EMPTY_DBL() || + if (m_rightmostPeakHKL.empty() || m_rightmostPeakLeftBound == EMPTY_DBL() || m_rightmostPeakRightBound == EMPTY_DBL()) { stringstream errss; errss << "If fit mode is 'RobustFit', then user must specify all 3 " @@ -758,7 +757,7 @@ bool FitPowderDiffPeaks::fitSinglePeakRobust( << peakinfob1 << endl; // c) Fit peak parameters by the value from right peak - if (rightpeakparammap.size() > 0) { + if (!rightpeakparammap.empty()) { restoreFunctionParameters(peak, rightpeakparammap); peak->setParameter("X0", tof_h); peak->setParameter("I", height * fwhm); diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 0ef5f1dcee13c7b3088ff972f837a17c8354f980..a0c58255498a79d041f80a1251828d2516838a64 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -748,7 +748,7 @@ void LeBailFit::createLeBailFunction() { boost::make_shared<LeBailFunction>(LeBailFunction(m_peakType)); // Set up profile parameters - if (m_funcParameters.size() == 0) + if (m_funcParameters.empty()) throw runtime_error("Function parameters must be set up by this point."); map<string, double> pardblmap = convertToDoubleMap(m_funcParameters); @@ -2094,7 +2094,7 @@ bool LeBailFit::calculateDiffractionPattern(const MantidVec &vecX, ::transform(values.begin(), values.end(), vecBkgd.begin(), values.begin(), ::plus<double>()); } else { - if (veccalbkgd.size() == 0) + if (veccalbkgd.empty()) throw runtime_error("Programming logic error."); ::transform(values.begin(), values.end(), veccalbkgd.begin(), values.begin(), ::plus<double>()); @@ -2113,7 +2113,7 @@ bool LeBailFit::calculateDiffractionPattern(const MantidVec &vecX, caldata.begin(), std::plus<double>()); } else { // Re-calculate background - if (veccalbkgd.size() == 0) + if (veccalbkgd.empty()) throw runtime_error("Programming logic error (2). "); std::transform(values.begin(), values.end(), veccalbkgd.begin(), caldata.begin(), std::plus<double>()); @@ -2401,7 +2401,7 @@ void LeBailFit::bookKeepBestMCResult(map<string, Parameter> parammap, m_bestMCStep = istep; // b) Record parameters - if (m_bestParameters.size() == 0) { + if (m_bestParameters.empty()) { // If not be initialized, initialize it! m_bestParameters = parammap; } else { diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp index f9b594569d6099f9570b9ca4d12fd6e0a3d086d1..c8a4a58dc70505c74298642bd43bf315f00a56f9 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp @@ -835,7 +835,7 @@ void LeBailFunction::groupPeaks( << " causes grouping " << "peak over at maximum TOF = " << xmax << ".\n"; - if (peakgroup.size() > 0) { + if (!peakgroup.empty()) { vector<pair<double, IPowderDiffPeakFunction_sptr>> peakgroupcopy = peakgroup; peakgroupvec.push_back(peakgroupcopy); diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index 1e0dd4ec34ae7da9a679286e1dc51f2950d618a9..33990e18619dc7764421c65985cc593b62b793a6 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -662,7 +662,7 @@ void RefinePowderInstrumentParameters3::bookKeepMCResult( } // 2. Record for the best parameters - if (bestparammap.size() == 0) { + if (bestparammap.empty()) { // No record yet duplicateParameters(parammap, bestparammap); } else if (recordparameter) { @@ -796,7 +796,7 @@ void RefinePowderInstrumentParameters3::addParameterToMCMinimize( double RefinePowderInstrumentParameters3::calculateFunction( map<string, Parameter> parammap, vector<double> &vecY) { // 1. Implement parameter values to m_positionFunc - if (parammap.size() > 0) + if (!parammap.empty()) setFunctionParameterValues(m_positionFunc, parammap); // 2. Calculate diff --git a/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp index f295573909e3ba7653a4aad0a806f57f97d95496..1f0aa47943c59266cabbe70d654123e4ca2a565d 100644 --- a/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp +++ b/Framework/CurveFitting/src/Functions/DiffRotDiscreteCircle.cpp @@ -105,7 +105,7 @@ void InelasticDiffRotDiscreteCircle::function1D(double *out, double Q; if (getAttribute("Q").asDouble() == EMPTY_DBL()) { - if (m_qValueCache.size() == 0) { + if (m_qValueCache.empty()) { throw std::runtime_error( "No Q attribute provided and cannot retrieve from worksapce."); } diff --git a/Framework/CurveFitting/src/Functions/DiffSphere.cpp b/Framework/CurveFitting/src/Functions/DiffSphere.cpp index 22d2e0f8baa899ce887ef6783b8d966b3abe4828..d1af5ca9a3367e3b1eeedee0f247021b7fa33e97 100644 --- a/Framework/CurveFitting/src/Functions/DiffSphere.cpp +++ b/Framework/CurveFitting/src/Functions/DiffSphere.cpp @@ -216,7 +216,7 @@ void InelasticDiffSphere::function1D(double *out, const double *xValues, double Q; if (getAttribute("Q").asDouble() == EMPTY_DBL()) { - if (m_qValueCache.size() == 0) { + if (m_qValueCache.empty()) { throw std::runtime_error( "No Q attribute provided and cannot retrieve from worksapce."); } diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index eb00fefa1a46df91adb40dccc71b4bddf587532c..852d9c90744a4cb4e5eb8ba391c9fb7b703b1260 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -936,7 +936,7 @@ void RemovePeaks::setup(TableWorkspace_sptr peaktablews) { // Check if (m_vecPeakCentre.size() != m_vecPeakFWHM.size()) throw runtime_error("Number of peak centres and FWHMs are different!"); - else if (m_vecPeakCentre.size() == 0) + else if (m_vecPeakCentre.empty()) throw runtime_error( "There is not any peak entry in input table workspace."); @@ -950,7 +950,7 @@ Workspace2D_sptr RemovePeaks::removePeaks(API::MatrixWorkspace_const_sptr dataws, int wsindex, double numfwhm) { // Check - if (m_vecPeakCentre.size() == 0) + if (m_vecPeakCentre.empty()) throw runtime_error("RemovePeaks has not been setup yet. "); // Initialize vectors diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h index b0eba695946b2ff2f6c8b6789e9f621db059239e..50817aa6764f881f8a948637835825b7748615d0 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h @@ -483,7 +483,7 @@ void LoadEventNexus::loadEntryMetadata(const std::string &nexusfilename, T WS, // inside ISIS the run_number type is int32 std::vector<int> value; file.getData(value); - if (value.size() > 0) + if (!value.empty()) run = boost::lexical_cast<std::string>(value[0]); } if (!run.empty()) { diff --git a/Framework/DataHandling/src/DownloadInstrument.cpp b/Framework/DataHandling/src/DownloadInstrument.cpp index 2ac3f74bca8f6a91d9014482fc3d410230627171..c1b1b41bccf900e265dc7baca2f61e3d7d70c682 100644 --- a/Framework/DataHandling/src/DownloadInstrument.cpp +++ b/Framework/DataHandling/src/DownloadInstrument.cpp @@ -99,7 +99,7 @@ void DownloadInstrument::exec() { return; } - if (fileMap.size() == 0) { + if (fileMap.empty()) { g_log.notice("All instrument definitions up to date"); } else { std::string s = (fileMap.size() > 1) ? "s" : ""; diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index 5141c46c1497eca62ea07bca75080ccc1a508b8d..a1c6a3bf6fa1f42e9adee7597b0cf2a342596c99 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -508,7 +508,7 @@ void FilterEventsByLogValuePreNexus::processProperties() { // Load partial spectra //--------------------------------------------------------------------------- // For slight speed up - m_loadOnlySomeSpectra = (this->m_spectraList.size() > 0); + m_loadOnlySomeSpectra = (!this->m_spectraList.empty()); // Turn the spectra list into a map, for speed of access for (auto spectra : m_spectraList) diff --git a/Framework/DataHandling/src/LoadCanSAS1D2.cpp b/Framework/DataHandling/src/LoadCanSAS1D2.cpp index 2d5d46d0e2457e7717de4c5f95ec5cc2534cd996..f3029ed23b08d987d1ebb99ef45a8e1c1995880f 100644 --- a/Framework/DataHandling/src/LoadCanSAS1D2.cpp +++ b/Framework/DataHandling/src/LoadCanSAS1D2.cpp @@ -57,7 +57,7 @@ void LoadCanSAS1D2::exec() { if (!loadTrans) return; // all done. It is not to load the transmission, nor check if it // exists. - if (trans_gp.size() == 0 && trans_can_gp.size() == 0) { + if (trans_gp.empty() && trans_can_gp.empty()) { return; // all done, not transmission inside } diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index 70835d1a5b9623bd96fd3480a911524adb99857f..dbb90966f97961635a922608f5add353135979d2 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -109,7 +109,7 @@ void LoadDetectorsGroupingFile::exec() { std::map<int, std::vector<detid_t>>::iterator dit; for (dit = m_groupDetectorsMap.begin(); dit != m_groupDetectorsMap.end(); ++dit) { - if (dit->second.size() > 0) + if (!dit->second.empty()) throw std::invalid_argument( "Grouping file specifies detector ID without instrument name"); } @@ -192,7 +192,7 @@ void LoadDetectorsGroupingFile::setByComponents() { bool norecord = true; for (mapiter = m_groupComponentsMap.begin(); mapiter != m_groupComponentsMap.end(); ++mapiter) { - if (mapiter->second.size() > 0) { + if (!mapiter->second.empty()) { g_log.error() << "Instrument is not specified in XML file. " << "But tag 'component' is used in XML file for Group " << mapiter->first << " It is not allowed" << std::endl; @@ -262,12 +262,12 @@ void LoadDetectorsGroupingFile::setByComponents() { void LoadDetectorsGroupingFile::setByDetectors() { // 0. Check - if (!m_instrument && m_groupDetectorsMap.size() > 0) { + if (!m_instrument && !m_groupDetectorsMap.empty()) { std::map<int, std::vector<detid_t>>::iterator mapiter; bool norecord = true; for (mapiter = m_groupDetectorsMap.begin(); mapiter != m_groupDetectorsMap.end(); ++mapiter) - if (mapiter->second.size() > 0) { + if (!mapiter->second.empty()) { norecord = false; g_log.error() << "Instrument is not specified in XML file. " << "But tag 'detid' is used in XML file for Group " diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index 7c725b16cde04fe603e6e4820fd1e137f549f76f..b170d1fe5a65b13404a6d72fe6d5d9d86dea3a43 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -515,7 +515,7 @@ public: std::string thisStartTime = ""; size_t thisNumPulses = 0; file.getAttr("offset", thisStartTime); - if (file.getInfo().dims.size() > 0) + if (!file.getInfo().dims.empty()) thisNumPulses = file.getInfo().dims[0]; file.closeData(); @@ -2149,7 +2149,7 @@ void LoadEventNexus::deleteBanks(EventWorkspaceCollection_sptr workspace, } } } - if (detList.size() == 0) + if (detList.empty()) return; for (auto &det : detList) { bool keep = false; diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 88b708e69ee18722524f828755991804e58899b1..3cca51ed76797b9da07ad6b1f7d57d724e05be92 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -476,7 +476,7 @@ void LoadEventPreNexus::procEvents( } // For slight speed up - loadOnlySomeSpectra = (this->spectra_list.size() > 0); + loadOnlySomeSpectra = (!this->spectra_list.empty()); // Turn the spectra list into a map, for speed of access for (auto &spectrum : spectra_list) diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index 3bbd5f6e04614c77173035c5ba42c42b188a93b6..c92f4fd603a4239a9a7a680f5c186db086ee4a23 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -726,7 +726,7 @@ void LoadEventPreNexus2::procEvents( } // For slight speed up - loadOnlySomeSpectra = (this->spectra_list.size() > 0); + loadOnlySomeSpectra = (!this->spectra_list.empty()); // Turn the spectra list into a map, for speed of access for (auto &spectrum : spectra_list) diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index df44aa49e105c573a719424551e8cf842196601c..494fd1aa2f98ebba834bce2efb5f1bf62bc51f65 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -138,7 +138,7 @@ void LoadFullprofResolution::exec() { if (vec_bankinirf.empty()) { throw runtime_error("No Bank is found in input file."); - } else if (outputbankids.size() == 0) { + } else if (outputbankids.empty()) { vec_bankids = vec_bankinirf; // If workspaces, set up Bank-Workpace correspondence if (wsg) @@ -177,7 +177,7 @@ void LoadFullprofResolution::exec() { } } } - if (vec_bankids.size() == 0) { + if (vec_bankids.empty()) { g_log.error("There is no valid specified bank IDs for output."); throw runtime_error("There is no valid specified bank IDs for output."); } @@ -208,7 +208,7 @@ void LoadFullprofResolution::exec() { if (wsg) { // First check that number of workspaces in group matches number of banks, // if no WorkspacesForBanks is specified. - if ((outputwsids.size() == 0) && (wsg->size() != vec_bankids.size())) { + if ((outputwsids.empty()) && (wsg->size() != vec_bankids.size())) { std::ostringstream mess; mess << "Number of banks (" << vec_bankids.size() << ") does not match number of workspaces (" << wsg->size() @@ -786,7 +786,7 @@ TableWorkspace_sptr LoadFullprofResolution::genTableWorkspace( void LoadFullprofResolution::createBankToWorkspaceMap( const std::vector<int> &banks, const std::vector<int> &workspaces, std::map<int, size_t> &workspaceOfBank) { - if (workspaces.size() == 0) { + if (workspaces.empty()) { for (size_t i = 0; i < banks.size(); i++) { workspaceOfBank.emplace(banks[i], i + 1); } diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp index 235a04af6879e2fa85de64857c9d9e1b72e59fb2..cd338e5bb07c6b6f64787097658a6b7954c88bf1 100644 --- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp @@ -132,7 +132,7 @@ void LoadGSASInstrumentFile::exec() { vector<size_t> bankStartIndex; scanBanks(lines, bankStartIndex); - if (bankStartIndex.size() == 0) { + if (bankStartIndex.empty()) { throw std::runtime_error("No nanks found in file. \n"); } @@ -172,7 +172,7 @@ void LoadGSASInstrumentFile::exec() { map<int, size_t> workspaceOfBank; // Deal with bankIds - if (bankIds.size()) { + if (!bankIds.empty()) { // If user provided a list of banks, check that they exist in the .prm // file for (auto bankId : bankIds) { diff --git a/Framework/DataHandling/src/LoadGSS.cpp b/Framework/DataHandling/src/LoadGSS.cpp index 398b3a4719d62bfa9721fc0176029311abe6421e..87b92c443b6714c314cf5e6864f4f1aceef3b2ba 100644 --- a/Framework/DataHandling/src/LoadGSS.cpp +++ b/Framework/DataHandling/src/LoadGSS.cpp @@ -225,7 +225,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, // If there is, Save the previous to array and initialze new MantiVec for // (X, Y, E) - if (vecX.size() != 0) { + if (!vecX.empty()) { std::vector<double> storeX = vecX; std::vector<double> storeY = vecY; std::vector<double> storeE = vecE; @@ -297,7 +297,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, double xPrev; // * Get previous X value - if (vecX.size() != 0) { + if (!vecX.empty()) { xPrev = vecX.back(); } else if (filetype == 'r') { // Except if RALF @@ -370,7 +370,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, } // ENDWHILE of readling all lines // Push the vectors (X, Y, E) of the last bank to gsasData - if (vecX.size() != 0) { // Put final spectra into data + if (!vecX.empty()) { // Put final spectra into data gsasDataX.push_back(vecX); gsasDataY.push_back(vecY); gsasDataE.push_back(vecE); diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index a4f81bc5d9cc0c93b004db0438b38cd34d9d5f29..d2c762559d2c3ed2cf6c11f4742976106c3b2d62 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -538,7 +538,7 @@ void LoadISISNexus2::checkOptionalProperties( spec_list.erase(remove_if(spec_list.begin(), spec_list.end(), in_range), spec_list.end()); // combine spectra numbers from ranges and the list - if (spec_list.size() > 0) { + if (!spec_list.empty()) { for (int64_t i = spec_min; i < spec_max + 1; i++) { specnum_t spec_num = static_cast<specnum_t>(i); // remove excluded spectra now rather then inserting it here and @@ -582,7 +582,7 @@ void LoadISISNexus2::buildSpectraInd2SpectraNumMap( int64_t ic(0); - if (spec_list.size() > 0) { + if (!spec_list.empty()) { ic = 0; auto start_point = spec_list.begin(); for (auto it = start_point; it != spec_list.end(); it++) { diff --git a/Framework/DataHandling/src/LoadMask.cpp b/Framework/DataHandling/src/LoadMask.cpp index 0cd9cdf773fe63a58eabd5da37eafb0577913f24..d5e7d372e29818b30f6b629320183096d9258914 100644 --- a/Framework/DataHandling/src/LoadMask.cpp +++ b/Framework/DataHandling/src/LoadMask.cpp @@ -322,7 +322,7 @@ void LoadMask::processMaskOnWorkspaceIndex(bool mask, std::vector<int32_t> pairslow, std::vector<int32_t> pairsup) { // 1. Check - if (pairslow.size() == 0) + if (pairslow.empty()) return; if (pairslow.size() != pairsup.size()) { g_log.error() << "Input spectrum IDs are not paired. Size(low) = " diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp index 6478a9366b1aa8961369d5ea79ba6e35f9c578d2..908bd8503a76aa3d66043136bcdd0dd8c0322b8b 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -2157,7 +2157,7 @@ LoadNexusProcessed::calculateWorkspaceSize(const std::size_t numberofspectra, } else ++it; } - if (m_spec_list.size() == 0) + if (m_spec_list.empty()) m_list = false; total_specs += static_cast<int>(m_spec_list.size()); diff --git a/Framework/DataHandling/src/LoadPDFgetNFile.cpp b/Framework/DataHandling/src/LoadPDFgetNFile.cpp index ab3b140f3a7edd635f49278b084e1aa2e9b44315..352742c26b5c334fb3d85c9556db2d3db413714c 100644 --- a/Framework/DataHandling/src/LoadPDFgetNFile.cpp +++ b/Framework/DataHandling/src/LoadPDFgetNFile.cpp @@ -309,7 +309,7 @@ void LoadPDFgetNFile::setUnit(Workspace2D_sptr ws) { */ void LoadPDFgetNFile::generateDataWorkspace() { // 0. Check - if (mData.size() == 0) { + if (mData.empty()) { throw runtime_error("Data set has not been initialized. Quit!"); } diff --git a/Framework/DataHandling/src/LoadRawHelper.cpp b/Framework/DataHandling/src/LoadRawHelper.cpp index f6353ffacb728cfb31ea859b7208e0704f7e8b88..fdd3a763d69a9efd6d28e8a4e3d1683fa5678256 100644 --- a/Framework/DataHandling/src/LoadRawHelper.cpp +++ b/Framework/DataHandling/src/LoadRawHelper.cpp @@ -918,7 +918,7 @@ void LoadRawHelper::checkOptionalProperties() { // Check validity of spectra list property, if set if (m_list) { m_list = true; - if (m_spec_list.size() == 0) { + if (m_spec_list.empty()) { m_list = false; } else { const int64_t minlist = @@ -968,7 +968,7 @@ specnum_t LoadRawHelper::calculateWorkspaceSize() { } else ++it; } - if (m_spec_list.size() == 0) + if (m_spec_list.empty()) m_list = false; total_specs += static_cast<specnum_t>(m_spec_list.size()); m_total_specs = total_specs; @@ -1025,7 +1025,7 @@ void LoadRawHelper::calculateWorkspacesizes( else ++itr; } - if (m_spec_list.size() == 0) { + if (m_spec_list.empty()) { g_log.debug() << "normalwsSpecs is " << normalwsSpecs << " monitorwsSpecs is " << monitorwsSpecs << std::endl; diff --git a/Framework/DataHandling/src/LoadReflTBL.cpp b/Framework/DataHandling/src/LoadReflTBL.cpp index b47e3b6e765350e11ea443e2cc2d93df3a75ddb8..14ad0864ebde410cd45fa2754416e49ca28fe0e8 100644 --- a/Framework/DataHandling/src/LoadReflTBL.cpp +++ b/Framework/DataHandling/src/LoadReflTBL.cpp @@ -208,7 +208,7 @@ size_t LoadReflTBL::getCells(std::string line, findQuotePairs(line, quoteBounds); // if we didn't find any quotes, then there are too many commas and we // definitely have too many delimiters - if (quoteBounds.size() == 0) { + if (quoteBounds.empty()) { std::string message = "A line must contain 16 cell-delimiting commas. Found " + boost::lexical_cast<std::string>(found) + "."; diff --git a/Framework/DataHandling/src/LoadSassena.cpp b/Framework/DataHandling/src/LoadSassena.cpp index 3ae179ed558f93f70f7fbdea9def8cd08303e2a6..dbc73f02eea143ec8303b5b0e4d404272abb686d 100644 --- a/Framework/DataHandling/src/LoadSassena.cpp +++ b/Framework/DataHandling/src/LoadSassena.cpp @@ -412,7 +412,7 @@ void LoadSassena::exec() { // Block to read the Q-vectors std::vector<int> sorting_indexes; const MantidVec qvmod = this->loadQvectors(h5file, gws, sorting_indexes); - if (qvmod.size() == 0) { + if (qvmod.empty()) { this->g_log.error("No Q-vectors read. Unable to proceed"); H5Fclose(h5file); return; diff --git a/Framework/DataHandling/src/LoadSpiceAscii.cpp b/Framework/DataHandling/src/LoadSpiceAscii.cpp index 30828e22b09bc33e48a000e63e7970c5e1e483c6..8fa1adba9891028fe539fd703acf3aee5d22d490 100644 --- a/Framework/DataHandling/src/LoadSpiceAscii.cpp +++ b/Framework/DataHandling/src/LoadSpiceAscii.cpp @@ -445,7 +445,7 @@ void LoadSpiceAscii::setupRunStartTime( API::MatrixWorkspace_sptr runinfows, const std::vector<std::string> &datetimeprop) { // Check if no need to process run start time - if (datetimeprop.size() == 0) { + if (datetimeprop.empty()) { g_log.information("User chooses not to set up run start date and time."); return; } diff --git a/Framework/DataHandling/src/SaveNXTomo.cpp b/Framework/DataHandling/src/SaveNXTomo.cpp index 654e5fa5992afe6ecd661586abc9db94bd1ecd53..61bdad87d6b7f252c3d42f4e5ee431c9bad5cacc 100644 --- a/Framework/DataHandling/src/SaveNXTomo.cpp +++ b/Framework/DataHandling/src/SaveNXTomo.cpp @@ -76,7 +76,7 @@ void SaveNXTomo::exec() { } catch (...) { } - if (m_workspaces.size() != 0) + if (!m_workspaces.empty()) processAll(); } @@ -96,7 +96,7 @@ bool SaveNXTomo::processGroups() { } catch (...) { } - if (m_workspaces.size() != 0) + if (!m_workspaces.empty()) processAll(); return true; diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc index 2fdd4adf66c73f3e092b96c3c900c555c1f2ed0f..100e9e91fb3fb506f41e4dfb1005cf25b935685f 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc @@ -378,7 +378,7 @@ TMDE(bool MDBox)::isDataAdded() const { if (m_Saveable->isLoaded()) return data.size() != m_Saveable->getFileSize(); } - return (data.size() != 0); + return (!data.empty()); } //----------------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index f2a38dbd89a7abf74a21c09b67f759679d0e2651..5f9f4b52247115229d4e5f1361ad188609b9f2de 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -1973,7 +1973,7 @@ void EventList::histogramForWeightsHelper(const std::vector<T> &events, //--------------------------------- // Do we even have any events to do? - if (events.size() > 0) { + if (!events.empty()) { // Iterate through all events (sorted by tof) auto itev = findFirstEvent(events, X[0]); auto itev_end = events.cend(); @@ -2167,7 +2167,7 @@ void EventList::generateCountsHistogramPulseTime(const MantidVec &X, //---------------------- Histogram without weights //--------------------------------- - if (this->events.size() > 0) { + if (!this->events.empty()) { // Iterate through all events (sorted by pulse time) auto itev = findFirstPulseEvent(this->events, X[0]); auto itev_end = events.cend(); // cache for speed @@ -2239,7 +2239,7 @@ void EventList::generateCountsHistogramTimeAtSample( //---------------------- Histogram without weights //--------------------------------- - if (this->events.size() > 0) { + if (!this->events.empty()) { // Iterate through all events (sorted by pulse time) auto itev = findFirstTimeAtSampleEvent(this->events, X[0], tofFactor, tofOffset); @@ -2311,7 +2311,7 @@ void EventList::generateCountsHistogram(const MantidVec &X, //--------------------------------- // Do we even have any events to do? - if (this->events.size() > 0) { + if (!this->events.empty()) { // Iterate through all events (sorted by tof) std::vector<TofEvent>::const_iterator itev = findFirstEvent(this->events, X[0]); @@ -2407,7 +2407,7 @@ void EventList::integrateHelper(std::vector<T> &events, const double minX, sum = 0; error = 0; // Nothing in the list? - if (events.size() == 0) + if (events.empty()) return; // Iterators for limits - whole range by default @@ -3986,7 +3986,7 @@ void EventList::splitByTime(Kernel::TimeSplitterType &splitter, } // Do nothing if there are no entries - if (splitter.size() <= 0) + if (splitter.empty()) return; switch (eventType) { @@ -4131,7 +4131,7 @@ void EventList::splitByFullTime(Kernel::TimeSplitterType &splitter, } // Do nothing if there are no entries - if (splitter.size() <= 0) { + if (splitter.empty()) { // 3A. Copy all events to group workspace = -1 (*outputs[-1]) = (*this); // this->duplicate(outputs[-1]); @@ -4263,7 +4263,7 @@ std::string EventList::splitByFullTimeMatrixSplitter( std::string debugmessage(""); // Do nothing if there are no entries - if (vecgroups.size() == 0) { + if (vecgroups.empty()) { // Copy all events to group workspace = -1 (*vec_outputEventList[-1]) = (*this); // this->duplicate(outputs[-1]); @@ -4383,7 +4383,7 @@ void EventList::splitByPulseTime(Kernel::TimeSplitterType &splitter, } // Split - if (splitter.size() <= 0) { + if (splitter.empty()) { // No splitter: copy all events to group workspace = -1 (*outputs[-1]) = (*this); } else { diff --git a/Framework/DataObjects/src/Workspace2D.cpp b/Framework/DataObjects/src/Workspace2D.cpp index dfb94df00cff3328794ff3ce141203d6bedfe0d5..b3acd6688f27137ef34e2cf229b556f660f06571 100644 --- a/Framework/DataObjects/src/Workspace2D.cpp +++ b/Framework/DataObjects/src/Workspace2D.cpp @@ -107,7 +107,7 @@ size_t Workspace2D::size() const { return data.size() * blocksize(); } /// get the size of each vector size_t Workspace2D::blocksize() const { - return (data.size() > 0) + return (!data.empty()) ? static_cast<ISpectrum const *>(data[0])->dataY().size() : 0; } diff --git a/Framework/Geometry/src/ComponentParser.cpp b/Framework/Geometry/src/ComponentParser.cpp index 53b5c12d9d9aa0f67deda7ed435451e1dfec5b41..a912cd0ffe2755a6dfcff8df45c943b054d25499 100644 --- a/Framework/Geometry/src/ComponentParser.cpp +++ b/Framework/Geometry/src/ComponentParser.cpp @@ -7,7 +7,7 @@ namespace Geometry { /** @return the top-level component created */ Component *ComponentParser::getComponent() { - if (m_current.size() > 0) + if (!m_current.empty()) return m_current[0]; else return nullptr; diff --git a/Framework/Geometry/src/Crystal/Group.cpp b/Framework/Geometry/src/Crystal/Group.cpp index f89540d6adbe763109d27bbe8ad90a7278c87f62..bf00f72c866df3c7b357c9d201858f6b1ddd9233 100644 --- a/Framework/Geometry/src/Crystal/Group.cpp +++ b/Framework/Geometry/src/Crystal/Group.cpp @@ -128,7 +128,7 @@ bool Group::isGroup() const { /// empty. void Group::setSymmetryOperations( const std::vector<SymmetryOperation> &symmetryOperations) { - if (symmetryOperations.size() < 1) { + if (symmetryOperations.empty()) { throw std::invalid_argument("Group needs at least one element."); } diff --git a/Framework/Geometry/src/Crystal/IndexingUtils.cpp b/Framework/Geometry/src/Crystal/IndexingUtils.cpp index 5e231dc844a14267b6ac2a4c4534f0642039155c..780d3a09188932eb107a3c48eeefdd46dfd41aba 100644 --- a/Framework/Geometry/src/Crystal/IndexingUtils.cpp +++ b/Framework/Geometry/src/Crystal/IndexingUtils.cpp @@ -1925,7 +1925,7 @@ double IndexingUtils::IndexingError(const DblMatrix &UB, total_error += h_error + k_error + l_error; } - if (hkls.size() > 0) + if (!hkls.empty()) return total_error / (3.0 * static_cast<double>(hkls.size())); else return 0; @@ -2522,11 +2522,11 @@ int IndexingUtils::SelectDirection(V3D &best_direction, const std::vector<V3D> direction_list, double plane_spacing, double required_tolerance) { - if (q_vectors.size() == 0) { + if (q_vectors.empty()) { throw std::invalid_argument("SelectDirection(): No Q vectors specified"); } - if (direction_list.size() == 0) { + if (direction_list.empty()) { throw std::invalid_argument( "SelectDirection(): List of possible directions has zero length"); } diff --git a/Framework/Geometry/src/Crystal/ScalarUtils.cpp b/Framework/Geometry/src/Crystal/ScalarUtils.cpp index 32a3e80f1db0aa094e482cbc70bcc4895c58df0b..dd9cc6a17fa4fc74462e37d8bb4a2375112ebccf 100644 --- a/Framework/Geometry/src/Crystal/ScalarUtils.cpp +++ b/Framework/Geometry/src/Crystal/ScalarUtils.cpp @@ -263,7 +263,7 @@ ConventionalCell ScalarUtils::GetCellForForm(const DblMatrix &UB, */ void ScalarUtils::RemoveHighErrorForms(std::vector<ConventionalCell> &list, double level) { - if (list.size() <= 0) // nothing to do + if (list.empty()) // nothing to do return; std::vector<ConventionalCell> new_list; @@ -293,7 +293,7 @@ void ScalarUtils::RemoveHighErrorForms(std::vector<ConventionalCell> &list, ConventionalCell ScalarUtils::GetCellBestError(const std::vector<ConventionalCell> &list, bool use_triclinic) { - if (list.size() == 0) { + if (list.empty()) { throw std::invalid_argument("GetCellBestError(): list is empty"); } diff --git a/Framework/Geometry/src/Instrument/Goniometer.cpp b/Framework/Geometry/src/Instrument/Goniometer.cpp index 4bc05a186f9677db2a47b8d4145a34ae03d0131c..4b50fe05e788a53e7d19642df5e9046db3f6fc2d 100644 --- a/Framework/Geometry/src/Instrument/Goniometer.cpp +++ b/Framework/Geometry/src/Instrument/Goniometer.cpp @@ -90,7 +90,7 @@ std::string Goniometer::axesInfo() { std::vector<GoniometerAxis>::iterator it; std::string strCW("CW"), strCCW("CCW"), sense; - if (motors.size() == 0) { + if (motors.empty()) { info << "No axis is found\n"; } else { info << "Name \t Direction \t Sense \t Angle \n"; diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index 02baf75e2d014771c5189154d82a4dab84fcf49a..84e7d5a71ce6fffba2a7011061b7710a73b8f1da 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -417,7 +417,7 @@ InstrumentDefinitionParser::parseXML(Kernel::ProgressBase *prog) { if (!pElem->hasAttribute("idlist")) { g_log.error("No detector ID list found for detectors of type " + pElem->getAttribute("type")); - } else if (idList.vec.size() == 0) { + } else if (idList.vec.empty()) { g_log.error("No detector IDs found for detectors in list " + pElem->getAttribute("idlist") + "for detectors of type" + pElem->getAttribute("type")); @@ -1339,7 +1339,7 @@ void InstrumentDefinitionParser::appendLeaf(Geometry::ICompAssembly *parent, name); throw Kernel::Exception::InstrumentDefinitionError( "Detector location element " + name + " has no idlist.", filename); - } else if (idList.vec.size() == 0) { + } else if (idList.vec.empty()) { g_log.error("No detector IDs found for detectors in list " + idList.idname); } else { diff --git a/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp b/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp index 56c538a79e67a8b82c0cd293ddf0aab55ce1daff..fd10bcc6045f70f038f64d81701536187c71a72a 100644 --- a/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp +++ b/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp @@ -16,7 +16,7 @@ MDImplicitFunction::MDImplicitFunction() : m_nd(0), m_numPlanes(0) {} */ void MDImplicitFunction::addPlane(const MDPlane &plane) { // Number of dimensions must match - if (m_planes.size() > 0) { + if (!m_planes.empty()) { if (m_nd != plane.getNumDims()) throw std::invalid_argument("MDImplicitFunction::addPlane(): cannot add " "a plane with different number of dimensions " diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp index 8db58e30ed1f403c719edb0d914f6c52010ee96d..53472e2e0c45614dc337005d27156dfc78da6de4 100644 --- a/Framework/Geometry/src/Math/Acomp.cpp +++ b/Framework/Geometry/src/Math/Acomp.cpp @@ -536,7 +536,7 @@ A. This will make the form DNF. { Units.clear(); deleteComp(); - if (A.size() == 0) + if (A.empty()) return; if (A.size() == 1) // special case for single intersection @@ -566,7 +566,7 @@ A. This will make the form DNF. { Units.clear(); deleteComp(); - if (A.size() == 0) + if (A.empty()) return; if (A.size() == 1) // special case for single union @@ -663,7 +663,7 @@ int Acomp::isNull() const @return 1 if there are no memebers */ { - return ((!Units.size() && !Comp.size()) ? 1 : 0); + return ((Units.empty() && Comp.empty()) ? 1 : 0); } int Acomp::isDNF() const @@ -888,7 +888,7 @@ It is set on exit (to the EPI) */ { const int debug(0); - if (!PIform.size()) + if (PIform.empty()) return 0; std::vector<BnId> EPI; // Created Here. @@ -1358,7 +1358,7 @@ singles exist and up-promotes them. const Acomp *Lower = itemC(0); // returns pointer Units.clear(); Intersect = Lower->Intersect; - if (Lower->Units.size()) { + if (!Lower->Units.empty()) { Units.resize(Lower->Units.size()); copy(Lower->Units.begin(), Lower->Units.end(), Units.begin()); } diff --git a/Framework/Kernel/inc/MantidKernel/Interpolation.h b/Framework/Kernel/inc/MantidKernel/Interpolation.h index bf837df3312bf2ce1135fd6ee4af6c4eafb1f23b..623ac263ee6ed5dc8c306fd566e3c22b95afa42d 100644 --- a/Framework/Kernel/inc/MantidKernel/Interpolation.h +++ b/Framework/Kernel/inc/MantidKernel/Interpolation.h @@ -94,7 +94,7 @@ public: Unit_sptr getYUnit() const { return m_yUnit; }; /// return false if no data has been added - bool containData() const { return m_x.size() ? true : false; } + bool containData() const { return !m_x.empty() ? true : false; } /// Prints object to stream void printSelf(std::ostream &os) const; diff --git a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h index f093f4b73d39582cada447d7713e18682f21bf4b..e648178413919a3876bb3328ff5b30d41980bdff 100644 --- a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h +++ b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h @@ -169,7 +169,7 @@ public: m_queueLock.lock(); // Check the size within the same locking block; otherwise the size may // change before you get the next item. - if (m_queue.size() > 0) { + if (!m_queue.empty()) { // TODO: Would a try/catch block be smart here? temp = m_queue.front(); m_queue.pop_front(); @@ -222,7 +222,7 @@ class MANTID_KERNEL_DLL ThreadSchedulerLIFO : public ThreadSchedulerFIFO { m_queueLock.lock(); // Check the size within the same locking block; otherwise the size may // change before you get the next item. - if (m_queue.size() > 0) { + if (!m_queue.empty()) { // TODO: Would a try/catch block be smart here? temp = m_queue.back(); m_queue.pop_back(); @@ -274,7 +274,7 @@ public: m_queueLock.lock(); // Check the size within the same locking block; otherwise the size may // change before you get the next item. - if (m_map.size() > 0) { + if (!m_map.empty()) { // Since the map is sorted by cost, we want the LAST item. std::multimap<double, Task *>::iterator it = m_map.end(); it--; diff --git a/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h b/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h index 11cbe60535c1ff4fa093298bd3dbed47b9464922..ca960fe8b4b8700f1485a8c546437fb59798af99 100644 --- a/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h +++ b/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h @@ -50,7 +50,7 @@ public: std::lock_guard<std::mutex> lock(m_queueLock); // Check the size within the same locking block; otherwise the size may // change before you get the next item. - if (m_supermap.size() > 0) { + if (!m_supermap.empty()) { // We iterate in reverse as to take the NULL mutex last, even if no mutex // is busy SuperMap::iterator it = m_supermap.begin(); @@ -63,7 +63,7 @@ public: // The mutex of this map is free! InnerMap &map = it->second; - if (map.size() > 0) { + if (!map.empty()) { // Look for the largest cost item in it. InnerMap::iterator it2 = it->second.end(); it2--; @@ -81,7 +81,7 @@ public: SuperMap::iterator it = m_supermap.begin(); SuperMap::iterator it_end = m_supermap.end(); for (; it != it_end; it++) { - if (it->second.size() > 0) { + if (!it->second.empty()) { InnerMap &map = it->second; // Use the first one temp = map.begin()->second; diff --git a/Framework/Kernel/src/BinFinder.cpp b/Framework/Kernel/src/BinFinder.cpp index e73310b8c537daef3240482761a23c1b0cf03456..4cba89b83f84988ab7e3953edbdfaf4dcfd2894c 100644 --- a/Framework/Kernel/src/BinFinder.cpp +++ b/Framework/Kernel/src/BinFinder.cpp @@ -98,7 +98,7 @@ BinFinder::BinFinder(const std::vector<double> &binParams) { * which should be == to the size of the X axis. */ int BinFinder::lastBinIndex() { - if (endBinIndex.size() > 0) + if (!endBinIndex.empty()) return endBinIndex[endBinIndex.size() - 1]; else return -1; diff --git a/Framework/Kernel/src/RemoteJobManager.cpp b/Framework/Kernel/src/RemoteJobManager.cpp index d0e8c6b9c1e31cd2dc19aeafa25b009679aba599..084e4c3b0f52ec486d082014ec91f538d0508b87 100644 --- a/Framework/Kernel/src/RemoteJobManager.cpp +++ b/Framework/Kernel/src/RemoteJobManager.cpp @@ -79,7 +79,7 @@ std::istream &RemoteJobManager::httpGet(const std::string &path, // session cookie. std::vector<Poco::Net::HTTPCookie> newCookies; m_response.getCookies(newCookies); - if (newCookies.size() > 0) { + if (!newCookies.empty()) { m_cookies = newCookies; } @@ -168,7 +168,7 @@ std::istream &RemoteJobManager::httpPost(const std::string &path, // session cookie. std::vector<Poco::Net::HTTPCookie> newCookies; m_response.getCookies(newCookies); - if (newCookies.size() > 0) { + if (!newCookies.empty()) { m_cookies = newCookies; } diff --git a/Framework/Kernel/src/Statistics.cpp b/Framework/Kernel/src/Statistics.cpp index 7c5909edf757c4aac1f8c3b183bed1bc9de33248..c7d3d11d480545a92b46c0cb5b0b447042aa2380 100644 --- a/Framework/Kernel/src/Statistics.cpp +++ b/Framework/Kernel/src/Statistics.cpp @@ -232,7 +232,7 @@ Rfactor getRFactor(const std::vector<double> &obsI, << ") have different number of elements."; throw std::runtime_error(errss.str()); } - if (obsI.size() == 0) { + if (obsI.empty()) { throw std::runtime_error("getRFactor(): the input arrays are empty."); } diff --git a/Framework/Kernel/src/TimeSeriesProperty.cpp b/Framework/Kernel/src/TimeSeriesProperty.cpp index d806dc1a132e75d8e27cf2f165412afac44f30a5..a90c6aac521c0374e280834a47a0fb141e11bf60 100644 --- a/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -824,7 +824,7 @@ TimeSeriesProperty<TYPE>::valueAsCorrectMap() const { // 2. Data Strcture std::map<DateAndTime, TYPE> asMap; - if (m_values.size() > 0) { + if (!m_values.empty()) { for (size_t i = 0; i < m_values.size(); i++) asMap[m_values[i].time()] = m_values[i].value(); } @@ -860,7 +860,7 @@ std::multimap<DateAndTime, TYPE> TimeSeriesProperty<TYPE>::valueAsMultiMap() const { std::multimap<DateAndTime, TYPE> asMultiMap; - if (m_values.size() > 0) { + if (!m_values.empty()) { for (size_t i = 0; i < m_values.size(); i++) asMultiMap.insert( std::make_pair(m_values[i].time(), m_values[i].value())); @@ -987,7 +987,7 @@ void TimeSeriesProperty<TYPE>::addValues( } } - if (values.size() > 0) + if (!values.empty()) m_propSortedFlag = TimeSeriesSortStatus::TSUNKNOWN; return; @@ -1012,7 +1012,7 @@ void TimeSeriesProperty<TYPE>::replaceValues( */ template <typename TYPE> DateAndTime TimeSeriesProperty<TYPE>::lastTime() const { - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("lastTime(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1028,7 +1028,7 @@ DateAndTime TimeSeriesProperty<TYPE>::lastTime() const { * @return Value */ template <typename TYPE> TYPE TimeSeriesProperty<TYPE>::firstValue() const { - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("firstValue(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1045,7 +1045,7 @@ template <typename TYPE> TYPE TimeSeriesProperty<TYPE>::firstValue() const { */ template <typename TYPE> DateAndTime TimeSeriesProperty<TYPE>::firstTime() const { - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("firstTime(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1062,7 +1062,7 @@ DateAndTime TimeSeriesProperty<TYPE>::firstTime() const { * @return Value */ template <typename TYPE> TYPE TimeSeriesProperty<TYPE>::lastValue() const { - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("lastValue(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1156,7 +1156,7 @@ std::map<DateAndTime, TYPE> TimeSeriesProperty<TYPE>::valueAsMap() const { // 2. Build map std::map<DateAndTime, TYPE> asMap; - if (m_values.size() == 0) + if (m_values.empty()) return asMap; TYPE d = m_values[0].value(); @@ -1288,7 +1288,7 @@ void TimeSeriesProperty<TYPE>::create(const std::vector<DateAndTime> &new_times, */ template <typename TYPE> TYPE TimeSeriesProperty<TYPE>::getSingleValue(const DateAndTime &t) const { - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("getSingleValue(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1337,7 +1337,7 @@ TYPE TimeSeriesProperty<TYPE>::getSingleValue(const DateAndTime &t) const { template <typename TYPE> TYPE TimeSeriesProperty<TYPE>::getSingleValue(const DateAndTime &t, int &index) const { - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("getSingleValue(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1393,7 +1393,7 @@ TYPE TimeSeriesProperty<TYPE>::getSingleValue(const DateAndTime &t, template <typename TYPE> TimeInterval TimeSeriesProperty<TYPE>::nthInterval(int n) const { // 0. Throw exception - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("nthInterval(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1407,7 +1407,7 @@ TimeInterval TimeSeriesProperty<TYPE>::nthInterval(int n) const { Kernel::TimeInterval deltaT; - if (m_filter.size() == 0) { + if (m_filter.empty()) { // I. No filter if (n >= static_cast<int>(m_values.size()) || (n == static_cast<int>(m_values.size()) - 1 && m_values.size() == 1)) { @@ -1512,7 +1512,7 @@ template <typename TYPE> TYPE TimeSeriesProperty<TYPE>::nthValue(int n) const { TYPE value; // 1. Throw error if property is empty - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("nthValue(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1522,7 +1522,7 @@ template <typename TYPE> TYPE TimeSeriesProperty<TYPE>::nthValue(int n) const { // 2. Sort and apply filter sort(); - if (m_filter.size() == 0) { + if (m_filter.empty()) { // 3. Situation 1: No filter if (static_cast<size_t>(n) < m_values.size()) { TimeValueUnit<TYPE> entry = m_values[static_cast<std::size_t>(n)]; @@ -1568,7 +1568,7 @@ template <typename TYPE> Kernel::DateAndTime TimeSeriesProperty<TYPE>::nthTime(int n) const { sort(); - if (m_values.size() == 0) { + if (m_values.empty()) { const std::string error("nthTime(): TimeSeriesProperty '" + name() + "' is empty"); g_log.debug(error); @@ -1683,7 +1683,7 @@ template <typename TYPE> void TimeSeriesProperty<TYPE>::clearFilter() { * Updates size() */ template <typename TYPE> void TimeSeriesProperty<TYPE>::countSize() const { - if (m_filter.size() == 0) { + if (m_filter.empty()) { // 1. Not filter m_size = int(m_values.size()); } else { @@ -1883,7 +1883,7 @@ template <typename TYPE> void TimeSeriesProperty<TYPE>::sort() const { template <typename TYPE> int TimeSeriesProperty<TYPE>::findIndex(Kernel::DateAndTime t) const { // 0. Return with an empty container - if (m_values.size() == 0) + if (m_values.empty()) return 0; // 1. Sort @@ -1965,7 +1965,7 @@ template <typename TYPE> void TimeSeriesProperty<TYPE>::applyFilter() const { // 1. Check and reset if (m_filterApplied) return; - if (m_filter.size() == 0) + if (m_filter.empty()) return; m_filterQuickRef.clear(); @@ -1985,7 +1985,7 @@ template <typename TYPE> void TimeSeriesProperty<TYPE>::applyFilter() const { if (icurlog < 0) { // i. If it is out of lower boundary, add filter time, add 0 time - if (m_filterQuickRef.size() > 0) + if (!m_filterQuickRef.empty()) throw std::logic_error( "return log index < 0 only occurs with the first log entry"); @@ -2004,7 +2004,7 @@ template <typename TYPE> void TimeSeriesProperty<TYPE>::applyFilter() const { } else { // iii. The returned value is in the boundary. size_t numintervals = 0; - if (m_filterQuickRef.size() > 0) { + if (!m_filterQuickRef.empty()) { numintervals = m_filterQuickRef.back().second; } if (m_filter[ift].first < @@ -2084,7 +2084,7 @@ size_t TimeSeriesProperty<TYPE>::findNthIndexFromQuickRef(int n) const { // 1. Do check if (n < 0) throw std::invalid_argument("Unable to take into account negative index. "); - else if (m_filterQuickRef.size() == 0) + else if (m_filterQuickRef.empty()) throw std::runtime_error("Quick reference is not established. "); // 2. Return... diff --git a/Framework/Kernel/src/TimeSplitter.cpp b/Framework/Kernel/src/TimeSplitter.cpp index c013801c7c3233b8dff2d2e67415c6073552c90e..82d9dd3c4e86f044833be93608963dadc6089964 100644 --- a/Framework/Kernel/src/TimeSplitter.cpp +++ b/Framework/Kernel/src/TimeSplitter.cpp @@ -139,7 +139,7 @@ TimeSplitterType operator&(const TimeSplitterType &a, TimeSplitterType out; // If either is empty, then no entries in the filter (aka everything is // removed) - if ((a.size() == 0) || (b.size() == 0)) + if ((a.empty()) || (b.empty())) return out; TimeSplitterType::const_iterator ait; @@ -241,7 +241,7 @@ TimeSplitterType operator~(const TimeSplitterType &a) { temp = removeFilterOverlap(a); // No entries: then make a "filter" that keeps everything - if ((temp.size() == 0)) { + if ((temp.empty())) { out.push_back( SplittingInterval(DateAndTime::minimum(), DateAndTime::maximum(), 0)); return out; diff --git a/Framework/Kernel/src/VMD.cpp b/Framework/Kernel/src/VMD.cpp index 59bfe4a12a2153685dc36509edb027bd07ec46f0..18f55ed21339e43cc4818aa8b4c4ce93113ff506 100644 --- a/Framework/Kernel/src/VMD.cpp +++ b/Framework/Kernel/src/VMD.cpp @@ -81,7 +81,7 @@ VMDBase<TYPE>::makeVectorsOrthogonal(std::vector<VMDBase> &vectors) { template <typename TYPE> VMDBase<TYPE> VMDBase<TYPE>::getNormalVector(const std::vector<VMDBase<TYPE>> &vectors) { - if (vectors.size() <= 0) + if (vectors.empty()) throw std::invalid_argument( "VMDBase::getNormalVector: Must give at least 1 vector"); size_t nd = vectors[0].getNumDims(); diff --git a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp index 3acf7916ffa36667f2062143e6dec444cb322899..7b149c33616dc87044d3f88564870801bb62c01a 100644 --- a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp @@ -361,7 +361,7 @@ void ConvertCWPDMDToSpectra::findXBoundary( // Get source and sample position std::vector<detid_t> vec_detid = dataws->getExperimentInfo(irun)->getInstrument()->getDetectorIDs(true); - if (vec_detid.size() == 0) { + if (vec_detid.empty()) { g_log.information() << "Run " << runnumber << " has no detectors." << "\n"; continue; diff --git a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp index 91c6950333c94c8a13aa3de83f6e824632c203ef..6349036e109ec263fed9ba3bf97bd80da6775642 100644 --- a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp +++ b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp @@ -411,7 +411,7 @@ void ConvertSpiceDataToRealSpace::readTableInfo( } // ENDFOR (icol) // Check detectors' names - if (anodelist.size() == 0) { + if (anodelist.empty()) { std::stringstream errss; errss << "There is no log name starting with " << anodelogprefix << " for detector. "; diff --git a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp index 4b5623d8109d96dd494579bf71eeaa64ea80b04e..14be5bb98b524686ee132508f01460c26387977d 100644 --- a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp +++ b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp @@ -529,7 +529,7 @@ PeakShapeEllipsoid_const_sptr Integrate3DEvents::ellipseIntegrateEvents( axes_radii.push_back(r1 * sigmas[i]); } - if (E1Vec.size() > 0) { + if (!E1Vec.empty()) { double h3 = 1.0 - detectorQ(E1Vec, peak_q, abcBackgroundOuterRadii); // scaled from area of circle minus segment when r normalized to 1 double m3 = std::sqrt( diff --git a/Framework/MDAlgorithms/src/LoadILLAscii.cpp b/Framework/MDAlgorithms/src/LoadILLAscii.cpp index a0c08fd14cb40a04989cec3039e51a58c0f4653d..908e22a5c2dc9e29fb2b063a79e84e953346f543 100644 --- a/Framework/MDAlgorithms/src/LoadILLAscii.cpp +++ b/Framework/MDAlgorithms/src/LoadILLAscii.cpp @@ -295,7 +295,7 @@ IMDEventWorkspace_sptr LoadILLAscii::mergeWorkspaces( "coords" << std::endl; myfile << "MDEVENTS" << std::endl; - if (workspaceList.size() > 0) { + if (!workspaceList.empty()) { Progress progress(this, 0, 1, workspaceList.size()); for (auto it = workspaceList.begin(); it < workspaceList.end(); ++it) { std::size_t pos = std::distance(workspaceList.begin(), it); diff --git a/Framework/MDAlgorithms/src/MergeMDFiles.cpp b/Framework/MDAlgorithms/src/MergeMDFiles.cpp index 9521bba3e4d26fed868f1a34f2ef1353dadf3902..d4a8048f4147b9c4b491317cf8911ffa2ab9cac3 100644 --- a/Framework/MDAlgorithms/src/MergeMDFiles.cpp +++ b/Framework/MDAlgorithms/src/MergeMDFiles.cpp @@ -359,7 +359,7 @@ void MergeMDFiles::exec() { } m_Filenames = MultipleFileProperty::flattenFileNames(multiFileProp->operator()()); - if (m_Filenames.size() == 0) + if (m_Filenames.empty()) throw std::invalid_argument("Must specify at least one filename."); std::string firstFile = m_Filenames[0]; diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp index 94984b503dfdcefad66994b87fab3b002e663e25..eb27efdf8ea8a2266b6ea6b34e91ebc7166cc735 100644 --- a/Framework/Nexus/src/NexusFileIO.cpp +++ b/Framework/Nexus/src/NexusFileIO.cpp @@ -760,7 +760,7 @@ int NexusFileIO::writeNexusProcessedDataEventCombined( // The array of indices for each event list # int dims_array[1] = {static_cast<int>(indices.size())}; - if (indices.size() > 0) { + if (!indices.empty()) { if (compress) NXcompmakedata(fileID, "indices", NX_INT64, 1, dims_array, m_nexuscompression, dims_array); diff --git a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp index eec7b27e714d89ca85d93b1e1ce63b769099f368..1c087ac8dc929ec964d5388b6d5ddfaa982c8419 100644 --- a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp +++ b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp @@ -1232,7 +1232,7 @@ void SCARFTomoReconstruction::genOutputStatusInfo( setProperty("RemoteJobsCommands", jobCommands); } else { // Single job query. Here the job ID is an input - if (0 == jobIds.size()) { + if (jobIds.empty()) { setProperty("RemoteJobName", "Unknown!"); setProperty("RemoteJobStatus", "Unknown!"); setProperty("RemoteJobCommand", "Unknown!"); diff --git a/Framework/RemoteJobManagers/src/LSFJobManager.cpp b/Framework/RemoteJobManagers/src/LSFJobManager.cpp index 5a411b6d8ca9435de62f596a9613d2bc6b2c3a87..f98c974e705a6504d7cbfa698a43032ecb80d77b 100644 --- a/Framework/RemoteJobManagers/src/LSFJobManager.cpp +++ b/Framework/RemoteJobManagers/src/LSFJobManager.cpp @@ -1354,7 +1354,7 @@ bool LSFJobManager::findTransaction(const std::string &id) const { * */ void LSFJobManager::addJobInTransaction(const std::string &jobID) { - if (g_transactions.size() <= 0) + if (g_transactions.empty()) return; auto &jobs = g_transactions.rbegin()->second.jobIDs; auto it = std::find(jobs.begin(), jobs.end(), jobID); diff --git a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp index 8022e369194333a233339765cee66d7bf9287ed9..a19baa058fc1d9be534a50961aca59ecba276fd7 100644 --- a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp +++ b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp @@ -63,7 +63,7 @@ std::istream &MantidWebServiceAPIHelper::httpGet( // session cookie. std::vector<Poco::Net::HTTPCookie> newCookies; m_response.getCookies(newCookies); - if (newCookies.size() > 0) { + if (!newCookies.empty()) { g_cookies = newCookies; } @@ -152,7 +152,7 @@ std::istream &MantidWebServiceAPIHelper::httpPost( // session cookie. std::vector<Poco::Net::HTTPCookie> newCookies; m_response.getCookies(newCookies); - if (newCookies.size() > 0) { + if (!newCookies.empty()) { g_cookies = newCookies; } diff --git a/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp b/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp index 94f9e1b3c4885ae36411e9c1d1fdb785a9d12f22..35b5e2bf41e6503112c15e52f5894edfb98919c7 100644 --- a/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp +++ b/Framework/RemoteJobManagers/src/SCARFLSFJobManager.cpp @@ -154,7 +154,7 @@ bool SCARFLSFJobManager::ping() { * logged in with authenticate(). */ void SCARFLSFJobManager::logout(const std::string &username) { - if (0 == g_tokenStash.size()) { + if (g_tokenStash.empty()) { throw std::runtime_error("Logout failed. No one is currenlty logged in."); } diff --git a/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Framework/SINQ/src/PoldiFitPeaks2D.cpp index bec134a194a93596e365731386f9c31be7a63a94..0d2d66898db1cc1f473c48851f18d33f583e1e6d 100644 --- a/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -702,7 +702,7 @@ PoldiFitPeaks2D::getUserSpecifiedTies(const IFunction_sptr &poldiFn) { } } - if (tieComponents.size() > 0) { + if (!tieComponents.empty()) { return boost::algorithm::join(tieComponents, ","); } } diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp index 4282351ce0911fbf04064ffcaf52a2f2859893f6..566f7e0b72aaa036bf792e2c739bc5dc8daef37a 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp @@ -58,7 +58,7 @@ void PoldiDeadWireDecorator::detectorSetHook() { std::vector<int> PoldiDeadWireDecorator::getGoodElements(std::vector<int> rawElements) { - if (m_deadWireSet.size() > 0) { + if (!m_deadWireSet.empty()) { if (*m_deadWireSet.rbegin() > rawElements.back()) { throw std::runtime_error( std::string("Deadwires set contains illegal index.")); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp index cc7d068fa8d09991f48c65d737f0ae004fd2ee1d..09e5c2697ab01770c81c6d5a0cebe87c47502e0c 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiResidualCorrelationCore.cpp @@ -43,7 +43,7 @@ double PoldiResidualCorrelationCore::reduceChopperSlitList( /// Calculates the average of the values in a vector. double PoldiResidualCorrelationCore::calculateAverage( const std::vector<double> &values) const { - if (values.size() == 0) { + if (values.empty()) { throw std::runtime_error("Cannot calculate average of 0 values."); } diff --git a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp index 79867493af57e6de8f550fd70cc21a8fd86243e5..5459edd363cd08d4b1103706fa3c6454cf93f0cc 100644 --- a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp +++ b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp @@ -1527,7 +1527,7 @@ void ScriptRepositoryImpl::parseDownloadedEntries(Repository &repo) { } // end loop FOREACH entry in local json // delete the entries to be deleted in json file - if (entries_to_delete.size() > 0) { + if (!entries_to_delete.empty()) { // clear the auto_update flag from the folders if the user deleted files for (const auto &folder : folders_of_deleted) {