diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp index 34248e78d0fa18fef42c306e2f42c8c2bbfc8ea7..2358e189f411dadfd0041de1d5c5bb6bb66ec20f 100644 --- a/Framework/API/src/Algorithm.cpp +++ b/Framework/API/src/Algorithm.cpp @@ -206,7 +206,7 @@ const std::vector<std::string> Algorithm::categories() const { Poco::StringTokenizer tokenizer(category(), categorySeparator(), Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY); - Poco::StringTokenizer::Iterator h = tokenizer.begin(); + auto h = tokenizer.begin(); for (; h != tokenizer.end(); ++h) { res.push_back(*h); diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp index c21455f254585879e0b78e04fc8916841c370a6a..7076e677afddb824859f2b07d0bef509154fc17f 100644 --- a/Framework/API/src/AlgorithmFactory.cpp +++ b/Framework/API/src/AlgorithmFactory.cpp @@ -39,7 +39,7 @@ AlgorithmFactoryImpl::create(const std::string &name, if (version < 0) { if (version == -1) // get latest version since not supplied { - VersionMap::const_iterator it = m_vmap.find(name); + auto it = m_vmap.find(name); if (!name.empty()) { if (it == m_vmap.end()) throw std::runtime_error("Algorithm not registered " + name); @@ -53,7 +53,7 @@ AlgorithmFactoryImpl::create(const std::string &name, try { return this->createAlgorithm(name, local_version); } catch (Kernel::Exception::NotFoundError &) { - VersionMap::const_iterator it = m_vmap.find(name); + auto it = m_vmap.find(name); if (it == m_vmap.end()) throw std::runtime_error("algorithm not registered " + name); else { @@ -79,7 +79,7 @@ void AlgorithmFactoryImpl::unsubscribe(const std::string &algorithmName, try { Kernel::DynamicFactory<Algorithm>::unsubscribe(key); // Update version map accordingly - VersionMap::iterator it = m_vmap.find(algorithmName); + auto it = m_vmap.find(algorithmName); if (it != m_vmap.end()) { int highest_version = it->second; if (highest_version > 1 && @@ -223,7 +223,7 @@ AlgorithmFactoryImpl::getKeys(bool includeHidden) const { */ int AlgorithmFactoryImpl::highestVersion( const std::string &algorithmName) const { - VersionMap::const_iterator viter = m_vmap.find(algorithmName); + auto viter = m_vmap.find(algorithmName); if (viter != m_vmap.end()) return viter->second; else { @@ -394,7 +394,7 @@ void AlgorithmFactoryImpl::fillHiddenCategories( Poco::StringTokenizer tokenizer(categoryString, ";", Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY); - Poco::StringTokenizer::Iterator h = tokenizer.begin(); + auto h = tokenizer.begin(); for (; h != tokenizer.end(); ++h) { categorySet->insert(*h); diff --git a/Framework/API/src/AlgorithmHistory.cpp b/Framework/API/src/AlgorithmHistory.cpp index c082d5fabb20a0a8a01d2e834bb6a36357090160..4e32215390c17d8e61fee2f7da79c6ccff8a34d8 100644 --- a/Framework/API/src/AlgorithmHistory.cpp +++ b/Framework/API/src/AlgorithmHistory.cpp @@ -169,7 +169,7 @@ AlgorithmHistory::getChildAlgorithmHistory(const size_t index) const { throw std::out_of_range( "AlgorithmHistory::getAlgorithmHistory() - Index out of range"); } - AlgorithmHistories::const_iterator start = m_childHistories.begin(); + auto start = m_childHistories.begin(); std::advance(start, index); return *start; } @@ -273,7 +273,7 @@ void AlgorithmHistory::saveNexus(::NeXus::File *file, int &algCount) const { file->writeData("data", algData.str()); // child algorithms - AlgorithmHistories::const_iterator histIter = m_childHistories.begin(); + auto histIter = m_childHistories.begin(); for (; histIter != m_childHistories.end(); ++histIter) { (*histIter)->saveNexus(file, algCount); } diff --git a/Framework/API/src/AlgorithmManager.cpp b/Framework/API/src/AlgorithmManager.cpp index f8fad4a35df84c2bdebd3d816d181395fd9df6ca..ca4cc1f82fdf5a47b803db578b1c6b95e0b7ae55 100644 --- a/Framework/API/src/AlgorithmManager.cpp +++ b/Framework/API/src/AlgorithmManager.cpp @@ -149,7 +149,7 @@ void AlgorithmManagerImpl::setMaxAlgorithms(int n) { */ IAlgorithm_sptr AlgorithmManagerImpl::getAlgorithm(AlgorithmID id) const { Mutex::ScopedLock _lock(this->m_managedMutex); - for (std::deque<IAlgorithm_sptr>::const_iterator a = m_managed_algs.begin(); + for (auto a = m_managed_algs.begin(); a != m_managed_algs.end(); ++a) { if ((**a).getAlgorithmID() == id) return *a; diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp index c1a77746b23d389a16f10c89c606aaa192430d24..bf89d360cfb0d336fe4d745a02a69654aa9b115b 100644 --- a/Framework/API/src/AlgorithmProxy.cpp +++ b/Framework/API/src/AlgorithmProxy.cpp @@ -148,7 +148,7 @@ void AlgorithmProxy::addObserver(const Poco::AbstractObserver &observer) const { */ void AlgorithmProxy::removeObserver( const Poco::AbstractObserver &observer) const { - std::vector<const Poco::AbstractObserver *>::iterator o = std::find( + auto o = std::find( m_externalObservers.begin(), m_externalObservers.end(), &observer); if (o != m_externalObservers.end()) m_externalObservers.erase(o); @@ -282,7 +282,7 @@ void AlgorithmProxy::dropWorkspaceReferences() { void AlgorithmProxy::addObservers() { if (!m_alg) return; - std::vector<const Poco::AbstractObserver *>::reverse_iterator o = + auto o = m_externalObservers.rbegin(); for (; o != m_externalObservers.rend(); ++o) m_alg->addObserver(**o); @@ -314,7 +314,7 @@ const std::vector<std::string> AlgorithmProxy::categories() const { Poco::StringTokenizer tokenizer(category(), categorySeparator(), Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY); - Poco::StringTokenizer::Iterator h = tokenizer.begin(); + auto h = tokenizer.begin(); for (; h != tokenizer.end(); ++h) { res.push_back(*h); diff --git a/Framework/API/src/CompositeDomainMD.cpp b/Framework/API/src/CompositeDomainMD.cpp index c6ed1a4549526228bac0bb0034025508505558f2..c0911dbc18e7770b82abe81f0e0c0b6ed1e59a02 100644 --- a/Framework/API/src/CompositeDomainMD.cpp +++ b/Framework/API/src/CompositeDomainMD.cpp @@ -33,7 +33,7 @@ CompositeDomainMD::CompositeDomainMD(IMDWorkspace_const_sptr ws, * Destructor. */ CompositeDomainMD::~CompositeDomainMD() { - std::vector<FunctionDomainMD *>::iterator it = m_domains.begin(); + auto it = m_domains.begin(); for (; it != m_domains.end(); ++it) { delete *it; } diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp index cc2c652fffb579a8086f05f21de5f029e484dbf5..8b912bf641c87c5ddd84100c8d9f09e3a2faaa91 100644 --- a/Framework/API/src/CompositeFunction.cpp +++ b/Framework/API/src/CompositeFunction.cpp @@ -419,7 +419,7 @@ void CompositeFunction::removeFunction(size_t i) { } // Shift down the function indeces for parameters - for (std::vector<size_t>::iterator it = m_IFunction.begin(); + for (auto it = m_IFunction.begin(); it != m_IFunction.end();) { if (*it == i) { @@ -475,7 +475,7 @@ void CompositeFunction::replaceFunction(size_t i, IFunction_sptr f) { // Modify function indeces: The new function may have different number of // parameters { - std::vector<size_t>::iterator itFun = + auto itFun = std::find(m_IFunction.begin(), m_IFunction.end(), i); if (itFun != m_IFunction.end()) // functions must have at least 1 parameter { diff --git a/Framework/API/src/CoordTransform.cpp b/Framework/API/src/CoordTransform.cpp index 41de5ddad71a9a9ab0c75b9d638a1666498d0214..bcf94ee15d0c06577f7b68b60535d2e630a2c9fd 100644 --- a/Framework/API/src/CoordTransform.cpp +++ b/Framework/API/src/CoordTransform.cpp @@ -50,7 +50,7 @@ CoordTransform::applyVMD(const Mantid::Kernel::VMD &inputVector) const { if (inputVector.getNumDims() != inD) throw std::runtime_error("CoordTransform::apply(): inputVector has the " "wrong number of coordinates!"); - coord_t *outArray = new coord_t[outD]; + auto outArray = new coord_t[outD]; this->apply(inputVector.getBareArray(), outArray); VMD out(outD, outArray); delete[] outArray; diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp index 62704d501404e41a88fc459c8a044e3c204e45ba..aad7b0908707879a96842d9aeb606d88450b128d 100644 --- a/Framework/API/src/ExperimentInfo.cpp +++ b/Framework/API/src/ExperimentInfo.cpp @@ -83,7 +83,7 @@ void ExperimentInfo::copyExperimentInfoFrom(const ExperimentInfo *other) { /** Clone this ExperimentInfo class into a new one */ ExperimentInfo *ExperimentInfo::cloneExperimentInfo() const { - ExperimentInfo *out = new ExperimentInfo(); + auto out = new ExperimentInfo(); out->copyExperimentInfoFrom(this); return out; } @@ -1138,9 +1138,9 @@ void ExperimentInfo::readParameterMap(const std::string ¶meterStr) { options += Poco::StringTokenizer::TOK_TRIM; Poco::StringTokenizer splitter(parameterStr, "|", options); - Poco::StringTokenizer::Iterator iend = splitter.end(); + auto iend = splitter.end(); // std::string prev_name; - for (Poco::StringTokenizer::Iterator itr = splitter.begin(); itr != iend; + for (auto itr = splitter.begin(); itr != iend; ++itr) { Poco::StringTokenizer tokens(*itr, ";"); if (tokens.count() < 4) diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp index 011dd6d1de37fb0187e93af12e4c6bdf8b95edc6..4b6a91a278596c6b31a653e365a5f5034eec23d3 100644 --- a/Framework/API/src/Expression.cpp +++ b/Framework/API/src/Expression.cpp @@ -71,7 +71,7 @@ void Expression::add_operators(const std::vector<std::string> &ops) { char j = 0; tokenizer tkz(m_operators->binary[i], " ", tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM); - for (tokenizer::Iterator it = tkz.begin(); it != tkz.end(); it++) { + for (auto it = tkz.begin(); it != tkz.end(); it++) { m_operators->precedence[*it] = i + 1; m_operators->op_number[*it] = j++; } @@ -90,7 +90,7 @@ void Expression::add_operators(const std::vector<std::string> &ops) { void Expression::add_unary(const std::set<std::string> &ops) { m_operators->unary = ops; - for (std::set<std::string>::const_iterator it = ops.begin(); it != ops.end(); + for (auto it = ops.begin(); it != ops.end(); ++it) { for (std::string::const_iterator c = it->begin(); c != it->end(); ++c) { m_operators->symbols.insert(*c); @@ -499,7 +499,7 @@ std::set<std::string> Expression::getVariables() const { out.insert(s); } } else { - for (iterator e = begin(); e != end(); ++e) { + for (auto e = begin(); e != end(); ++e) { if (e->isFunct()) { std::set<std::string> tout = e->getVariables(); out.insert(tout.begin(), tout.end()); @@ -521,7 +521,7 @@ void Expression::renameAll(const std::string &oldName, if (!isFunct() && name() == oldName) { rename(newName); } else { - std::vector<Expression>::iterator e = m_terms.begin(); + auto e = m_terms.begin(); for (; e != m_terms.end(); ++e) { e->renameAll(oldName, newName); } diff --git a/Framework/API/src/FileFinder.cpp b/Framework/API/src/FileFinder.cpp index 9539d14521829e91c8e41dff2841c2dc75459674..dd568d9ca928b57b0206e20cdfb93efbd8d385dd 100644 --- a/Framework/API/src/FileFinder.cpp +++ b/Framework/API/src/FileFinder.cpp @@ -126,7 +126,7 @@ std::string FileFinderImpl::getFullPath(const std::string &filename, const std::vector<std::string> &searchPaths = Kernel::ConfigService::Instance().getDataSearchDirs(); - std::vector<std::string>::const_iterator it = searchPaths.begin(); + auto it = searchPaths.begin(); for (; it != searchPaths.end(); ++it) { // On windows globbing is note working properly with network drives // for example a network drive containing a $ @@ -479,7 +479,7 @@ FileFinderImpl::findRun(const std::string &hintstr, tolower); if (!archiveOpt.empty() && archiveOpt != "off" && !facility.archiveSearch().empty()) { - std::vector<std::string>::const_iterator it = + auto it = facility.archiveSearch().begin(); for (; it != facility.archiveSearch().end(); ++it) { g_log.debug() << "get archive search for the facility..." << *it @@ -602,7 +602,7 @@ FileFinderImpl::findRuns(const std::string &hintstr) const { Poco::StringTokenizer hints(hint, ",", Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY); - Poco::StringTokenizer::Iterator h = hints.begin(); + auto h = hints.begin(); for (; h != hints.end(); ++h) { // Quick check for a filename @@ -686,7 +686,7 @@ FileFinderImpl::getArchivePath(const std::vector<IArchiveSearch_sptr> &archs, const std::set<std::string> &filenames, const std::vector<std::string> &exts) const { std::string path = ""; - std::vector<IArchiveSearch_sptr>::const_iterator it = archs.begin(); + auto it = archs.begin(); for (; it != archs.end(); ++it) { try { path = (*it)->getArchivePath(filenames, exts); @@ -751,7 +751,7 @@ FileFinderImpl::getPath(const std::vector<IArchiveSearch_sptr> &archs, } for (auto ext = extensions.begin(); ext != extensions.end(); ++ext) { - std::set<std::string>::const_iterator it = filenames.begin(); + auto it = filenames.begin(); for (; it != filenames.end(); ++it) { path = getFullPath(*it + *ext); try { diff --git a/Framework/API/src/FileProperty.cpp b/Framework/API/src/FileProperty.cpp index b4ab32e1b50b49c8300af84155ddd75a6e36178b..c6af2cd8c07ce83527e8cf23e1f82b9de15ddd74 100644 --- a/Framework/API/src/FileProperty.cpp +++ b/Framework/API/src/FileProperty.cpp @@ -227,9 +227,9 @@ bool FileProperty::extsMatchRunFiles() { Kernel::FacilityInfo facilityInfo = Kernel::ConfigService::Instance().getFacility(); const std::vector<std::string> facilityExts = facilityInfo.extensions(); - std::vector<std::string>::const_iterator facilityExtsBegin = + auto facilityExtsBegin = facilityExts.begin(); - std::vector<std::string>::const_iterator facilityExtsEnd = + auto facilityExtsEnd = facilityExts.end(); const std::vector<std::string> allowedExts = this->allowedValues(); diff --git a/Framework/API/src/FunctionFactory.cpp b/Framework/API/src/FunctionFactory.cpp index 29a5ec54767c1b593c9cf2e3c028f262707968d6..1fc5dd178570f20a366dc62b3d780e2c596c2e80 100644 --- a/Framework/API/src/FunctionFactory.cpp +++ b/Framework/API/src/FunctionFactory.cpp @@ -83,7 +83,7 @@ IFunction_sptr FunctionFactoryImpl::createSimple( } const std::vector<Expression> &terms = expr.terms(); - std::vector<Expression>::const_iterator term = terms.begin(); + auto term = terms.begin(); if (term->name() != "=") inputError(expr.str()); @@ -146,7 +146,7 @@ CompositeFunction_sptr FunctionFactoryImpl::createComposite( } const std::vector<Expression> &terms = expr.terms(); - std::vector<Expression>::const_iterator it = terms.begin(); + auto it = terms.begin(); const Expression &term = it->bracketsRemoved(); CompositeFunction_sptr cfun; @@ -166,7 +166,7 @@ CompositeFunction_sptr FunctionFactoryImpl::createComposite( inputError(expr.str()); } } else if (term.name() == ",") { - std::vector<Expression>::const_iterator firstTerm = term.terms().begin(); + auto firstTerm = term.terms().begin(); if (firstTerm->name() == "=") { if (firstTerm->terms()[0].name() == "composite") { cfun = boost::dynamic_pointer_cast<CompositeFunction>( diff --git a/Framework/API/src/HistoryView.cpp b/Framework/API/src/HistoryView.cpp index 927d5209cd9a961c99f239e19290a01d65d16a24..eb3f6f26d2480ba846f62fb10d180d37f40f7706 100644 --- a/Framework/API/src/HistoryView.cpp +++ b/Framework/API/src/HistoryView.cpp @@ -10,7 +10,7 @@ HistoryView::HistoryView(const WorkspaceHistory &wsHist) : m_wsHist(wsHist), m_historyItems() { // add all of the top level algorithms to the view by default const auto algorithms = wsHist.getAlgorithmHistories(); - AlgorithmHistories::const_iterator iter = algorithms.begin(); + auto iter = algorithms.begin(); for (; iter != algorithms.end(); ++iter) { HistoryItem item(*iter); m_historyItems.push_back(item); diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index e48cfb6babf4fbb4d418ad40bad2e55b705d94b9..11f9e713f3a66cb7c10a33ae2fb48369b653aebc 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -109,7 +109,7 @@ void IFunction::functionDeriv(const FunctionDomain &domain, */ ParameterTie *IFunction::tie(const std::string &parName, const std::string &expr, bool isDefault) { - ParameterTie *ti = new ParameterTie(this, parName, expr, isDefault); + auto ti = new ParameterTie(this, parName, expr, isDefault); addTie(ti); this->fix(getParameterIndex(*ti)); return ti; @@ -257,7 +257,7 @@ const std::vector<std::string> IFunction::categories() const { Poco::StringTokenizer tokenizer(category(), categorySeparator(), Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY); - Poco::StringTokenizer::Iterator h = tokenizer.begin(); + auto h = tokenizer.begin(); for (; h != tokenizer.end(); ++h) { res.push_back(*h); diff --git a/Framework/API/src/LogManager.cpp b/Framework/API/src/LogManager.cpp index 8d1cca9d42556be9cfccc2b67b5700de2e0bdb30..8c64b7672e7d0602011cf0bc2b76a35dc8c98224 100644 --- a/Framework/API/src/LogManager.cpp +++ b/Framework/API/src/LogManager.cpp @@ -395,8 +395,8 @@ void LogManager::loadNexus(::NeXus::File *file, const std::string &group, std::map<std::string, std::string> entries; file->getEntries(entries); - std::map<std::string, std::string>::iterator it = entries.begin(); - std::map<std::string, std::string>::iterator it_end = entries.end(); + auto it = entries.begin(); + auto it_end = entries.end(); for (; it != it_end; ++it) { // Get the name/class pair const std::pair<std::string, std::string> &name_class = *it; diff --git a/Framework/API/src/MDGeometry.cpp b/Framework/API/src/MDGeometry.cpp index 00a8f284dfd1a9215d4929e98df18b7c170a9dfb..a2b9794d42c6edf31ed07e14e9184805ce4b723b 100644 --- a/Framework/API/src/MDGeometry.cpp +++ b/Framework/API/src/MDGeometry.cpp @@ -146,7 +146,7 @@ Mantid::Geometry::VecIMDDimension_const_sptr MDGeometry::getNonIntegratedDimensions() const { using namespace Mantid::Geometry; VecIMDDimension_const_sptr vecCollapsedDimensions; - std::vector<Mantid::Geometry::IMDDimension_sptr>::const_iterator it = + auto it = this->m_dimensions.begin(); for (; it != this->m_dimensions.end(); ++it) { IMDDimension_sptr current = (*it); diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index 18ac772fc899e0bfa29f36df2c9ba3ee68e430df..8ae91b4963e5b939c410b74e2773238b97cdaf36 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -519,7 +519,7 @@ void MatrixWorkspace::getDetectorIDToWorkspaceIndexVector( // Allow multiple detectors per workspace index, or, // If only one is allowed, then this has thrown already - for (std::set<detid_t>::const_iterator it = detList.begin(); + for (auto it = detList.begin(); it != detList.end(); ++it) { int index = *it + offset; if (index < 0 || index >= outSize) { @@ -550,7 +550,7 @@ void MatrixWorkspace::getIndicesFromSpectra( indexList.clear(); indexList.reserve(this->getNumberHistograms()); - std::vector<specid_t>::const_iterator iter = spectraList.begin(); + auto iter = spectraList.begin(); while (iter != spectraList.end()) { for (size_t i = 0; i < this->getNumberHistograms(); ++i) { if (this->getSpectrum(i)->getSpectrumNo() == *iter) { @@ -625,8 +625,8 @@ void MatrixWorkspace::getIndicesFromDetectorIDs( void MatrixWorkspace::getSpectraFromDetectorIDs( const std::vector<detid_t> &detIdList, std::vector<specid_t> &spectraList) const { - std::vector<detid_t>::const_iterator it_start = detIdList.begin(); - std::vector<detid_t>::const_iterator it_end = detIdList.end(); + auto it_start = detIdList.begin(); + auto it_end = detIdList.end(); spectraList.clear(); @@ -1016,7 +1016,7 @@ void MatrixWorkspace::maskWorkspaceIndex(const std::size_t index) { spec->clearData(); const std::set<detid_t> dets = spec->getDetectorIDs(); - for (std::set<detid_t>::const_iterator iter = dets.begin(); + for (auto iter = dets.begin(); iter != dets.end(); ++iter) { try { if (const Geometry::Detector *det = @@ -1085,7 +1085,7 @@ void MatrixWorkspace::flagMasked(const size_t &spectrumIndex, // First get a reference to the list for this spectrum (or create a new // list) MaskList &binList = m_masks[spectrumIndex]; - MaskList::iterator it = binList.find(binIndex); + auto it = binList.find(binIndex); if (it != binList.end()) { binList.erase(it); } @@ -1113,7 +1113,7 @@ bool MatrixWorkspace::hasMaskedBins(const size_t &workspaceIndex) const { */ const MatrixWorkspace::MaskList & MatrixWorkspace::maskedBins(const size_t &workspaceIndex) const { - std::map<int64_t, MaskList>::const_iterator it = m_masks.find(workspaceIndex); + auto it = m_masks.find(workspaceIndex); // Throw if there are no masked bins for this spectrum. The caller should // check first using hasMaskedBins! if (it == m_masks.end()) { @@ -1238,7 +1238,7 @@ size_t MatrixWorkspace::binIndexOf(const double xValue, throw std::out_of_range("MatrixWorkspace::binIndexOf - X value lower than " "lowest in current range."); } - MantidVec::const_iterator lowit = + auto lowit = std::lower_bound(xValues.begin(), xValues.end(), xValue); if (lowit == xValues.end()) { throw std::out_of_range("MatrixWorkspace::binIndexOf - X value greater " @@ -1438,11 +1438,11 @@ private: boost::shared_ptr<const Mantid::Geometry::IMDDimension> MatrixWorkspace::getDimension(size_t index) const { if (index == 0) { - MWXDimension *dimension = new MWXDimension(this, xDimensionId); + auto dimension = new MWXDimension(this, xDimensionId); return boost::shared_ptr<const Mantid::Geometry::IMDDimension>(dimension); } else if (index == 1) { Axis *yAxis = this->getAxis(1); - MWDimension *dimension = new MWDimension(yAxis, yDimensionId); + auto dimension = new MWDimension(yAxis, yDimensionId); return boost::shared_ptr<const Mantid::Geometry::IMDDimension>(dimension); } else throw std::invalid_argument("MatrixWorkspace only has 2 dimensions."); @@ -1567,7 +1567,7 @@ signal_t MatrixWorkspace::getSignalAtCoord( if (wi < nhist) { const MantidVec &X = this->readX(wi); - MantidVec::const_iterator it = std::lower_bound(X.begin(), X.end(), x); + auto it = std::lower_bound(X.begin(), X.end(), x); if (it == X.end()) { // Out of range return std::numeric_limits<double>::quiet_NaN(); diff --git a/Framework/API/src/MultiPeriodGroupWorker.cpp b/Framework/API/src/MultiPeriodGroupWorker.cpp index c7382752965d72bebf4640e51e1d22236455d3f6..687c1f40ad6955ae97d99e2b57199877e30712d5 100644 --- a/Framework/API/src/MultiPeriodGroupWorker.cpp +++ b/Framework/API/src/MultiPeriodGroupWorker.cpp @@ -76,7 +76,7 @@ MultiPeriodGroupWorker::findMultiPeriodGroups( WorkspaceNameType workspaces = sourceAlg->getProperty(this->m_workspacePropertyName); - WorkspaceNameType::iterator it = workspaces.begin(); + auto it = workspaces.begin(); // Inspect all the input workspaces in the ArrayProperty input. while (it != workspaces.end()) { @@ -93,7 +93,7 @@ MultiPeriodGroupWorker::findMultiPeriodGroups( WorkspaceVector outWorkspaces; sourceAlg->findWorkspaceProperties(inWorkspaces, outWorkspaces); UNUSED_ARG(outWorkspaces); - WorkspaceVector::iterator it = inWorkspaces.begin(); + auto it = inWorkspaces.begin(); while (it != inWorkspaces.end()) { tryAddInputWorkspaceToInputGroups(*it, vecWorkspaceGroups); ++it; diff --git a/Framework/API/src/MultipleFileProperty.cpp b/Framework/API/src/MultipleFileProperty.cpp index 62c59bdbc3b559e075ef83d6a74c1940a6186daf..fb64057def96c02301284499fb79b33272780a40 100644 --- a/Framework/API/src/MultipleFileProperty.cpp +++ b/Framework/API/src/MultipleFileProperty.cpp @@ -154,7 +154,7 @@ std::vector<std::string> MultipleFileProperty::flattenFileNames( const std::vector<std::vector<std::string>> &fileNames) { std::vector<std::string> flattenedFileNames; - std::vector<std::vector<std::string>>::const_iterator it = fileNames.begin(); + auto it = fileNames.begin(); for (; it != fileNames.end(); ++it) { flattenedFileNames.insert(flattenedFileNames.end(), it->begin(), it->end()); diff --git a/Framework/API/src/NumericAxis.cpp b/Framework/API/src/NumericAxis.cpp index c5fa1673f89dd9f3ac75d22181e85344eee5b6d8..f2003d68f13f6fd94c6bfc6ca5e2a160ddcbe329 100644 --- a/Framework/API/src/NumericAxis.cpp +++ b/Framework/API/src/NumericAxis.cpp @@ -97,7 +97,7 @@ Axis *NumericAxis::clone(const MatrixWorkspace *const parentWorkspace) { Axis *NumericAxis::clone(const std::size_t length, const MatrixWorkspace *const parentWorkspace) { UNUSED_ARG(parentWorkspace) - NumericAxis *newAxis = new NumericAxis(*this); + auto newAxis = new NumericAxis(*this); newAxis->m_values.clear(); newAxis->m_values.resize(length); newAxis->m_edges.clear(); diff --git a/Framework/API/src/ParamFunction.cpp b/Framework/API/src/ParamFunction.cpp index 758bad29275d07767644ab9eea772e3d2ac593a8..4f109deabb848523862d653314af86c02eb87b55 100644 --- a/Framework/API/src/ParamFunction.cpp +++ b/Framework/API/src/ParamFunction.cpp @@ -21,12 +21,12 @@ Kernel::Logger g_log("ParamFunction"); /// Destructor ParamFunction::~ParamFunction() { - for (std::vector<ParameterTie *>::iterator it = m_ties.begin(); + for (auto it = m_ties.begin(); it != m_ties.end(); ++it) { delete *it; } m_ties.clear(); - for (std::vector<IConstraint *>::iterator it = m_constraints.begin(); + for (auto it = m_constraints.begin(); it != m_constraints.end(); ++it) { delete *it; } @@ -151,7 +151,7 @@ void ParamFunction::setParameterDescription(const std::string &name, double ParamFunction::getParameter(const std::string &name) const { std::string ucName(name); // std::transform(name.begin(), name.end(), ucName.begin(), toupper); - std::vector<std::string>::const_iterator it = + auto it = std::find(m_parameterNames.begin(), m_parameterNames.end(), ucName); if (it == m_parameterNames.end()) { std::ostringstream msg; @@ -182,7 +182,7 @@ double ParamFunction::getParameter(const std::string &name) const { size_t ParamFunction::parameterIndex(const std::string &name) const { std::string ucName(name); // std::transform(name.begin(), name.end(), ucName.begin(), toupper); - std::vector<std::string>::const_iterator it = + auto it = std::find(m_parameterNames.begin(), m_parameterNames.end(), ucName); if (it == m_parameterNames.end()) { std::ostringstream msg; @@ -319,7 +319,7 @@ void ParamFunction::addTie(ParameterTie *tie) { * Apply the ties. */ void ParamFunction::applyTies() { - for (std::vector<ParameterTie *>::iterator tie = m_ties.begin(); + for (auto tie = m_ties.begin(); tie != m_ties.end(); ++tie) { (**tie).eval(); } @@ -349,7 +349,7 @@ bool ParamFunction::removeTie(size_t i) { if (i >= nParams()) { throw std::out_of_range("ParamFunction parameter index out of range."); } - std::vector<ParameterTie *>::iterator it = + auto it = std::find_if(m_ties.begin(), m_ties.end(), ReferenceEqual(i)); if (it != m_ties.end()) { delete *it; @@ -368,7 +368,7 @@ ParameterTie *ParamFunction::getTie(size_t i) const { if (i >= nParams()) { throw std::out_of_range("ParamFunction parameter index out of range."); } - std::vector<ParameterTie *>::const_iterator it = + auto it = std::find_if(m_ties.begin(), m_ties.end(), ReferenceEqual(i)); if (it != m_ties.end()) { return *it; @@ -379,7 +379,7 @@ ParameterTie *ParamFunction::getTie(size_t i) const { /** Remove all ties */ void ParamFunction::clearTies() { - for (std::vector<ParameterTie *>::iterator it = m_ties.begin(); + for (auto it = m_ties.begin(); it != m_ties.end(); ++it) { size_t i = getParameterIndex(**it); unfix(i); @@ -416,7 +416,7 @@ IConstraint *ParamFunction::getConstraint(size_t i) const { if (i >= nParams()) { throw std::out_of_range("ParamFunction parameter index out of range."); } - std::vector<IConstraint *>::const_iterator it = std::find_if( + auto it = std::find_if( m_constraints.begin(), m_constraints.end(), ReferenceEqual(i)); if (it != m_constraints.end()) { return *it; @@ -429,7 +429,7 @@ IConstraint *ParamFunction::getConstraint(size_t i) const { */ void ParamFunction::removeConstraint(const std::string &parName) { size_t iPar = parameterIndex(parName); - for (std::vector<IConstraint *>::iterator it = m_constraints.begin(); + for (auto it = m_constraints.begin(); it != m_constraints.end(); ++it) { if (iPar == (**it).getIndex()) { delete *it; @@ -447,12 +447,12 @@ void ParamFunction::setUpForFit() { /// Nonvirtual member which removes all declared parameters void ParamFunction::clearAllParameters() { - for (std::vector<ParameterTie *>::iterator it = m_ties.begin(); + for (auto it = m_ties.begin(); it != m_ties.end(); ++it) { delete *it; } m_ties.clear(); - for (std::vector<IConstraint *>::iterator it = m_constraints.begin(); + for (auto it = m_constraints.begin(); it != m_constraints.end(); ++it) { delete *it; } diff --git a/Framework/API/src/ParameterTie.cpp b/Framework/API/src/ParameterTie.cpp index e53321c996c5b937ad2800437ce050e5dcd9908e..3ee93489abca717f89ecf8e16237fc8b7d463fe7 100644 --- a/Framework/API/src/ParameterTie.cpp +++ b/Framework/API/src/ParameterTie.cpp @@ -48,7 +48,7 @@ double *ParameterTie::AddVariable(const char *varName, void *palg) { ParameterReference ref(tie.m_function1, tie.m_function1->parameterIndex(std::string(varName))); - double *var = new double; + auto var = new double; *var = 0; tie.m_varMap[var] = ref; @@ -152,7 +152,7 @@ std::string ParameterTie::asString(const IFunction *fun) const { int iTemp = boost::lexical_cast<int>(res[1]); int i = 0; - for (std::map<double *, ParameterReference>::const_iterator it = + for (auto it = m_varMap.begin(); it != m_varMap.end(); ++it) { if (i == iTemp) { @@ -178,7 +178,7 @@ std::string ParameterTie::asString(const IFunction *fun) const { * @return True if any of the parameters is used as a variable in the mu::Parser */ bool ParameterTie::findParametersOf(const IFunction *fun) const { - for (std::map<double *, ParameterReference>::const_iterator it = + for (auto it = m_varMap.begin(); it != m_varMap.end(); ++it) { if (it->second.getFunction() == fun) { diff --git a/Framework/API/src/PropertyNexus.cpp b/Framework/API/src/PropertyNexus.cpp index 87f097bea0d999cd9630149e0f7b6df8f50bdbc0..f8241fd7564bfee85885e2e84fe407ade4b2cae3 100644 --- a/Framework/API/src/PropertyNexus.cpp +++ b/Framework/API/src/PropertyNexus.cpp @@ -48,7 +48,7 @@ Property *makeProperty(::NeXus::File *file, const std::string &name, return new ArrayProperty<NumT>(name, values); } } else { - TimeSeriesProperty<NumT> *prop = new TimeSeriesProperty<NumT>(name); + auto prop = new TimeSeriesProperty<NumT>(name); prop->addValues(times, values); return prop; } @@ -71,7 +71,7 @@ Property *makeTimeSeriesBoolProperty(::NeXus::File *file, for (size_t i = 0; i < nvals; ++i) { realValues[i] = (savedValues[i] != 0); } - TimeSeriesProperty<bool> *prop = new TimeSeriesProperty<bool>(name); + auto prop = new TimeSeriesProperty<bool>(name); prop->addValues(times, realValues); return prop; } @@ -95,7 +95,7 @@ Property *makeStringProperty(::NeXus::File *file, const std::string &name, for (int i = 0; i < numStrings; i++) values.push_back(std::string(data.get() + i * span)); - TimeSeriesProperty<std::string> *prop = + auto prop = new TimeSeriesProperty<std::string>(name); prop->addValues(times, values); return prop; @@ -293,7 +293,7 @@ void saveTimeSeriesPropertyString(::NeXus::File *file, // Increment by 1 to have the 0 terminator maxlen++; // Copy into one array - char *strs = new char[values.size() * maxlen]; + auto strs = new char[values.size() * maxlen]; memset(strs, 0, values.size() * maxlen); for (size_t i = 0; i < values.size(); i++) strncpy(&strs[i * maxlen], values[i].c_str(), values[i].size()); diff --git a/Framework/API/src/RefAxis.cpp b/Framework/API/src/RefAxis.cpp index 73f1ce02e572060321f2aacc4d663b30adad299e..f60f806ed7fbe14b7394474de3b59c8cf90ee637 100644 --- a/Framework/API/src/RefAxis.cpp +++ b/Framework/API/src/RefAxis.cpp @@ -42,7 +42,7 @@ Axis *RefAxis::clone(const MatrixWorkspace *const parentWorkspace) { Axis *RefAxis::clone(const std::size_t length, const MatrixWorkspace *const parentWorkspace) { - RefAxis *newAxis = new RefAxis(*this, parentWorkspace); + auto newAxis = new RefAxis(*this, parentWorkspace); newAxis->m_size = length; return newAxis; } diff --git a/Framework/API/src/Run.cpp b/Framework/API/src/Run.cpp index 778068158850c4f3cd273738a3738f4ff3df84e1..63c9656e70568c4146cdd66e432affa36be10f47 100644 --- a/Framework/API/src/Run.cpp +++ b/Framework/API/src/Run.cpp @@ -398,8 +398,8 @@ void Run::loadNexus(::NeXus::File *file, const std::string &group, std::map<std::string, std::string> entries; file->getEntries(entries); - std::map<std::string, std::string>::iterator it = entries.begin(); - std::map<std::string, std::string>::iterator it_end = entries.end(); + auto it = entries.begin(); + auto it_end = entries.end(); for (; it != it_end; ++it) { // Get the name/class pair const std::pair<std::string, std::string> &name_class = *it; @@ -508,8 +508,8 @@ void Run::mergeMergables(Mantid::Kernel::PropertyManager &sum, // get pointers to all the properties on the right-handside and prepare to // loop through them const std::vector<Property *> inc = toAdd.getProperties(); - std::vector<Property *>::const_iterator end = inc.end(); - for (std::vector<Property *>::const_iterator it = inc.begin(); it != end; + auto end = inc.end(); + for (auto it = inc.begin(); it != end; ++it) { const std::string rhs_name = (*it)->name(); try { diff --git a/Framework/API/src/SpectraAxis.cpp b/Framework/API/src/SpectraAxis.cpp index 43db4d278296bde473f968c07439ed419dac33ca..c89d9ee59a2501ddb2c34ee21b0b6447b9dd4734 100644 --- a/Framework/API/src/SpectraAxis.cpp +++ b/Framework/API/src/SpectraAxis.cpp @@ -28,7 +28,7 @@ SpectraAxis::SpectraAxis(const MatrixWorkspace *const parentWorkspace) * @return A pointer to a copy of the SpectraAxis on which the method is called */ Axis *SpectraAxis::clone(const MatrixWorkspace *const parentWorkspace) { - SpectraAxis *newAxis = new SpectraAxis(parentWorkspace); + auto newAxis = new SpectraAxis(parentWorkspace); // A couple of base class members need copying over manually newAxis->title() = this->title(); newAxis->unit() = this->unit(); diff --git a/Framework/API/src/TableRow.cpp b/Framework/API/src/TableRow.cpp index 7b2ba2e77b3db4f613b193d036127ddd319dce0c..20abd169f2cc80dd507f257754b1616a1c7e6123 100644 --- a/Framework/API/src/TableRow.cpp +++ b/Framework/API/src/TableRow.cpp @@ -75,7 +75,7 @@ std::ostream &operator<<(std::ostream &s, const TableRow &row) { row.m_columns[0]->print(row.row(), s); return s; } - std::vector<boost::shared_ptr<Column>>::const_iterator ci = + auto ci = row.m_columns.begin(); for (; ci != row.m_columns.end() - 1; ++ci) { (*ci)->print(row.row(), s); diff --git a/Framework/API/src/TextAxis.cpp b/Framework/API/src/TextAxis.cpp index c9ab791c7f0dfc531471c6c26586917d7b4f0ea2..8cc544998116740cac743ee65e9b084c26519d0e 100644 --- a/Framework/API/src/TextAxis.cpp +++ b/Framework/API/src/TextAxis.cpp @@ -27,7 +27,7 @@ Axis *TextAxis::clone(const MatrixWorkspace *const parentWorkspace) { Axis *TextAxis::clone(const std::size_t length, const MatrixWorkspace *const parentWorkspace) { UNUSED_ARG(parentWorkspace) - TextAxis *newAxis = new TextAxis(*this); + auto newAxis = new TextAxis(*this); newAxis->m_values.clear(); newAxis->m_values.resize(length); return newAxis; diff --git a/Framework/API/src/WorkspaceGroup.cpp b/Framework/API/src/WorkspaceGroup.cpp index 8f8c3d9bab5b6384ed7c61c953e7b66ce9d97c3e..8fcf6d64bdb442d3c08356fff5dc72e756ccec98 100644 --- a/Framework/API/src/WorkspaceGroup.cpp +++ b/Framework/API/src/WorkspaceGroup.cpp @@ -330,7 +330,7 @@ bool WorkspaceGroup::isMultiperiod() const { g_log.debug("Not a multiperiod-group with < 1 nested workspace."); return false; } - std::vector<Workspace_sptr>::const_iterator iterator = m_workspaces.begin(); + auto iterator = m_workspaces.begin(); // Loop through all inner workspaces, checking each one in turn. while (iterator != m_workspaces.end()) { if (MatrixWorkspace_sptr ws = diff --git a/Framework/API/src/WorkspaceHistory.cpp b/Framework/API/src/WorkspaceHistory.cpp index 94bb24122e2785c1ab04d21948990c75739d15ef..246672271ee1b474e068b3fc3fc8af28e796f11a 100644 --- a/Framework/API/src/WorkspaceHistory.cpp +++ b/Framework/API/src/WorkspaceHistory.cpp @@ -95,7 +95,7 @@ WorkspaceHistory::getAlgorithmHistory(const size_t index) const { throw std::out_of_range( "WorkspaceHistory::getAlgorithmHistory() - Index out of range"); } - AlgorithmHistories::const_iterator start = m_algorithms.begin(); + auto start = m_algorithms.begin(); std::advance(start, index); return *start; } @@ -180,7 +180,7 @@ void WorkspaceHistory::saveNexus(::NeXus::File *file) const { // Algorithm History int algCount = 0; - AlgorithmHistories::const_iterator histIter = m_algorithms.begin(); + auto histIter = m_algorithms.begin(); for (; histIter != m_algorithms.end(); ++histIter) { (*histIter)->saveNexus(file, algCount); } diff --git a/Framework/Algorithms/src/AbsorptionCorrection.cpp b/Framework/Algorithms/src/AbsorptionCorrection.cpp index 70903dcf3d193cf3f527a6a774439b6142389e40..ea20962d3c637bae904a586b5c648e59fcf88eff 100644 --- a/Framework/Algorithms/src/AbsorptionCorrection.cpp +++ b/Framework/Algorithms/src/AbsorptionCorrection.cpp @@ -135,7 +135,7 @@ void AbsorptionCorrection::exec() { // If sample not at origin, shift cached positions. const V3D samplePos = m_inputWS->getInstrument()->getSample()->getPos(); if (samplePos != V3D(0, 0, 0)) { - std::vector<V3D>::iterator it = m_elementPositions.begin(); + auto it = m_elementPositions.begin(); for (; it != m_elementPositions.end(); ++it) { (*it) += samplePos; } diff --git a/Framework/Algorithms/src/AddLogDerivative.cpp b/Framework/Algorithms/src/AddLogDerivative.cpp index 448e0a2770566c0f3c615c42d82768651a01bfea..751efd76600ae066567e8d767afba09f344012e4 100644 --- a/Framework/Algorithms/src/AddLogDerivative.cpp +++ b/Framework/Algorithms/src/AddLogDerivative.cpp @@ -107,7 +107,7 @@ Mantid::Kernel::TimeSeriesProperty<double> *AddLogDerivative::makeDerivative( timeFull.push_back(start + times[i]); // Create the TSP out of it - Mantid::Kernel::TimeSeriesProperty<double> *out = + auto out = new TimeSeriesProperty<double>(name); out->addValues(timeFull, values); return out; diff --git a/Framework/Algorithms/src/AverageLogData.cpp b/Framework/Algorithms/src/AverageLogData.cpp index 62c6a9c890bbf16fe069b84133c99850f913be5a..8bb9f2edbfbccbe9aa1adc0dbf93052eeb990df3 100644 --- a/Framework/Algorithms/src/AverageLogData.cpp +++ b/Framework/Algorithms/src/AverageLogData.cpp @@ -91,7 +91,7 @@ void AverageLogData::exec() { pctime.push_back(EMPTY_DBL() * 1.1); // larger than stime pcvalue.push_back(0.0); - std::vector<double>::iterator istime = stime.begin(), + auto istime = stime.begin(), isvalue = svalue.begin(), ipctime = pctime.begin(), ipcvalue = pcvalue.begin(); diff --git a/Framework/Algorithms/src/BinaryOperation.cpp b/Framework/Algorithms/src/BinaryOperation.cpp index 48c6d13bbb4cab8670cc8835604d20cf142c6206..086550482a78126b55094a3c0cbfecd45a87b323 100644 --- a/Framework/Algorithms/src/BinaryOperation.cpp +++ b/Framework/Algorithms/src/BinaryOperation.cpp @@ -1040,12 +1040,12 @@ BinaryOperation::buildBinaryOperationTable( // Didn't find it. Try to use the RHS map. // First, we have to get the (single) detector ID of the LHS - std::set<detid_t>::const_iterator lhsDets_it = lhsDets.begin(); + auto lhsDets_it = lhsDets.begin(); detid_t lhs_detector_ID = *lhsDets_it; // Now we use the RHS map to find it. This only works if both the lhs and // rhs have 1 detector per pixel - detid2index_map::const_iterator map_it = + auto map_it = rhs_det_to_wi.find(lhs_detector_ID); if (map_it != rhs_det_to_wi.end()) { rhsWI = map_it->second; // This is the workspace index in the RHS that diff --git a/Framework/Algorithms/src/ChangeLogTime.cpp b/Framework/Algorithms/src/ChangeLogTime.cpp index a42d58d76769cb5da8fd40d4cbaad43b3d1549cd..948439a1f243e8d1fd01bd29831804ae60fd2889 100644 --- a/Framework/Algorithms/src/ChangeLogTime.cpp +++ b/Framework/Algorithms/src/ChangeLogTime.cpp @@ -71,7 +71,7 @@ void ChangeLogTime::exec() { } // Create the new log - TimeSeriesProperty<double> *newlog = new TimeSeriesProperty<double>(logname); + auto newlog = new TimeSeriesProperty<double>(logname); newlog->setUnits(oldlog->units()); int size = oldlog->realSize(); vector<double> values = oldlog->valuesAsVector(); diff --git a/Framework/Algorithms/src/ChopData.cpp b/Framework/Algorithms/src/ChopData.cpp index e91cfd667fdea8c167369e2b6cb0f9bf5fad8b2b..e071d2db176e90e6236023e44f389f608385c173 100644 --- a/Framework/Algorithms/src/ChopData.cpp +++ b/Framework/Algorithms/src/ChopData.cpp @@ -90,7 +90,7 @@ void ChopData::exec() { progress->report(); } - std::map<int, double>::iterator nlow = intMap.find(lowest - 1); + auto nlow = intMap.find(lowest - 1); if (nlow != intMap.end() && intMap[lowest] < (0.1 * nlow->second)) { prelow = nlow->first; } diff --git a/Framework/Algorithms/src/CompareWorkspaces.cpp b/Framework/Algorithms/src/CompareWorkspaces.cpp index 99fa4a5c5d57ffa9dcf68cf4edc6c8649a05eeca..586bb18fb14be0eb864b48461dbc23b17fbc62aa 100644 --- a/Framework/Algorithms/src/CompareWorkspaces.cpp +++ b/Framework/Algorithms/src/CompareWorkspaces.cpp @@ -741,8 +741,8 @@ bool CompareWorkspaces::checkSpectraMap(MatrixWorkspace_const_sptr ws1, recordMismatch(out.str()); return false; } - std::set<detid_t>::const_iterator it1 = spec1->getDetectorIDs().begin(); - std::set<detid_t>::const_iterator it2 = spec2->getDetectorIDs().begin(); + auto it1 = spec1->getDetectorIDs().begin(); + auto it2 = spec2->getDetectorIDs().begin(); for (; it1 != spec1->getDetectorIDs().end(); ++it1, ++it2) { if (*it1 != *it2) { recordMismatch("Detector IDs mismatch"); diff --git a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp index eb31dc324bc890430ec12db758ff1a343bc1d57b..77b7a209f5df67c0a4e515e94df82f327ad8da35 100644 --- a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp +++ b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp @@ -202,7 +202,7 @@ void ConvertAxesToRealSpace::exec() { yRef.resize(axisVector[1].bins); fillAxisValues(yRef, axisVector[1], false); - NumericAxis *const yAxis = new NumericAxis(yRef); + auto const yAxis = new NumericAxis(yRef); boost::shared_ptr<Units::Label> ylabel = boost::dynamic_pointer_cast<Units::Label>( UnitFactory::Instance().create("Label")); diff --git a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp index d9cca8541838325f4875209f8c13755c20e3d4b2..b96a7de9c9b50dbdf41f0f0336c5c928c9cd321b 100644 --- a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp +++ b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp @@ -150,7 +150,7 @@ void ConvertSpectrumAxis::exec() { inputWS, indexMap.size(), nxBins, nBins); // Now set up a new, numeric axis holding the theta values corresponding to // each spectrum - NumericAxis *const newAxis = new NumericAxis(indexMap.size()); + auto const newAxis = new NumericAxis(indexMap.size()); outputWS->replaceAxis(1, newAxis); // The unit of this axis is radians. Use the 'radians' unit defined above. if (unitTarget == "theta" || unitTarget == "signed_theta") { diff --git a/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp b/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp index 019212911c32495bf2bef70c485c503200e31b45..9c7eb77b14d8e463fdf103ad4f54da74d242ddd3 100644 --- a/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp +++ b/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp @@ -210,7 +210,7 @@ MatrixWorkspace_sptr ConvertSpectrumAxis2::createOutputWorkspace( // Now set up a new numeric axis holding the theta values corresponding to // each spectrum. - NumericAxis *const newAxis = new NumericAxis(m_indexMap.size()); + auto const newAxis = new NumericAxis(m_indexMap.size()); outputWorkspace->replaceAxis(1, newAxis); progress.setNumSteps(nHist + m_indexMap.size()); diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp index 43d213c3a6c8972cf2592e40755b08aa57766444..2c61cb3ad358f8ee74fa478a467f343b1bb3ebb3 100644 --- a/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Framework/Algorithms/src/ConvertUnits.cpp @@ -684,7 +684,7 @@ API::MatrixWorkspace_sptr ConvertUnits::removeUnphysicalBins( } // Get an X spectrum to search (they're all the same, monitors excepted) const MantidVec &X0 = workspace->readX(i); - MantidVec::const_iterator start = + auto start = std::lower_bound(X0.begin(), X0.end(), -1.0e-10 * DBL_MAX); if (start == X0.end()) { const std::string e("Check the input EFixed: the one given leads to all " @@ -717,7 +717,7 @@ API::MatrixWorkspace_sptr ConvertUnits::removeUnphysicalBins( int maxBins = 0; for (size_t i = 0; i < numSpec; ++i) { const MantidVec &X = workspace->readX(i); - MantidVec::const_iterator end = + auto end = std::lower_bound(X.begin(), X.end(), 1.0e-10 * DBL_MAX); MantidVec::difference_type bins = end - X.begin(); lastBins[i] = bins; diff --git a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp index a97fdd6433e02909ae3d290f4dbba4672ff00575..93b9cd1c4daa587c8d2ab92c5fc4406c748181f2 100644 --- a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp +++ b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp @@ -647,7 +647,7 @@ API::MatrixWorkspace_sptr ConvertUnitsUsingDetectorTable::removeUnphysicalBins( } // Get an X spectrum to search (they're all the same, monitors excepted) const MantidVec &X0 = workspace->readX(i); - MantidVec::const_iterator start = + auto start = std::lower_bound(X0.begin(), X0.end(), -1.0e-10 * DBL_MAX); if (start == X0.end()) { const std::string e("Check the input EFixed: the one given leads to all " @@ -680,7 +680,7 @@ API::MatrixWorkspace_sptr ConvertUnitsUsingDetectorTable::removeUnphysicalBins( int maxBins = 0; for (size_t i = 0; i < numSpec; ++i) { const MantidVec &X = workspace->readX(i); - MantidVec::const_iterator end = + auto end = std::lower_bound(X.begin(), X.end(), 1.0e-10 * DBL_MAX); MantidVec::difference_type bins = end - X.begin(); lastBins[i] = bins; diff --git a/Framework/Algorithms/src/CorrectToFile.cpp b/Framework/Algorithms/src/CorrectToFile.cpp index ba84dafe7397c1124e862695a511cc87823df119..4b65e2d4325ed147a1ded2a2880739e2784d440a 100644 --- a/Framework/Algorithms/src/CorrectToFile.cpp +++ b/Framework/Algorithms/src/CorrectToFile.cpp @@ -97,7 +97,7 @@ void CorrectToFile::exec() { const double currentX = histogramData ? (xIn[j] + xIn[j + 1]) / 2.0 : xIn[j]; // Find out the index of the first correction point after this value - MantidVec::const_iterator pos = + auto pos = std::lower_bound(Xcor.begin(), Xcor.end(), currentX); const size_t index = pos - Xcor.begin(); if (index == Xcor.size()) { diff --git a/Framework/Algorithms/src/CreateCalFileByNames.cpp b/Framework/Algorithms/src/CreateCalFileByNames.cpp index 5fce447687eb61314466cdaa481a316473960879..0effd908e38cf04f5601dbb83c02232548571932 100644 --- a/Framework/Algorithms/src/CreateCalFileByNames.cpp +++ b/Framework/Algorithms/src/CreateCalFileByNames.cpp @@ -80,7 +80,7 @@ void CreateCalFileByNames::exec() { // Assign incremental number to each group std::map<std::string, int> group_map; int index = 0; - for (std::vector<std::string>::iterator it = vgroups.begin(); + for (auto it = vgroups.begin(); it != vgroups.end(); ++it) { boost::trim(*it); group_map[(*it)] = ++index; @@ -212,7 +212,7 @@ void CreateCalFileByNames::saveGroupingFile(const std::string &filename, continue; std::istringstream istr(str); istr >> number >> udet >> offset >> select >> group; - instrcalmap::const_iterator it = instrcalib.find(udet); + auto it = instrcalib.find(udet); if (it == instrcalib.end()) // Not found, don't assign a group group = 0; else @@ -222,7 +222,7 @@ void CreateCalFileByNames::saveGroupingFile(const std::string &filename, } } else // { - instrcalmap::const_iterator it = instrcalib.begin(); + auto it = instrcalib.begin(); for (; it != instrcalib.end(); ++it) writeCalEntry(outfile, (*it).first, ((*it).second).first, 0.0, 1, ((*it).second).second); diff --git a/Framework/Algorithms/src/CreateDummyCalFile.cpp b/Framework/Algorithms/src/CreateDummyCalFile.cpp index a13e9ba5626e143f39053f6c44d5f3dea6f87ca6..146b18051fe328a442524247c4ed2afc84cef177 100644 --- a/Framework/Algorithms/src/CreateDummyCalFile.cpp +++ b/Framework/Algorithms/src/CreateDummyCalFile.cpp @@ -213,7 +213,7 @@ void CreateDummyCalFile::saveGroupingFile(const std::string &filename, continue; std::istringstream istr(str); istr >> number >> udet >> offset >> select >> group; - instrcalmap::const_iterator it = instrcalib.find(udet); + auto it = instrcalib.find(udet); if (it == instrcalib.end()) // Not found, don't assign a group group = 0; else @@ -223,7 +223,7 @@ void CreateDummyCalFile::saveGroupingFile(const std::string &filename, } } else // { - instrcalmap::const_iterator it = instrcalib.begin(); + auto it = instrcalib.begin(); for (; it != instrcalib.end(); ++it) writeCalEntry(outfile, (*it).first, ((*it).second).first, 0.0, 1, ((*it).second).second); diff --git a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp index f7298150d39597c705b27f052e90f475acd25adc..1351abf30617d6d9341127ffbf97b3c870079bbe 100644 --- a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp +++ b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp @@ -246,7 +246,7 @@ void makeGroupingByNames(std::string GroupNames, Instrument_const_sptr inst, // Trim and assign incremental number to each group std::map<std::string, int> group_map; int index = 0; - for (std::vector<std::string>::iterator it = vgroups.begin(); + for (auto it = vgroups.begin(); it != vgroups.end(); ++it) { boost::trim(*it); group_map[(*it)] = ++index; diff --git a/Framework/Algorithms/src/CreatePSDBleedMask.cpp b/Framework/Algorithms/src/CreatePSDBleedMask.cpp index 2fd9defd92d2203d704c371cdfba9f7948e562ab..e23d67bd08519f1f1c1b6d515a46ab87d6ca57fc 100644 --- a/Framework/Algorithms/src/CreatePSDBleedMask.cpp +++ b/Framework/Algorithms/src/CreatePSDBleedMask.cpp @@ -162,7 +162,7 @@ void CreatePSDBleedMask::exec() { PARALLEL_FOR2(inputWorkspace, outputWorkspace) for (int i = 0; i < numTubes; ++i) { PARALLEL_START_INTERUPT_REGION - TubeIndex::iterator current = tubeMap.begin(); + auto current = tubeMap.begin(); std::advance(current, i); const TubeIndex::mapped_type tubeIndices = current->second; bool mask = performBleedTest(tubeIndices, inputWorkspace, maxRate, @@ -270,8 +270,8 @@ void CreatePSDBleedMask::maskTube(const std::vector<int> &tubeIndices, API::MatrixWorkspace_sptr workspace) { const double deadValue(1.0); // delete the data - std::vector<int>::const_iterator cend = tubeIndices.end(); - for (std::vector<int>::const_iterator citr = tubeIndices.begin(); + auto cend = tubeIndices.end(); + for (auto citr = tubeIndices.begin(); citr != cend; ++citr) { workspace->dataY(*citr)[0] = deadValue; } diff --git a/Framework/Algorithms/src/CreateWorkspace.cpp b/Framework/Algorithms/src/CreateWorkspace.cpp index de34cb087ff56d509e06d675f96bf7da654d1ea6..9c76dfc2ed4464b77021740398913a816062add6 100644 --- a/Framework/Algorithms/src/CreateWorkspace.cpp +++ b/Framework/Algorithms/src/CreateWorkspace.cpp @@ -203,7 +203,7 @@ void CreateWorkspace::exec() { // mapping if (vUnit != "SpectraNumber") { if (vUnit == "Text") { - TextAxis *const newAxis = new TextAxis(vAxis.size()); + auto const newAxis = new TextAxis(vAxis.size()); outputWS->replaceAxis(1, newAxis); for (size_t i = 0; i < vAxis.size(); i++) { newAxis->setLabel(i, vAxis[i]); diff --git a/Framework/Algorithms/src/CrossCorrelate.cpp b/Framework/Algorithms/src/CrossCorrelate.cpp index d6d5138ac023799cec4189fdd9c504078c0804dd..8ae86eaf84fa9da7d2033a538cc1b55e8d052f2b 100644 --- a/Framework/Algorithms/src/CrossCorrelate.cpp +++ b/Framework/Algorithms/src/CrossCorrelate.cpp @@ -72,12 +72,12 @@ void CrossCorrelate::exec() { // Now check if the range between x_min and x_max is valid const MantidVec &referenceX = inputWS->readX(index_ref); - MantidVec::const_iterator minIt = + auto minIt = std::find_if(referenceX.begin(), referenceX.end(), std::bind2nd(std::greater<double>(), xmin)); if (minIt == referenceX.end()) throw std::runtime_error("No daWorkspaceIndexMaxta above XMin"); - MantidVec::const_iterator maxIt = std::find_if( + auto maxIt = std::find_if( minIt, referenceX.end(), std::bind2nd(std::greater<double>(), xmax)); if (minIt == maxIt) throw std::runtime_error("Range is not valid"); @@ -147,8 +147,8 @@ void CrossCorrelate::exec() { VectorHelper::SumSquares<double>()); refMean /= static_cast<double>(nY); refMeanE2 /= static_cast<double>(nY * nY); - std::vector<double>::iterator itY = refY.begin(); - std::vector<double>::iterator itE = refE.begin(); + auto itY = refY.begin(); + auto itE = refE.begin(); double refVar = 0.0, refVarE = 0.0; for (; itY != refY.end(); ++itY, ++itE) { diff --git a/Framework/Algorithms/src/DetectorEfficiencyCor.cpp b/Framework/Algorithms/src/DetectorEfficiencyCor.cpp index 1f54beb297d1d194a8649c56590e155aebb0b7de..25c35100cd6caab8d3fd997004580d57118ecc12 100644 --- a/Framework/Algorithms/src/DetectorEfficiencyCor.cpp +++ b/Framework/Algorithms/src/DetectorEfficiencyCor.cpp @@ -212,8 +212,8 @@ void DetectorEfficiencyCor::correctForEfficiency(int64_t spectraIn) { // Storage for the reciprocal wave vectors that are calculated as the // correction proceeds std::vector<double> oneOverWaveVectors(yValues.size()); - std::set<detid_t>::const_iterator iend = dets.end(); - for (std::set<detid_t>::const_iterator it = dets.begin(); it != iend; ++it) { + auto iend = dets.end(); + for (auto it = dets.begin(); it != iend; ++it) { IDetector_const_sptr det_member = m_inputWS->getInstrument()->getDetector(*it); @@ -250,12 +250,12 @@ void DetectorEfficiencyCor::correctForEfficiency(int64_t spectraIn) { const double det_const = g_helium_prefactor * (detRadius - wallThickness) * atms / sinTheta; - MantidVec::const_iterator yinItr = yValues.begin(); - MantidVec::const_iterator einItr = eValues.begin(); - MantidVec::iterator youtItr = yout.begin(); - MantidVec::iterator eoutItr = eout.begin(); - MantidVec::const_iterator xItr = m_inputWS->readX(spectraIn).begin(); - std::vector<double>::iterator wavItr = oneOverWaveVectors.begin(); + auto yinItr = yValues.begin(); + auto einItr = eValues.begin(); + auto youtItr = yout.begin(); + auto eoutItr = eout.begin(); + auto xItr = m_inputWS->readX(spectraIn).begin(); + auto wavItr = oneOverWaveVectors.begin(); for (; youtItr != yout.end(); ++youtItr, ++eoutItr) { if (it == dets.begin()) { diff --git a/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp b/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp index 35f01d9ab32b06457b07900e2006ccb368f49e53..e041671cff52340f64e4ea8b3cbb735937fbd8ae 100644 --- a/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp +++ b/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp @@ -201,8 +201,8 @@ MantidVec DetectorEfficiencyCorUser::calculateEfficiency( std::min(std::abs(*std::min_element(xIn.begin(), xIn.end())), m_Ei) < m_Ei; - MantidVec::const_iterator xIn_it = xIn.begin(); // DeltaE - MantidVec::iterator effOut_it = effOut.begin(); + auto xIn_it = xIn.begin(); // DeltaE + auto effOut_it = effOut.begin(); for (; effOut_it != effOut.end(); ++xIn_it, ++effOut_it) { if (conditionForEnergy) { // cppcheck cannot see that this is used by reference by muparser diff --git a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp index d1d9cbaf304cecfe0db193f78e39aa8965d55ff0..67dcdfee09793422b18540fffe03c72acb449c95 100644 --- a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp +++ b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp @@ -193,7 +193,7 @@ double DiffractionEventCalibrateDetectors::intensity( // Find point of peak centre const MantidVec &yValues = outputW->readY(0); - MantidVec::const_iterator it = + auto it = std::max_element(yValues.begin(), yValues.end()); double peakHeight = *it; if (peakHeight == 0) diff --git a/Framework/Algorithms/src/DiffractionFocussing.cpp b/Framework/Algorithms/src/DiffractionFocussing.cpp index 5ed6c317d87d456d24cc0b4d2709e986cc66e5b6..01cbbf1cd6bacf71f31c5e43832434a00be91886 100644 --- a/Framework/Algorithms/src/DiffractionFocussing.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing.cpp @@ -84,7 +84,7 @@ void DiffractionFocussing::exec() { if (iprogress_step == 0) iprogress_step = 1; std::vector<int64_t> resultIndeces; - for (std::set<int64_t>::const_iterator g = groupNumbers.begin(); + for (auto g = groupNumbers.begin(); g != groupNumbers.end(); ++g) { if (iprogress++ % iprogress_step == 0) { progress(0.68 + double(iprogress) / iprogress_count / 3); @@ -94,7 +94,7 @@ void DiffractionFocussing::exec() { std::multimap<int64_t, int64_t>::const_iterator to = detectorGroups.upper_bound(*g); std::vector<detid_t> detectorList; - for (std::multimap<int64_t, int64_t>::const_iterator d = from; d != to; ++d) + for (auto d = from; d != to; ++d) detectorList.push_back(static_cast<detid_t>(d->second)); // Want version 1 of GroupDetectors here API::IAlgorithm_sptr childAlg = diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp index 81032aeef8d5a6791ac4e2109307fdecbc97d278..e248b3007e2204435e83b36b9d8af6a6fcb637c1 100644 --- a/Framework/Algorithms/src/DiffractionFocussing2.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp @@ -189,7 +189,7 @@ void DiffractionFocussing2::exec() { int group = m_validGroups[outWorkspaceIndex]; // Get the group - group2vectormap::iterator it = group2xvector.find(group); + auto it = group2xvector.find(group); group2vectormap::difference_type dif = std::distance(group2xvector.begin(), it); const MantidVec &Xout = *((*it).second); @@ -245,7 +245,7 @@ void DiffractionFocussing2::exec() { m_matrixInputW->maskedBins(i); // Now iterate over the list, adjusting the weights for the affected // bins - for (API::MatrixWorkspace::MaskList::const_iterator it = mask.begin(); + for (auto it = mask.begin(); it != mask.end(); ++it) { const double currentX = Xin[(*it).first]; // Add an intermediate bin with full weight if masked bins aren't @@ -369,7 +369,7 @@ void DiffractionFocussing2::execEvent() { const vector<size_t> &indices = this->m_wsIndices[group]; totalHistProcess += static_cast<int>(indices.size()); - for (vector<size_t>::const_iterator index = indices.begin(); + for (auto index = indices.begin(); index != indices.end(); ++index) { size_required[iGroup] += m_eventW->getEventList(*index).getNumberEvents(); } @@ -496,7 +496,7 @@ void DiffractionFocussing2::execEvent() { // Now you set the X axis to the X you saved before. if (group2xvector.size() > 0) { - group2vectormap::iterator git = group2xvector.find(group); + auto git = group2xvector.find(group); if (git != group2xvector.end()) out->setX(workspaceIndex, (git->second)); else @@ -528,7 +528,7 @@ int DiffractionFocussing2::validateSpectrumInGroup(size_t wi) { return -1; } - std::set<detid_t>::const_iterator it = dets.begin(); + auto it = dets.begin(); if (*it < 0) // bad pixel id return -1; diff --git a/Framework/Algorithms/src/EditInstrumentGeometry.cpp b/Framework/Algorithms/src/EditInstrumentGeometry.cpp index 60bb3606852676310fd8831dab3155462411c132..61beea3febdf7fef5a3ab09e34b248221c9f5151 100644 --- a/Framework/Algorithms/src/EditInstrumentGeometry.cpp +++ b/Framework/Algorithms/src/EditInstrumentGeometry.cpp @@ -249,7 +249,7 @@ void EditInstrumentGeometry::exec() { // Map the properties from spectrum ID to workspace index for (size_t i = 0; i < specids.size(); i++) { // Find spectrum's workspace index - spec2index_map::const_iterator it = spec2indexmap.find(specids[i]); + auto it = spec2indexmap.find(specids[i]); if (it == spec2indexmap.end()) { stringstream errss; errss << "Spectrum ID " << specids[i] << " is not found. " diff --git a/Framework/Algorithms/src/ExtractMaskToTable.cpp b/Framework/Algorithms/src/ExtractMaskToTable.cpp index 8a62bd7b6bd5d836cc8f07a00a8496d77a911479..330a41e1d355234a00d9ebfc8e7dde0e6eb74486 100644 --- a/Framework/Algorithms/src/ExtractMaskToTable.cpp +++ b/Framework/Algorithms/src/ExtractMaskToTable.cpp @@ -270,7 +270,7 @@ void ExtractMaskToTable::extractMaskFromMaskWorkspace( "Unable to get spectrum reference from mask workspace."); const set<detid_t> detidset = spec->getDetectorIDs(); - for (set<detid_t>::const_iterator sit = detidset.begin(); + for (auto sit = detidset.begin(); sit != detidset.end(); ++sit) { detid_t tmpdetid = *sit; maskeddetids.push_back(tmpdetid); diff --git a/Framework/Algorithms/src/FFT.cpp b/Framework/Algorithms/src/FFT.cpp index 1d6f94e2bf38fe60405370cd002df6453f65d240..ba35a14b4b325bd8588956ae2efa0b022486a60f 100644 --- a/Framework/Algorithms/src/FFT.cpp +++ b/Framework/Algorithms/src/FFT.cpp @@ -174,7 +174,7 @@ void FFT::exec() { // at point with index i = ySize/2. If shift == false the zero is at i = 0 const bool centerShift = true; - API::TextAxis *tAxis = new API::TextAxis(nOut); + auto tAxis = new API::TextAxis(nOut); int iRe = 0; int iIm = 1; int iAbs = 2; diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index b251606295a7ce8ffdbd0c2732c426b7b5d9b778..a05080ed6eaae91badecd0fb5e7ea6c052a1b259 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -515,7 +515,7 @@ void FilterEvents::createOutputWorkspaces() { // Determine the minimum group index number int minwsgroup = INT_MAX; - for (set<int>::iterator groupit = m_workGroupIndexes.begin(); + for (auto groupit = m_workGroupIndexes.begin(); groupit != m_workGroupIndexes.end(); ++groupit) { int wsgroup = *groupit; if (wsgroup < minwsgroup && wsgroup >= 0) diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp index 047bb0748a29536e74291b11089fd189ca149331..1f82a963600b7929f00eca4996f0d1ef3852d187 100644 --- a/Framework/Algorithms/src/FindPeakBackground.cpp +++ b/Framework/Algorithms/src/FindPeakBackground.cpp @@ -140,7 +140,7 @@ void FindPeakBackground::exec() { double Ymean, Yvariance, Ysigma; MantidVec maskedY; - MantidVec::const_iterator in = std::min_element(inpY.begin(), inpY.end()); + auto in = std::min_element(inpY.begin(), inpY.end()); double bkg0 = inpY[in - inpY.begin()]; for (size_t l = l0; l < n; ++l) { maskedY.push_back(inpY[l] - bkg0); diff --git a/Framework/Algorithms/src/GeneralisedSecondDifference.cpp b/Framework/Algorithms/src/GeneralisedSecondDifference.cpp index 3c3aa3917dabccfaec11f5d391551f6bc81fd7a7..1cabfa393bfea8994668c9f8c8861e08c12c8c59 100644 --- a/Framework/Algorithms/src/GeneralisedSecondDifference.cpp +++ b/Framework/Algorithms/src/GeneralisedSecondDifference.cpp @@ -112,10 +112,10 @@ void GeneralisedSecondDifference::exec() { MantidVec &outE = out->dataE(out_index); std::copy(refX.begin() + n_av, refX.end() - n_av, outX.begin()); - MantidVec::const_iterator itInY = refY.begin(); - MantidVec::iterator itOutY = outY.begin(); - MantidVec::const_iterator itInE = refE.begin(); - MantidVec::iterator itOutE = outE.begin(); + auto itInY = refY.begin(); + auto itOutY = outY.begin(); + auto itInE = refE.begin(); + auto itOutE = outE.begin(); for (; itOutY != outY.end(); ++itOutY, ++itInY, ++itOutE, ++itInE) { // Calculate \sum_{j}Cij.Y(j) (*itOutY) = std::inner_product(itInY, itInY + nsteps, m_Cij.begin(), 0.0); diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index 914c07e254397434d50e360f679eb204e7efa337..0309d6f1d79adcafe38ec97bc54e8b0cff274b6d 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -759,7 +759,7 @@ void GenerateEventsFilter::processMultipleValueFilters(double minvalue, // Debug print stringstream dbsplitss; dbsplitss << "Index map size = " << indexwsindexmap.size() << "\n"; - for (map<size_t, int>::iterator mit = indexwsindexmap.begin(); + for (auto mit = indexwsindexmap.begin(); mit != indexwsindexmap.end(); ++mit) { dbsplitss << "Index " << mit->first << ": WS-group = " << mit->second << ". Log value range: [" << logvalueranges[mit->first * 2] diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp index fc2f7ce2dadd20a71b5e3d3ad579bc8de6d29b59..a3aaebdc27abead1e167ad808bbb11221602b87d 100644 --- a/Framework/Algorithms/src/GeneratePeaks.cpp +++ b/Framework/Algorithms/src/GeneratePeaks.cpp @@ -475,7 +475,7 @@ void GeneratePeaks::generatePeaks( if (leftbound < middle) leftbound = middle; } - std::vector<double>::const_iterator left = + auto left = std::lower_bound(X.begin(), X.end(), leftbound); if (left == X.end()) left = X.begin(); @@ -489,7 +489,7 @@ void GeneratePeaks::generatePeaks( if (rightbound > middle) rightbound = middle; } - std::vector<double>::const_iterator right = + auto right = std::lower_bound(left + 1, X.end(), rightbound); // Build domain & function diff --git a/Framework/Algorithms/src/GetDetectorOffsets.cpp b/Framework/Algorithms/src/GetDetectorOffsets.cpp index 5af130be47dc42589c73a119d8910ff94ba8dbb3..9c9fb1920eb24063ccc041e7a9c132afc797f1a1 100644 --- a/Framework/Algorithms/src/GetDetectorOffsets.cpp +++ b/Framework/Algorithms/src/GetDetectorOffsets.cpp @@ -187,7 +187,7 @@ void GetDetectorOffsets::exec() { double GetDetectorOffsets::fitSpectra(const int64_t s, bool isAbsolbute) { // Find point of peak centre const MantidVec &yValues = inputW->readY(s); - MantidVec::const_iterator it = + auto it = std::max_element(yValues.begin(), yValues.end()); const double peakHeight = *it; const double peakLoc = inputW->readX(s)[it - yValues.begin()]; @@ -255,7 +255,7 @@ IFunction_sptr GetDetectorOffsets::createFunction(const double peakHeight, const double sigma(10.0); peak->setFwhm(2.0 * std::sqrt(2.0 * std::log(2.0)) * sigma); - CompositeFunction *fitFunc = + auto fitFunc = new CompositeFunction(); // Takes ownership of the functions fitFunc->addFunction(background); fitFunc->addFunction(peak); diff --git a/Framework/Algorithms/src/GetEi2.cpp b/Framework/Algorithms/src/GetEi2.cpp index f431d950392189d5fe63056138085b466735c9d1..e5726108054299a8bf276ea02e20056abc3e7021 100644 --- a/Framework/Algorithms/src/GetEi2.cpp +++ b/Framework/Algorithms/src/GetEi2.cpp @@ -395,7 +395,7 @@ double GetEi2::calculatePeakWidthAtHalfHeight( const MantidVec &Ys = data_ws->readY(0); const MantidVec &Es = data_ws->readE(0); - MantidVec::const_iterator peakIt = std::max_element(Ys.begin(), Ys.end()); + auto peakIt = std::max_element(Ys.begin(), Ys.end()); double bkg_val = *std::min_element(Ys.begin(), Ys.end()); if (*peakIt == bkg_val) { throw std::invalid_argument("No peak in the range specified as minimal and " @@ -668,9 +668,9 @@ void GetEi2::integrate(double &integral_val, double &integral_err, // MG: Note that this is integration of a point data set from libisis // @todo: Move to Kernel::VectorHelper and improve performance - MantidVec::const_iterator lowit = std::lower_bound(x.begin(), x.end(), xmin); + auto lowit = std::lower_bound(x.begin(), x.end(), xmin); MantidVec::difference_type ml = std::distance(x.begin(), lowit); - MantidVec::const_iterator highit = std::upper_bound(lowit, x.end(), xmax); + auto highit = std::upper_bound(lowit, x.end(), xmax); MantidVec::difference_type mu = std::distance(x.begin(), highit); if (mu > 0) --mu; diff --git a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp index 9821aaac4143165738a68bc9366370d979b66cc3..6706cd3e5fb918378d105ef975af430c7a99b1d6 100644 --- a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp +++ b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp @@ -413,7 +413,7 @@ Workspace2D_sptr GetTimeSeriesLogInformation::calDistributions( if (dt < 0 && m_ignoreNegativeTime) { index = 0; } else { - vector<double>::iterator viter = + auto viter = lower_bound(vecDeltaT.begin(), vecDeltaT.end(), dt); index = static_cast<int>(viter - vecDeltaT.begin()); if (index >= static_cast<int>(vecDeltaT.size())) { diff --git a/Framework/Algorithms/src/GroupWorkspaces.cpp b/Framework/Algorithms/src/GroupWorkspaces.cpp index 110b07a9e15adb4491cc1a95cbe344cf3f23d8f8..7badabbb35c917f16dba67ab989db1d4d62f43cf 100644 --- a/Framework/Algorithms/src/GroupWorkspaces.cpp +++ b/Framework/Algorithms/src/GroupWorkspaces.cpp @@ -52,8 +52,8 @@ void GroupWorkspaces::addToGroup(const std::vector<std::string> &names) { typedef std::vector<std::string>::const_iterator const_vector_iterator; AnalysisDataServiceImpl &ads = AnalysisDataService::Instance(); - const_vector_iterator cend = names.end(); - for (const_vector_iterator citr = names.begin(); citr != cend; ++citr) { + auto cend = names.end(); + for (auto citr = names.begin(); citr != cend; ++citr) { auto workspace = ads.retrieve(*citr); addToGroup(workspace); } diff --git a/Framework/Algorithms/src/He3TubeEfficiency.cpp b/Framework/Algorithms/src/He3TubeEfficiency.cpp index b8e5d300845d397c8b7a8e18436825100890634f..e9d4a28abfe28ff91b34a273659b399e49a6bdfb 100644 --- a/Framework/Algorithms/src/He3TubeEfficiency.cpp +++ b/Framework/Algorithms/src/He3TubeEfficiency.cpp @@ -169,12 +169,12 @@ void He3TubeEfficiency::correctForEfficiency(std::size_t spectraIndex) { const Mantid::MantidVec yValues = this->inputWS->readY(spectraIndex); const Mantid::MantidVec eValues = this->inputWS->readE(spectraIndex); - std::vector<double>::const_iterator yinItr = yValues.begin(); - std::vector<double>::const_iterator einItr = eValues.begin(); - Mantid::MantidVec::const_iterator xItr = + auto yinItr = yValues.begin(); + auto einItr = eValues.begin(); + auto xItr = this->inputWS->readX(spectraIndex).begin(); - Mantid::MantidVec::iterator youtItr = yout.begin(); - Mantid::MantidVec::iterator eoutItr = eout.begin(); + auto youtItr = yout.begin(); + auto eoutItr = eout.begin(); for (; youtItr != yout.end(); ++youtItr, ++eoutItr) { const double wavelength = (*xItr + *(xItr + 1)) / 2.0; diff --git a/Framework/Algorithms/src/MaskBins.cpp b/Framework/Algorithms/src/MaskBins.cpp index 3c0992086a7da82b4a9afd29028d3d287af94f55..f40ce2696a40dea87d0c827b07bd47e934755401 100644 --- a/Framework/Algorithms/src/MaskBins.cpp +++ b/Framework/Algorithms/src/MaskBins.cpp @@ -239,7 +239,7 @@ void MaskBins::findIndices(const MantidVec &X, startBin = std::upper_bound(X.begin(), X.end(), m_startX) - X.begin(); if (startBin != 0) --startBin; - MantidVec::const_iterator last = std::lower_bound(X.begin(), X.end(), m_endX); + auto last = std::lower_bound(X.begin(), X.end(), m_endX); if (last == X.end()) --last; endBin = last - X.begin(); diff --git a/Framework/Algorithms/src/MaskDetectorsIf.cpp b/Framework/Algorithms/src/MaskDetectorsIf.cpp index 803f1008d76317cb96a3fd17fc3ba4c193cf401d..89a0c370563b72ae11e4b4afbeb9abdc6b03176d 100644 --- a/Framework/Algorithms/src/MaskDetectorsIf.cpp +++ b/Framework/Algorithms/src/MaskDetectorsIf.cpp @@ -78,7 +78,7 @@ void MaskDetectorsIf::exec() { else { double val = inputW->readY(i)[0]; if (compar_f(val, value)) { - std::set<detid_t>::const_iterator it = dets.begin(); + auto it = dets.begin(); for (; it != dets.end(); ++it) umap.insert(std::make_pair(*it, select_on)); } @@ -164,7 +164,7 @@ void MaskDetectorsIf::createNewCalFile(const std::string &oldfile, int n, udet, sel, group; double offset; istr >> n >> udet >> offset >> sel >> group; - udet2valuem::iterator it = umap.find(udet); + auto it = umap.find(udet); bool selection; if (it == umap.end()) diff --git a/Framework/Algorithms/src/MergeRuns.cpp b/Framework/Algorithms/src/MergeRuns.cpp index aadca86cfc712a7809ffd1c4eff59d9560cd83d2..28a274a69668fd5832c1c299616f417bb1bca229 100644 --- a/Framework/Algorithms/src/MergeRuns.cpp +++ b/Framework/Algorithms/src/MergeRuns.cpp @@ -189,7 +189,7 @@ void MergeRuns::buildAdditionTables() { // Didn't find it. Try to use the LHS map. // First, we have to get the (single) detector ID of the RHS - std::set<detid_t>::iterator inDets_it = inDets.begin(); + auto inDets_it = inDets.begin(); detid_t rhs_detector_ID = *inDets_it; // Now we use the LHS map to find it. This only works if both the lhs diff --git a/Framework/Algorithms/src/ModeratorTzero.cpp b/Framework/Algorithms/src/ModeratorTzero.cpp index 91b979561b8520185f438b0a7f20898d60d681cc..b2b38ddea413691743bbb3643b4e9d0b3c6b114d 100644 --- a/Framework/Algorithms/src/ModeratorTzero.cpp +++ b/Framework/Algorithms/src/ModeratorTzero.cpp @@ -348,7 +348,7 @@ void ModeratorTzero::execEvent(const std::string &emode) { double tof; // fix the histogram bins MantidVec &x = evlist.dataX(); - for (MantidVec::iterator iter = x.begin(); iter != x.end(); + for (auto iter = x.begin(); iter != x.end(); ++iter) { tof = *iter; if (tof < m_t1min + t2) @@ -375,7 +375,7 @@ void ModeratorTzero::execEvent(const std::string &emode) { double tof; // Apply t0 correction to histogram bins MantidVec &x = evlist.dataX(); - for (MantidVec::iterator iter = x.begin(); iter != x.end(); ++iter) { + for (auto iter = x.begin(); iter != x.end(); ++iter) { tof = *iter; if (tof < m_t1min * (L1 + L2) / L1) tof -= min_t0_next; @@ -404,7 +404,7 @@ void ModeratorTzero::execEvent(const std::string &emode) { else if (emode == "Direct") { // fix the histogram bins MantidVec &x = evlist.dataX(); - for (MantidVec::iterator iter = x.begin(); iter != x.end(); ++iter) { + for (auto iter = x.begin(); iter != x.end(); ++iter) { *iter -= t0_direct; } diff --git a/Framework/Algorithms/src/MonteCarloAbsorption.cpp b/Framework/Algorithms/src/MonteCarloAbsorption.cpp index 229285ea32c5d9657b1dc3698d050015afa5c314..018a95b62dd01bf9c394344e4b23c59c88cf8035 100644 --- a/Framework/Algorithms/src/MonteCarloAbsorption.cpp +++ b/Framework/Algorithms/src/MonteCarloAbsorption.cpp @@ -296,8 +296,8 @@ bool MonteCarloAbsorption::attenuationFactor(const V3D &startPos, m_container->interceptSurfaces(beforeScatter); } // Attenuation factor is product of factor for each material - Track::LType::const_iterator cend = beforeScatter.end(); - for (Track::LType::const_iterator citr = beforeScatter.begin(); citr != cend; + auto cend = beforeScatter.end(); + for (auto citr = beforeScatter.begin(); citr != cend; ++citr) { length = citr->distInsideObject; factor *= attenuation(length, citr->object->material(), lambda); @@ -312,7 +312,7 @@ bool MonteCarloAbsorption::attenuationFactor(const V3D &startPos, } // Attenuation factor is product of factor for each material cend = afterScatter.end(); - for (Track::LType::const_iterator citr = afterScatter.begin(); citr != cend; + for (auto citr = afterScatter.begin(); citr != cend; ++citr) { length = citr->distInsideObject; factor *= attenuation(length, citr->object->material(), lambda); diff --git a/Framework/Algorithms/src/NormaliseByDetector.cpp b/Framework/Algorithms/src/NormaliseByDetector.cpp index b06f40a2629a20cc0e6ff65cb37e1ac333000a01..4e9f93063e10365f2fffa89db134544ae35d1932 100644 --- a/Framework/Algorithms/src/NormaliseByDetector.cpp +++ b/Framework/Algorithms/src/NormaliseByDetector.cpp @@ -116,7 +116,7 @@ void NormaliseByDetector::processHistogram(size_t wsIndex, ParamNames allParamNames = function->getParameterNames(); // Lookup each parameter name. - for (ParamNames::iterator it = allParamNames.begin(); + for (auto it = allParamNames.begin(); it != allParamNames.end(); ++it) { Geometry::Parameter_sptr param = paramMap.getRecursive(&(*det), (*it), type); diff --git a/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp b/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp index e6c658fdbc2378945d241bd154c53b9d62f2522b..d3a84a504369e4572d04fffed22996f442872bd3 100644 --- a/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp +++ b/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp @@ -384,7 +384,7 @@ Workspace_sptr PlotAsymmetryByLogValue::loadCorrectionsFromFile( void PlotAsymmetryByLogValue::populateOutputWorkspace( MatrixWorkspace_sptr &outWS, int nplots) { - TextAxis *tAxis = new TextAxis(nplots); + auto tAxis = new TextAxis(nplots); if (nplots == 1) { size_t i = 0; for (auto it = m_logValue.begin(); it != m_logValue.end(); ++it) { diff --git a/Framework/Algorithms/src/Q1D2.cpp b/Framework/Algorithms/src/Q1D2.cpp index f362c4ff7c35638b1b17ec8ebb3b31fb8f43ac52..8bba9350b73202ad34f308d469be6919e101d2d0 100644 --- a/Framework/Algorithms/src/Q1D2.cpp +++ b/Framework/Algorithms/src/Q1D2.cpp @@ -186,12 +186,12 @@ void Q1D2::exec() { // three "arrays" is via iterators MantidVec _noDirectUseStorage_(3 * numWavbins); // normalization term - MantidVec::iterator norms = _noDirectUseStorage_.begin(); + auto norms = _noDirectUseStorage_.begin(); // the error on these weights, it contributes to the error calculation on // the output workspace - MantidVec::iterator normETo2s = norms + numWavbins; + auto normETo2s = norms + numWavbins; // the Q values calculated from input wavelength workspace - MantidVec::iterator QIn = normETo2s + numWavbins; + auto QIn = normETo2s + numWavbins; // the weighting for this input spectrum that is added to the normalization calculateNormalization(wavStart, i, pixelAdj, wavePixelAdj, binNorms, @@ -201,8 +201,8 @@ void Q1D2::exec() { convertWavetoQ(i, doGravity, wavStart, QIn, getProperty("ExtraLength")); // Pointers to the counts data and it's error - MantidVec::const_iterator YIn = m_dataWS->readY(i).begin() + wavStart; - MantidVec::const_iterator EIn = m_dataWS->readE(i).begin() + wavStart; + auto YIn = m_dataWS->readY(i).begin() + wavStart; + auto EIn = m_dataWS->readE(i).begin() + wavStart; // Pointers to the QResolution data. Note that the xdata was initially the // same, hence @@ -210,12 +210,12 @@ void Q1D2::exec() { // If we want to use it set it to the correct value, else to YIN, although // that does not matter, as // we won't use it - MantidVec::const_iterator QResIn = + auto QResIn = useQResolution ? (qResolution->readY(i).begin() + wavStart) : YIn; // when finding the output Q bin remember that the input Q bins (from the // convert to wavelength) start high and reduce - MantidVec::const_iterator loc = QOut.end(); + auto loc = QOut.end(); // sum the Q contributions from each individual spectrum into the output // array const MantidVec::const_iterator end = m_dataWS->readY(i).end(); @@ -268,7 +268,7 @@ void Q1D2::exec() { // N-1, // Richard Heenan suggested to duplicate the last entry of DeltaQ Mantid::MantidVec::const_iterator countsIterator = YOut.begin(); - Mantid::MantidVec::iterator qResolutionIterator = qResolutionOut.begin(); + auto qResolutionIterator = qResolutionOut.begin(); for (; countsIterator != YOut.end(); ++countsIterator, ++qResolutionIterator) { // Divide by the counts of the Qbin, if the counts are 0, the the @@ -570,7 +570,7 @@ void Q1D2::convertWavetoQ(const size_t specInd, const bool doGravity, IDetector_const_sptr det = m_dataWS->getDetector(specInd); // wavelengths (lamda) to be converted to Q - MantidVec::const_iterator waves = m_dataWS->readX(specInd).begin() + offset; + auto waves = m_dataWS->readX(specInd).begin() + offset; // going from bin boundaries to bin centered x-values the size goes down one const MantidVec::const_iterator end = m_dataWS->readX(specInd).end() - 1; if (doGravity) { diff --git a/Framework/Algorithms/src/Qhelper.cpp b/Framework/Algorithms/src/Qhelper.cpp index aad22cc3df354532788b013f50bced1db5f0205d..1c3968e04547380f9b4b01f797132aa1ce0f7332 100644 --- a/Framework/Algorithms/src/Qhelper.cpp +++ b/Framework/Algorithms/src/Qhelper.cpp @@ -38,8 +38,8 @@ void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS, // We require the same binning for the input workspace and the q resolution // workspace - MantidVec::const_iterator reqX = dataWS->readX(0).begin(); - MantidVec::const_iterator qResX = qResolution->readX(0).begin(); + auto reqX = dataWS->readX(0).begin(); + auto qResX = qResolution->readX(0).begin(); for (; reqX != dataWS->readX(0).end(); ++reqX, ++qResX) { if (*reqX != *qResX) { throw std::invalid_argument( @@ -77,8 +77,8 @@ void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS, throw std::invalid_argument("The WavelengthAdj workspace's bins must " "match those of the detector bank workspace"); } - MantidVec::const_iterator reqX = dataWS->readX(0).begin(); - MantidVec::const_iterator testX = binAdj->readX(0).begin(); + auto reqX = dataWS->readX(0).begin(); + auto testX = binAdj->readX(0).begin(); for (; reqX != dataWS->readX(0).end(); ++reqX, ++testX) { if (*reqX != *testX) { throw std::invalid_argument("The WavelengthAdj workspace must have " diff --git a/Framework/Algorithms/src/ReadGroupsFromFile.cpp b/Framework/Algorithms/src/ReadGroupsFromFile.cpp index fdfdf7844f95a19980f3b108f068962e7798a6d2..2f52300042e2b08c823c38cbf1717c7eacf85754 100644 --- a/Framework/Algorithms/src/ReadGroupsFromFile.cpp +++ b/Framework/Algorithms/src/ReadGroupsFromFile.cpp @@ -227,7 +227,7 @@ void ReadGroupsFromFile::readXMLGroupingFile(const std::string &filename) { Poco::StringTokenizer data(ids, ",", Poco::StringTokenizer::TOK_TRIM); if (data.begin() != data.end()) { - for (Poco::StringTokenizer::Iterator it = data.begin(); it != data.end(); + for (auto it = data.begin(); it != data.end(); ++it) { // cast the string to an int int detID; diff --git a/Framework/Algorithms/src/RealFFT.cpp b/Framework/Algorithms/src/RealFFT.cpp index db2466098cdddc8f484617e71753980efc541489..a7551fd00447ff57e769622ac3d692326e2dfa34 100644 --- a/Framework/Algorithms/src/RealFFT.cpp +++ b/Framework/Algorithms/src/RealFFT.cpp @@ -99,7 +99,7 @@ void RealFFT::exec() { bool odd = ySize % 2 != 0; outWS = WorkspaceFactory::Instance().create(inWS, 3, xOutSize, yOutSize); - API::TextAxis *tAxis = new API::TextAxis(3); + auto tAxis = new API::TextAxis(3); tAxis->setLabel(0, "Real"); tAxis->setLabel(1, "Imag"); tAxis->setLabel(2, "Modulus"); @@ -149,7 +149,7 @@ void RealFFT::exec() { df = 1.0 / (dx * (yOutSize)); outWS = WorkspaceFactory::Instance().create(inWS, 1, xOutSize, yOutSize); - API::TextAxis *tAxis = new API::TextAxis(1); + auto tAxis = new API::TextAxis(1); tAxis->setLabel(0, "Real"); outWS->replaceAxis(1, tAxis); diff --git a/Framework/Algorithms/src/Rebin.cpp b/Framework/Algorithms/src/Rebin.cpp index 678c303e3f1cd727b9fa5eca42004f28725cd96b..38b96f0a416f94f2b68444cf5d964ee791ead8b6 100644 --- a/Framework/Algorithms/src/Rebin.cpp +++ b/Framework/Algorithms/src/Rebin.cpp @@ -356,7 +356,7 @@ void Rebin::propagateMasks(API::MatrixWorkspace_const_sptr inputWS, // Get a reference to the list of masked bins for this spectrum const MatrixWorkspace::MaskList &mask = inputWS->maskedBins(hist); // Now iterate over the list, building up a vector of the masked bins - MatrixWorkspace::MaskList::const_iterator it = mask.begin(); + auto it = mask.begin(); const MantidVec &XValues = inputWS->readX(hist); masked_bins.push_back(XValues[(*it).first]); weights.push_back((*it).second); diff --git a/Framework/Algorithms/src/Regroup.cpp b/Framework/Algorithms/src/Regroup.cpp index 4abbbff1d039d7f1c053344fd272e4376f712315..f4192ebe65088d7cb642dd3ed46c2c4cddef8a14 100644 --- a/Framework/Algorithms/src/Regroup.cpp +++ b/Framework/Algorithms/src/Regroup.cpp @@ -193,7 +193,7 @@ int Regroup::newAxis(const std::vector<double> ¶ms, int isteps = ibounds - 1; // highest index in params array containing a step xcurr = params[0]; - std::vector<double>::const_iterator iup = + auto iup = std::find_if(xold.begin(), xold.end(), std::bind2nd(std::greater_equal<double>(), xcurr)); if (iup != xold.end()) { diff --git a/Framework/Algorithms/src/RemoveBins.cpp b/Framework/Algorithms/src/RemoveBins.cpp index a60e5c881d27fba702a9a9ff850b5837131c2698..ac1b22fe4363d12867b7f8e6e6defed7b5bfa61a 100644 --- a/Framework/Algorithms/src/RemoveBins.cpp +++ b/Framework/Algorithms/src/RemoveBins.cpp @@ -304,7 +304,7 @@ void RemoveBins::calculateDetectorPosition(const int &index, double &l1, * the vector) */ int RemoveBins::findIndex(const double &value, const MantidVec &vec) { - MantidVec::const_iterator pos = + auto pos = std::lower_bound(vec.begin(), vec.end(), value); return static_cast<int>(pos - vec.begin()); } diff --git a/Framework/Algorithms/src/RemoveLowResTOF.cpp b/Framework/Algorithms/src/RemoveLowResTOF.cpp index 94f1cfa956888ee30c8d8441151b610858a1ff7b..020108f6e10b3c4a994a24914d36ed74e05a701b 100644 --- a/Framework/Algorithms/src/RemoveLowResTOF.cpp +++ b/Framework/Algorithms/src/RemoveLowResTOF.cpp @@ -148,7 +148,7 @@ void RemoveLowResTOF::exec() { // calculate where to zero out to double tofMin = this->calcTofMin(workspaceIndex); const MantidVec &X = m_inputWS->readX(0); - MantidVec::const_iterator last = + auto last = std::lower_bound(X.begin(), X.end(), tofMin); if (last == X.end()) --last; @@ -309,7 +309,7 @@ double RemoveLowResTOF::calcTofMin(const std::size_t workspaceIndex) { } } else { double l2 = 0; - for (std::set<detid_t>::const_iterator it = detSet.begin(); + for (auto it = detSet.begin(); it != detSet.end(); ++it) { l2 += m_instrument->getDetector(*it)->getDistance(*m_sample); } diff --git a/Framework/Algorithms/src/ResetNegatives.cpp b/Framework/Algorithms/src/ResetNegatives.cpp index 18b109c3fc146f8f850cbf4948c5a0271466c1ec..8e3d93ed905652e84c0cc7adcbdf04737f67516e 100644 --- a/Framework/Algorithms/src/ResetNegatives.cpp +++ b/Framework/Algorithms/src/ResetNegatives.cpp @@ -153,7 +153,7 @@ void ResetNegatives::pushMinimum(MatrixWorkspace_const_sptr minWS, if (minValue <= 0) { minValue *= -1.; MantidVec &y = wksp->dataY(i); - for (MantidVec::iterator it = y.begin(); it != y.end(); ++it) { + for (auto it = y.begin(); it != y.end(); ++it) { *it = fixZero(*it + minValue); } } @@ -184,7 +184,7 @@ void ResetNegatives::changeNegatives(MatrixWorkspace_const_sptr minWS, 0.) // quick check to see if there is a reason to bother { MantidVec &y = wksp->dataY(i); - for (MantidVec::iterator it = y.begin(); it != y.end(); ++it) { + for (auto it = y.begin(); it != y.end(); ++it) { if (*it < 0.) { *it = value; } else diff --git a/Framework/Algorithms/src/ShiftLogTime.cpp b/Framework/Algorithms/src/ShiftLogTime.cpp index 199e835c373bd95144d64b78b05244d4d720eb01..c991b5e5ebbea7afa188d379fe6ed6e3b005bfa7 100644 --- a/Framework/Algorithms/src/ShiftLogTime.cpp +++ b/Framework/Algorithms/src/ShiftLogTime.cpp @@ -98,7 +98,7 @@ void ShiftLogTime::exec() { } // Create the new log - TimeSeriesProperty<double> *newlog = new TimeSeriesProperty<double>(logname); + auto newlog = new TimeSeriesProperty<double>(logname); newlog->setUnits(oldlog->units()); newlog->create(times, values); diff --git a/Framework/Algorithms/src/SmoothData.cpp b/Framework/Algorithms/src/SmoothData.cpp index bc71e7ae3398c766faf612ea6308ebc6df3a6c83..b1faee4a186034112b4b953eab668ee3f0968dd6 100644 --- a/Framework/Algorithms/src/SmoothData.cpp +++ b/Framework/Algorithms/src/SmoothData.cpp @@ -170,7 +170,7 @@ int SmoothData::validateSpectrumInGroup(size_t wi) { return -1; } - std::set<detid_t>::const_iterator it = dets.begin(); + auto it = dets.begin(); if (*it < 0) // bad pixel id return -1; diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp index ef6a97273b595673dbf46a1c111856a2c73b887d..2132cabf534cd70ce995cceb09afd48c773f8494 100644 --- a/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -347,7 +347,7 @@ void SmoothNeighbours::findNeighboursUbiqutious() { int sum = getProperty("SumNumberOfNeighbours"); boost::shared_ptr<const Geometry::IComponent> parent, neighbParent, grandparent, neighbGParent; - bool *used = new bool[inWS->getNumberHistograms()]; + auto used = new bool[inWS->getNumberHistograms()]; if (sum > 1) { for (size_t wi = 0; wi < inWS->getNumberHistograms(); wi++) used[wi] = false; @@ -399,7 +399,7 @@ void SmoothNeighbours::findNeighboursUbiqutious() { std::vector<weightedNeighbour> neighbours; // Convert from spectrum numbers to workspace indices - for (SpectraDistanceMap::iterator it = neighbSpectra.begin(); + for (auto it = neighbSpectra.begin(); it != neighbSpectra.end(); ++it) { specid_t spec = it->first; @@ -408,7 +408,7 @@ void SmoothNeighbours::findNeighboursUbiqutious() { if (weight > 0) { // Find the corresponding workspace index - spec2index_map::const_iterator mapIt = spec2index.find(spec); + auto mapIt = spec2index.find(spec); if (mapIt != spec2index.end()) { size_t neighWI = mapIt->second; if (sum > 1) { @@ -543,7 +543,7 @@ Check whether the properties provided are all in their default state. */ bool areAllDefault(ConstVecProperties &properties) { bool areAllDefault = false; - for (ConstVecProperties::const_iterator it = properties.begin(); + for (auto it = properties.begin(); it != properties.end(); ++it) { if (!(*it)->isDefault()) { return areAllDefault; diff --git a/Framework/Algorithms/src/SofQWNormalisedPolygon.cpp b/Framework/Algorithms/src/SofQWNormalisedPolygon.cpp index 139c3356f855038c783a37f7ecc7554eff70fba0..4b5310d532089d04263668392b05d5600ffd9dec 100644 --- a/Framework/Algorithms/src/SofQWNormalisedPolygon.cpp +++ b/Framework/Algorithms/src/SofQWNormalisedPolygon.cpp @@ -338,7 +338,7 @@ void SofQWNormalisedPolygon::initAngularCachesPSD( specid_t deltaPlusT = inSpec + this->m_detNeighbourOffset; specid_t deltaMinusT = inSpec - this->m_detNeighbourOffset; - for (SpectraDistanceMap::iterator it = neighbours.begin(); + for (auto it = neighbours.begin(); it != neighbours.end(); ++it) { specid_t spec = it->first; g_log.debug() << "Neighbor ID: " << spec << std::endl; diff --git a/Framework/Algorithms/src/SpatialGrouping.cpp b/Framework/Algorithms/src/SpatialGrouping.cpp index bfc5744a0057e65726562e3ea35f78cf57fdcaea..38dcffc0558a4226b99fa2ceec73e4917e76189e 100644 --- a/Framework/Algorithms/src/SpatialGrouping.cpp +++ b/Framework/Algorithms/src/SpatialGrouping.cpp @@ -82,7 +82,7 @@ void SpatialGrouping::exec() { Mantid::API::Progress prog(this, 0.0, 1.0, m_detectors.size()); - for (std::map<specid_t, Geometry::IDetector_const_sptr>::iterator detIt = + for (auto detIt = m_detectors.begin(); detIt != m_detectors.end(); ++detIt) { prog.report(); @@ -101,7 +101,7 @@ void SpatialGrouping::exec() { } // Or detectors already flagged as included in a group - std::set<specid_t>::iterator inclIt = m_included.find(specNo); + auto inclIt = m_included.find(specNo); if (inclIt != m_included.end()) { continue; } @@ -176,7 +176,7 @@ void SpatialGrouping::exec() { inputWorkspace->getIndexFromSpectrumNumber((*grpIt)[i]); const std::set<detid_t> &detIds = inputWorkspace->getSpectrum(workspaceIndex)->getDetectorIDs(); - for (std::set<detid_t>::const_iterator it = detIds.begin(); + for (auto it = detIds.begin(); it != detIds.end(); ++it) { xml << "," << (*it); } @@ -215,12 +215,12 @@ bool SpatialGrouping::expandNet( if (incoming == 0) { potentials = inputWorkspace->getNeighbours(det.get()); } else { - for (std::map<specid_t, Mantid::Kernel::V3D>::iterator nrsIt = + for (auto nrsIt = nearest.begin(); nrsIt != nearest.end(); ++nrsIt) { std::map<specid_t, Mantid::Kernel::V3D> results; results = inputWorkspace->getNeighbours(m_detectors[nrsIt->first].get()); - for (std::map<specid_t, Mantid::Kernel::V3D>::iterator resIt = + for (auto resIt = results.begin(); resIt != results.end(); ++resIt) { potentials[resIt->first] = resIt->second; @@ -228,7 +228,7 @@ bool SpatialGrouping::expandNet( } } - for (std::map<specid_t, Mantid::Kernel::V3D>::iterator potIt = + for (auto potIt = potentials.begin(); potIt != potentials.end(); ++potIt) { // We do not want to include the detector in it's own list of nearest @@ -239,7 +239,7 @@ bool SpatialGrouping::expandNet( // Or detectors that are already in the nearest list passed into this // function - std::map<detid_t, Mantid::Kernel::V3D>::iterator nrsIt = + auto nrsIt = nearest.find(potIt->first); if (nrsIt != nearest.end()) { continue; @@ -247,7 +247,7 @@ bool SpatialGrouping::expandNet( // We should not include detectors already included in a group (or monitors // for that matter) - std::set<specid_t>::iterator inclIt = m_included.find(potIt->first); + auto inclIt = m_included.find(potIt->first); if (inclIt != m_included.end()) { continue; } diff --git a/Framework/Algorithms/src/UnwrapMonitor.cpp b/Framework/Algorithms/src/UnwrapMonitor.cpp index 59f85033b655d16ef9701a79348e9725cbaa0bc2..cac7b074c2e552e81309e0aa428941fb764f5145 100644 --- a/Framework/Algorithms/src/UnwrapMonitor.cpp +++ b/Framework/Algorithms/src/UnwrapMonitor.cpp @@ -370,8 +370,8 @@ void UnwrapMonitor::unwrapYandE(const API::MatrixWorkspace_sptr &tempWS, } if (rangeBounds[0] != -1 && rangeBounds[1] > 0) { // Now append the lower range - MantidVec::const_iterator YStart = YIn.begin(); - MantidVec::const_iterator EStart = EIn.begin(); + auto YStart = YIn.begin(); + auto EStart = EIn.begin(); Y.insert(Y.end(), YStart + rangeBounds[0], YStart + rangeBounds[1]); E.insert(E.end(), EStart + rangeBounds[0], EStart + rangeBounds[1]); // Propagate masking, if necessary diff --git a/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp b/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp index 37967d046ec3eca00e3943bdd93dfcb3448c8d34..3b10876b8355e82d0d57e4df11492a1ec7e9103f 100644 --- a/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp +++ b/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp @@ -134,7 +134,7 @@ void VesuvioL1ThetaResolution::exec() { WorkspaceFactory::Instance().create("Workspace2D", 4, numHist, numHist); // Set vertical axis to statistic labels - TextAxis *specAxis = new TextAxis(4); + auto specAxis = new TextAxis(4); specAxis->setLabel(0, "l1_Mean"); specAxis->setLabel(1, "l1_StdDev"); specAxis->setLabel(2, "theta_Mean"); diff --git a/Framework/Crystal/src/AnvredCorrection.cpp b/Framework/Crystal/src/AnvredCorrection.cpp index 3f49fb8f31e249c413db7af989bb4df0f6715e8b..7fb3e10acdb2dd95074dc01013ea861b6ccd42d3 100644 --- a/Framework/Crystal/src/AnvredCorrection.cpp +++ b/Framework/Crystal/src/AnvredCorrection.cpp @@ -324,7 +324,7 @@ void AnvredCorrection::execEvent() { std::vector<WeightedEventNoTime> events = el.getWeightedEventsNoTime(); std::vector<WeightedEventNoTime>::iterator itev; - std::vector<WeightedEventNoTime>::iterator itev_end = events.end(); + auto itev_end = events.end(); Mantid::Kernel::Units::Wavelength wl; std::vector<double> timeflight; diff --git a/Framework/Crystal/src/CentroidPeaks.cpp b/Framework/Crystal/src/CentroidPeaks.cpp index 0de29292380731ba7e081cbd662b7e537ee7869a..875cfecb80e11ecd90d45d1cbda4ece2fe7806ae 100644 --- a/Framework/Crystal/src/CentroidPeaks.cpp +++ b/Framework/Crystal/src/CentroidPeaks.cpp @@ -271,7 +271,7 @@ void CentroidPeaks::integrateEvent() { std::vector<WeightedEventNoTime> events = el.getWeightedEventsNoTime(); std::vector<WeightedEventNoTime>::iterator itev; - std::vector<WeightedEventNoTime>::iterator itev_end = events.end(); + auto itev_end = events.end(); // Check for events in tof range for (itev = events.begin(); itev != itev_end; ++itev) { diff --git a/Framework/Crystal/src/ClusterRegister.cpp b/Framework/Crystal/src/ClusterRegister.cpp index b24a7b66e9a9905c075ef27efef4877ba7b3043f..233e45fd1800cb5503226f5a46fc0d7f37700367 100644 --- a/Framework/Crystal/src/ClusterRegister.cpp +++ b/Framework/Crystal/src/ClusterRegister.cpp @@ -57,7 +57,7 @@ public: GroupType containingAny; GroupType containingNone; // ------------- Find equivalent sets - for (GroupType::iterator i = m_groups.begin(); i != m_groups.end(); ++i) { + for (auto i = m_groups.begin(); i != m_groups.end(); ++i) { GroupType::value_type &cluster = *i; if (cluster.find(aLabel) != cluster.end()) { containingAny.push_back(cluster); diff --git a/Framework/Crystal/src/MaskPeaksWorkspace.cpp b/Framework/Crystal/src/MaskPeaksWorkspace.cpp index eccab7700967e20f1772efe0c842d64b30fb3866..9a7d166ae2ee5dec085e2a484960e31cbceb55f0 100644 --- a/Framework/Crystal/src/MaskPeaksWorkspace.cpp +++ b/Framework/Crystal/src/MaskPeaksWorkspace.cpp @@ -244,7 +244,7 @@ size_t MaskPeaksWorkspace::getWkspIndex(const detid2index_map &pixel_to_wi, if (x - 1 >= NCOLS || x - 1 < 0 || y - 1 >= NROWS || y - 1 < 0) return EMPTY_INT(); std::string bankName = comp->getName(); - detid2index_map::const_iterator it = + auto it = pixel_to_wi.find(findPixelID(bankName, x, y)); if (it == pixel_to_wi.end()) return EMPTY_INT(); diff --git a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp index 209ad12e60a620e67c88e6836c7ff78f244c7fe1..948c55a451605898c6918e35a8b48e2ca251d189 100644 --- a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp +++ b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp @@ -179,7 +179,7 @@ void OptimizeCrystalPlacement::exec() { for (int i = 0; i < Peaks->getNumberPeaks(); i++) { IPeak &peak = Peaks->getPeak(i); int runNum = peak.getRunNumber(); - std::vector<int>::iterator it = RunNumList.begin(); + auto it = RunNumList.begin(); for (; it != RunNumList.end() && *it != runNum; ++it) { } @@ -243,11 +243,11 @@ void OptimizeCrystalPlacement::exec() { //--------------- std::vector<std::string> ChRunNumList; std::string predChar = ""; - for (std::vector<int>::iterator it = RunNumList.begin(); + for (auto it = RunNumList.begin(); it != RunNumList.end(); ++it) { int runNum = *it; - std::vector<int>::iterator it1 = NOoptimizeRuns.begin(); + auto it1 = NOoptimizeRuns.begin(); for (; it1 != NOoptimizeRuns.end() && *it1 != runNum; ++it1) { } diff --git a/Framework/Crystal/src/PeakHKLErrors.cpp b/Framework/Crystal/src/PeakHKLErrors.cpp index 1fa907e1b5a98c489444f6a26c0295aa6d329af3..e3b109ca1b3896e7f771d6db4df4d82fdbf9eb21 100644 --- a/Framework/Crystal/src/PeakHKLErrors.cpp +++ b/Framework/Crystal/src/PeakHKLErrors.cpp @@ -118,7 +118,7 @@ void PeakHKLErrors::cLone( if (component->isParametrized()) { std::set<std::string> nms = pmapSv->names(component.get()); - for (std::set<std::string>::iterator it = nms.begin(); it != nms.end(); + for (auto it = nms.begin(); it != nms.end(); ++it) { if (pmapSv->contains(component.get(), *it, "double")) { diff --git a/Framework/Crystal/src/PeakIntensityVsRadius.cpp b/Framework/Crystal/src/PeakIntensityVsRadius.cpp index 9f21a085cc0b19a53043378980eaab4d751ec223..8b5edfef7a9a87db40c16478aef3a724d2d6029d 100644 --- a/Framework/Crystal/src/PeakIntensityVsRadius.cpp +++ b/Framework/Crystal/src/PeakIntensityVsRadius.cpp @@ -139,7 +139,7 @@ void PeakIntensityVsRadius::exec() { "Workspace2D", peaksWS->getNumberPeaks(), NumSteps, NumSteps); // Create a text axis for axis(1), with H K L of each peak - TextAxis *ax = new TextAxis(outWS->getNumberHistograms()); + auto ax = new TextAxis(outWS->getNumberHistograms()); for (int i = 0; i < peaksWS->getNumberPeaks(); i++) { V3D hkl = peaksWS->getPeak(i).getHKL(); hkl.round(); // Round HKL to make the string prettier @@ -150,7 +150,7 @@ void PeakIntensityVsRadius::exec() { MatrixWorkspace_sptr outWS2 = WorkspaceFactory::Instance().create("Workspace2D", 4, NumSteps, NumSteps); // Create a text axis for axis(1), with H K L of each peak - TextAxis *ax2 = new TextAxis(outWS2->getNumberHistograms()); + auto ax2 = new TextAxis(outWS2->getNumberHistograms()); ax2->setLabel(0, "I/SigI=2"); ax2->setLabel(1, "I/SigI=3"); ax2->setLabel(2, "I/SigI=5"); diff --git a/Framework/Crystal/src/PredictFractionalPeaks.cpp b/Framework/Crystal/src/PredictFractionalPeaks.cpp index 146e9ade0342ecc2a0cbd36457a2697042aeff55..d65ca2bc8c7edbb505cc74f95149572b571a8151 100644 --- a/Framework/Crystal/src/PredictFractionalPeaks.cpp +++ b/Framework/Crystal/src/PredictFractionalPeaks.cpp @@ -191,7 +191,7 @@ void PredictFractionalPeaks::exec() { SavPk.push_back((int)floor(1000 * hkl1[2] + .5)); // TODO keep list sorted so searching is faster? - vector<vector<int>>::iterator it = + auto it = find(AlreadyDonePeaks.begin(), AlreadyDonePeaks.end(), SavPk); if (it == AlreadyDonePeaks.end()) diff --git a/Framework/Crystal/src/SCDCalibratePanels.cpp b/Framework/Crystal/src/SCDCalibratePanels.cpp index 5927e59958ffe1d0bec91df3f435ec871213942d..a9ccdeb489db05325ac437a9a49983031b255520 100644 --- a/Framework/Crystal/src/SCDCalibratePanels.cpp +++ b/Framework/Crystal/src/SCDCalibratePanels.cpp @@ -183,7 +183,7 @@ void SCDCalibratePanels::CalculateGroups( Groups.clear(); if (Grouping == "OnePanelPerGroup") { - for (set<string>::iterator it = AllBankNames.begin(); + for (auto it = AllBankNames.begin(); it != AllBankNames.end(); ++it) { string bankName = (*it); vector<string> vbankName; @@ -194,7 +194,7 @@ void SCDCalibratePanels::CalculateGroups( } else if (Grouping == "AllPanelsInOneGroup") { vector<string> vbankName; - for (set<string>::iterator it = AllBankNames.begin(); + for (auto it = AllBankNames.begin(); it != AllBankNames.end(); ++it) { string bankName = (*it); @@ -319,7 +319,7 @@ boost::shared_ptr<const Instrument> SCDCalibratePanels::GetNewCalibInstrument( boost::shared_ptr<const ParameterMap> pmap0 = instrument->getParameterMap(); boost::shared_ptr<ParameterMap> pmap1(new ParameterMap()); - for (vector<string>::iterator vit = AllBankNames.begin(); + for (auto vit = AllBankNames.begin(); vit != AllBankNames.end(); ++vit) { string bankName = (*vit); updateBankParams(instrument->getComponentByName(bankName), pmap1, pmap0); @@ -1650,7 +1650,7 @@ void SCDCalibratePanels::FixUpBankParameterMap( boost::shared_ptr<const ParameterMap> const pmapOld, bool RotCenters) { boost::shared_ptr<ParameterMap> pmap = NewInstrument->getParameterMap(); - for (vector<string>::const_iterator it1 = bankNames.begin(); + for (auto it1 = bankNames.begin(); it1 != bankNames.end(); ++it1) { const string bankName = (*it1); @@ -1737,9 +1737,9 @@ void SCDCalibratePanels::saveXmlFile( ParameterMap_sptr pmap = instrument->getParameterMap(); // write out the detector banks - for (vector<vector<string>>::const_iterator it = Groups.begin(); + for (auto it = Groups.begin(); it != Groups.end(); ++it) { - for (vector<string>::const_iterator it1 = (*it).begin(); it1 != (*it).end(); + for (auto it1 = (*it).begin(); it1 != (*it).end(); ++it1) { string bankName = (*it1); diff --git a/Framework/Crystal/src/SCDPanelErrors.cpp b/Framework/Crystal/src/SCDPanelErrors.cpp index dabf6e7c6b78530ac8339c79ba52ea79acfb4fa0..8dc96b7243b7c459ab1e46bc03218e87b35074fc 100644 --- a/Framework/Crystal/src/SCDPanelErrors.cpp +++ b/Framework/Crystal/src/SCDPanelErrors.cpp @@ -664,7 +664,7 @@ void SCDPanelErrors::functionDeriv1D(Jacobian *out, const double *xValues, AllBankNames.insert(m_peaks->getPeak(i).getBankName()); Instrument_sptr instrNew = getNewInstrument(m_peaks->getPeak(0)); - for (std::set<string>::iterator it = AllBankNames.begin(); + for (auto it = AllBankNames.begin(); it != AllBankNames.end(); ++it) { std::string bankName = (*it); boost::shared_ptr<const IComponent> panel = @@ -779,7 +779,7 @@ void SCDPanelErrors::functionDeriv1D(Jacobian *out, const double *xValues, for (size_t gr = 0; gr < Groups.size(); ++gr) { vector<string> banknames; boost::split(banknames, Groups[gr], boost::is_any_of("/")); - for (vector<string>::iterator it = banknames.begin(); it != banknames.end(); + for (auto it = banknames.begin(); it != banknames.end(); ++it) bankName2Group[(*it)] = gr; } diff --git a/Framework/Crystal/src/SetGoniometer.cpp b/Framework/Crystal/src/SetGoniometer.cpp index d6a15000cd9e0578390372892086072f822fd616..a2dc189476eececa1d8255d60f02f069c73ebf1f 100644 --- a/Framework/Crystal/src/SetGoniometer.cpp +++ b/Framework/Crystal/src/SetGoniometer.cpp @@ -97,7 +97,7 @@ void SetGoniometer::exec() { axisName = "GoniometerAxis" + Strings::toString(i) + "_FixedValue"; try { Kernel::DateAndTime now = Kernel::DateAndTime::getCurrentTime(); - Kernel::TimeSeriesProperty<double> *tsp = + auto tsp = new Kernel::TimeSeriesProperty<double>(axisName); tsp->addValue(now, angle); tsp->setUnits("degree"); diff --git a/Framework/CurveFitting/src/Algorithms/Fit1D.cpp b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp index 3f3db8ff573c4ba24d9da29b069138b950125401..3e5187b44c4f15868be41430535ae6f2e1819518 100644 --- a/Framework/CurveFitting/src/Algorithms/Fit1D.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp @@ -705,7 +705,7 @@ void Fit1D::exec() { MantidVec &Y = ws->dataY(1); MantidVec &E = ws->dataY(2); - double *lOut = + auto lOut = new double[l_data.n]; // to capture output from call to function() modifyInitialFittedParameters(m_fittedParameter); // does nothing except if // overwritten by derived diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index 71021ad4567b7bbed8fc34f07954ebad74a60fa3..d4d229fcb95b1717856ff9aa2fd13ab149cf9341 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -1677,7 +1677,7 @@ void FitPowderDiffPeaks::restoreFunctionParameters( vector<string> paramnames = function->getParameterNames(); for (size_t i = 0; i < paramnames.size(); ++i) { string &parname = paramnames[i]; - map<string, double>::iterator miter = parammap.find(parname); + auto miter = parammap.find(parname); if (miter != parammap.end()) function->setParameter(parname, miter->second); } @@ -2516,7 +2516,7 @@ Workspace2D_sptr FitPowderDiffPeaks::genPeakParameterDataWorkspace() { // 4. Set Axis label paramws->getAxis(0)->setUnit("dSpacing"); - TextAxis *taxis = new TextAxis(4); + auto taxis = new TextAxis(4); taxis->setLabel(0, "X0"); taxis->setLabel(1, "A"); taxis->setLabel(2, "B"); @@ -2549,7 +2549,7 @@ FitPowderDiffPeaks::genPeakParametersWorkspace() { vecsigma(numpeaks); // 2. Generate the TableWorkspace for peak parameters - TableWorkspace *tablewsptr = new TableWorkspace(); + auto tablewsptr = new TableWorkspace(); TableWorkspace_sptr tablews = TableWorkspace_sptr(tablewsptr); tablews->addColumn("int", "H"); @@ -2627,7 +2627,7 @@ FitPowderDiffPeaks::genPeakParametersWorkspace() { vector<double> zsigma = Kernel::getZscore(vecsigma); // ii. Build table workspace for Z scores - TableWorkspace *ztablewsptr = new TableWorkspace(); + auto ztablewsptr = new TableWorkspace(); TableWorkspace_sptr ztablews = TableWorkspace_sptr(ztablewsptr); ztablews->addColumn("int", "H"); @@ -3011,7 +3011,7 @@ void FitPowderDiffPeaks::plotFunction(IFunction_sptr peakfunction, // 1. Determine range const MantidVec &vecX = m_dataWS->readX(m_wsIndex); double x0 = domain[0]; - vector<double>::const_iterator viter = + auto viter = lower_bound(vecX.begin(), vecX.end(), x0); int ix0 = static_cast<int>(viter - vecX.begin()); diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 21d6e9af3d6c32ae3b6a07aa2cd14487ad0aac60..49c9262997f82269d98da3752dff6d229dc3b98a 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -1623,7 +1623,7 @@ void LeBailFit::doMarkovChain(const map<string, Parameter> ¶mmap, for (size_t icycle = 1; icycle <= maxcycles; ++icycle) { // Refine parameters (for all parameters in turn) to data with background // removed - for (map<int, vector<string>>::iterator giter = m_MCGroups.begin(); + for (auto giter = m_MCGroups.begin(); giter != m_MCGroups.end(); ++giter) { // Propose new value for ONE AND ONLY ONE Monte Carlo parameter group /* @@ -1822,7 +1822,7 @@ void LeBailFit::setupRandomWalkStrategyFromTable( } // 3. Set up MC parameters, A0, A1, non-negative - map<string, Parameter>::iterator piter = m_funcParameters.find(parname); + auto piter = m_funcParameters.find(parname); if (piter != m_funcParameters.end()) { piter->second.mcA0 = a0; piter->second.mcA1 = a1; @@ -2171,7 +2171,7 @@ bool LeBailFit::proposeNewValues(vector<string> mcgroup, Rfactor r, for (size_t i = 0; i < mcgroup.size(); ++i) { // Find out the i-th parameter to be refined or not string paramname = mcgroup[i]; - map<string, Parameter>::iterator mapiter = curparammap.find(paramname); + auto mapiter = curparammap.find(paramname); if (mapiter == curparammap.end()) { stringstream errmsg; errmsg << "Parameter to update (" << paramname @@ -2262,7 +2262,7 @@ bool LeBailFit::proposeNewValues(vector<string> mcgroup, Rfactor r, } // Apply to new parameter map - map<string, Parameter>::iterator newmiter = newparammap.find(paramname); + auto newmiter = newparammap.find(paramname); if (newmiter == newparammap.end()) throw runtime_error( "New parameter map does not contain parameter that is updated."); diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp index 0d9ee16925a41aaa4efb24ce3524080ca49365b9..d7b3e69cd38b1a40062fca57d74e0d67cc842c01 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp @@ -166,7 +166,7 @@ void LeBailFunction::calPeak(size_t ipk, std::vector<double> &out, * @param paramname :: parameter name to check with */ bool LeBailFunction::hasProfileParameter(std::string paramname) { - vector<string>::iterator fiter = + auto fiter = lower_bound(m_orderedProfileParameterNames.begin(), m_orderedProfileParameterNames.end(), paramname); @@ -1101,7 +1101,7 @@ double LeBailFunction::getPeakParameterValue(API::IPowderDiffPeakFunction_sptr peak, std::string parname) const { // Locate the category of the parameter name - vector<string>::const_iterator vsiter = + auto vsiter = lower_bound(m_orderedProfileParameterNames.begin(), m_orderedProfileParameterNames.end(), parname); diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index 62d813090d543f1013877392a48ab2a4afde41d9..2602eae8634ebf482d31efc9f0d2815f8b40193c 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -521,7 +521,7 @@ PlotPeakByLogValue::makeNames() const { typedef Poco::StringTokenizer tokenizer; tokenizer names(inputList, ";", tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM); - for (tokenizer::Iterator it = names.begin(); it != names.end(); ++it) { + for (auto it = names.begin(); it != names.end(); ++it) { tokenizer params(*it, ",", tokenizer::TOK_TRIM); std::string name = params[0]; int wi = default_wi; @@ -574,7 +574,7 @@ PlotPeakByLogValue::makeNames() const { boost::dynamic_pointer_cast<API::WorkspaceGroup>(ws); if (wsg) { std::vector<std::string> wsNames = wsg->getNames(); - for (std::vector<std::string>::iterator i = wsNames.begin(); + for (auto i = wsNames.begin(); i != wsNames.end(); ++i) { nameList.push_back(InputData(*i, wi, -1, period, start, end)); } diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index f87a83a0013f454452b40c588a6b9787401d477a..d8c3ee728ba436e3cb178244a4870ddc7bef4241 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -1107,7 +1107,7 @@ TableWorkspace_sptr RefinePowderInstrumentParameters3::genOutputProfileTable( */ void RefinePowderInstrumentParameters3::addOrReplace( map<string, Parameter> ¶meters, string parname, double parvalue) { - map<string, Parameter>::iterator pariter = parameters.find(parname); + auto pariter = parameters.find(parname); if (pariter != parameters.end()) { parameters[parname].curvalue = parvalue; } else { @@ -1134,7 +1134,7 @@ Workspace2D_sptr RefinePowderInstrumentParameters3::genOutputWorkspace( outws->getAxis(0)->setUnit("dSpacing"); - TextAxis *taxis = new TextAxis(outws->getNumberHistograms()); + auto taxis = new TextAxis(outws->getNumberHistograms()); taxis->setLabel(0, "Data"); taxis->setLabel(1, "Model"); taxis->setLabel(2, "DiffDM"); @@ -1426,7 +1426,7 @@ void restoreFunctionParameterValue( function->setParameter(parname, parvalue); // 2. Parameter map - map<string, Parameter>::iterator pariter = parammap.find(parname); + auto pariter = parammap.find(parname); if (pariter != parammap.end()) { // Find the entry pariter->second.curvalue = parvalue; diff --git a/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp index 9d1a1bc531c9d0dc3c765ddf3a904e1bf1955a7c..3c2d494d49dfb907887cf211c38e761fb64e1a40 100644 --- a/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp @@ -111,7 +111,7 @@ void SplineInterpolation::exec() { // check if we want derivatives if (order > 0) { derivs[i] = WorkspaceFactory::Instance().create(mws, order); - NumericAxis *vAxis = new API::NumericAxis(order); + auto vAxis = new API::NumericAxis(order); // calculate the derivatives for each order chosen for (int j = 0; j < order; ++j) { diff --git a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp index 48b809991b7f6eaacaa25569817c71ecb809612a..6adf02c4ff890e50c40d0503b71da48c04a82758 100644 --- a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp @@ -177,7 +177,7 @@ SplineSmoothing::setupOutputWorkspace(API::MatrixWorkspace_const_sptr inws, WorkspaceFactory::Instance().create(inws, size); // create labels for output workspace - API::TextAxis *tAxis = new API::TextAxis(size); + auto tAxis = new API::TextAxis(size); for (int i = 0; i < size; ++i) { std::string index = boost::lexical_cast<std::string>(i); tAxis->setLabel(i, "Y" + index); @@ -362,7 +362,7 @@ void SplineSmoothing::selectSmoothingPoints( m_cspline->function1D(ysmooth.get(), xs.data(), xSize); // iterate over smoothing points - std::set<int>::const_iterator iter = smoothPts.begin(); + auto iter = smoothPts.begin(); int start = *iter; for (++iter; iter != smoothPts.end(); ++iter) { diff --git a/Framework/CurveFitting/src/FitMW.cpp b/Framework/CurveFitting/src/FitMW.cpp index 54f210671add204035e4914c89b5d48f149b6818..07e6377198a1ac5975dbbe1f18f522c08ea09d94 100644 --- a/Framework/CurveFitting/src/FitMW.cpp +++ b/Framework/CurveFitting/src/FitMW.cpp @@ -173,7 +173,7 @@ void FitMW::createDomain(boost::shared_ptr<API::FunctionDomain> &domain, Mantid::MantidVec::const_iterator from; size_t n = 0; getStartIterator(X, from, n, m_matrixWorkspace->isHistogramData()); - Mantid::MantidVec::const_iterator to = from + n; + auto to = from + n; if (m_domainType != Simple) { if (m_maxSize < n) { @@ -182,7 +182,7 @@ void FitMW::createDomain(boost::shared_ptr<API::FunctionDomain> &domain, size_t m = 0; while (m < n) { // create a simple creator - FitMW *creator = new FitMW; + auto creator = new FitMW; creator->setWorkspace(m_matrixWorkspace); creator->setWorkspaceIndex(m_workspaceIndex); size_t k = m + m_maxSize; @@ -201,7 +201,7 @@ void FitMW::createDomain(boost::shared_ptr<API::FunctionDomain> &domain, // set function domain if (m_matrixWorkspace->isHistogramData()) { std::vector<double> x(static_cast<size_t>(to - from)); - Mantid::MantidVec::const_iterator it = from; + auto it = from; for (size_t i = 0; it != to; ++it, ++i) { x[i] = (*it + *(it + 1)) / 2; } @@ -536,7 +536,7 @@ API::MatrixWorkspace_sptr FitMW::createEmptyResultWS(const size_t nhistograms, ws->setYUnitLabel(m_matrixWorkspace->YUnitLabel()); ws->setYUnit(m_matrixWorkspace->YUnit()); ws->getAxis(0)->unit() = m_matrixWorkspace->getAxis(0)->unit(); - API::TextAxis *tAxis = new API::TextAxis(nhistograms); + auto tAxis = new API::TextAxis(nhistograms); ws->replaceAxis(1, tAxis); const MantidVec &inputX = m_matrixWorkspace->readX(m_workspaceIndex); diff --git a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp index fcdedf14c5017e8603999ccc7f97b1b8076febef..3b7a6a55fafe4db86c75799a63fe638bc71c3415 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp @@ -516,7 +516,7 @@ void FABADAMinimizer::finalize() { Y[i - 1] = pdf_y[i - 1] / (double(conv_length) * bin); } - std::vector<double>::iterator pos_MPchi2 = + auto pos_MPchi2 = std::max_element(pdf_y.begin(), pdf_y.end()); if (pos_MPchi2 - pdf_y.begin() == 0) { @@ -548,7 +548,7 @@ void FABADAMinimizer::finalize() { } // Calculate the most probable value, from the PDF. - std::vector<double>::iterator pos_MP = + auto pos_MP = std::max_element(pdf_y.begin(), pdf_y.end()); double mostP = X[pos_MP - pdf_y.begin()] + (bin / 2.0); m_leastSquares->setParameter(j, mostP); diff --git a/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp index c451d8d528adedf27626917dd0b574be8fffcbda..cd6b7cd107f35dd2a123dfed6d03dd00680fd27f 100644 --- a/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/NeutronBk2BkExpConvPVoigt.cpp @@ -344,11 +344,11 @@ void NeutronBk2BkExpConvPVoigt::function(vector<double> &out, const double RANGE = m_fwhm * PEAKRANGE; const double LEFT_VALUE = m_centre - RANGE; - vector<double>::const_iterator iter = + auto iter = std::lower_bound(xValues.begin(), xValues.end(), LEFT_VALUE); const double RIGHT_VALUE = m_centre + RANGE; - vector<double>::const_iterator iter_end = + auto iter_end = std::lower_bound(iter, xValues.end(), RIGHT_VALUE); // Calcualte diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index 3df0c026c17f7f09df892405a48b89137f95b329..926375399e6f64665eaa445934a22a0e8b38c70c 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -422,7 +422,7 @@ void ProcessBackground::addRegion() { double tmpe = refE[i]; // Locate the position of tmpx in the array to be inserted - std::vector<double>::iterator newit = + auto newit = std::lower_bound(vx.begin(), vx.end(), tmpx); size_t newindex = size_t(newit - vx.begin()); @@ -599,7 +599,7 @@ void ProcessBackground::selectFromGivenFunction() { int bkgdorder = static_cast<int>(parmap.size() - 1); // A0 - A(n) total n+1 parameters bkgdfunc->setAttributeValue("n", bkgdorder); - for (map<string, double>::iterator mit = parmap.begin(); mit != parmap.end(); + for (auto mit = parmap.begin(); mit != parmap.end(); ++mit) { string parname = mit->first; double parvalue = mit->second; diff --git a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp index d0efc13940ae2ce8c316fbd2d6445b2839293b20..c23be9d25315a0d81cb7ee13906b0ba945925f18 100644 --- a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp +++ b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp @@ -55,7 +55,7 @@ void TabulatedFunction::eval(double scaling, double xshift, double xscale, // shift and scale the domain over which the function is defined std::vector<double> xData(m_xData); - for (std::vector<double>::iterator it = xData.begin(); it != xData.end(); + for (auto it = xData.begin(); it != xData.end(); ++it) { *it *= xscale; *it += xshift; diff --git a/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp index 8ee59b58177ad3525a2615c6ef4ec8fcd8b8703a..fa5962e2b41068b8345774c4c8c24109a55e24ff 100644 --- a/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronBk2BkExpConvPVoigt.cpp @@ -438,11 +438,11 @@ void ThermalNeutronBk2BkExpConvPVoigt::function( // calculate where to start calculating const double LEFT_VALUE = m_centre - RANGE; - vector<double>::const_iterator iter = + auto iter = std::lower_bound(xValues.begin(), xValues.end(), LEFT_VALUE); const double RIGHT_VALUE = m_centre + RANGE; - vector<double>::const_iterator iter_end = + auto iter_end = std::lower_bound(iter, xValues.end(), RIGHT_VALUE); // 2. Calcualte diff --git a/Framework/CurveFitting/src/LatticeDomainCreator.cpp b/Framework/CurveFitting/src/LatticeDomainCreator.cpp index db2ebe4bde9fca3df9b46c7a12805e94876df8e1..9ff4e0d7c97fa8c51eb006a4a36119ca00395a2d 100644 --- a/Framework/CurveFitting/src/LatticeDomainCreator.cpp +++ b/Framework/CurveFitting/src/LatticeDomainCreator.cpp @@ -194,11 +194,11 @@ void LatticeDomainCreator::createDomainFromPeaksWorkspace( } } - LatticeDomain *latticeDomain = new LatticeDomain(hkls); + auto latticeDomain = new LatticeDomain(hkls); domain.reset(latticeDomain); if (!values) { - FunctionValues *functionValues = new FunctionValues(*domain); + auto functionValues = new FunctionValues(*domain); values.reset(functionValues); } else { values->expand(i0 + latticeDomain->size()); @@ -262,11 +262,11 @@ void LatticeDomainCreator::createDomainFromPeakTable( } } - LatticeDomain *latticeDomain = new LatticeDomain(hkls); + auto latticeDomain = new LatticeDomain(hkls); domain.reset(latticeDomain); if (!values) { - FunctionValues *functionValues = new FunctionValues(*domain); + auto functionValues = new FunctionValues(*domain); values.reset(functionValues); } else { values->expand(i0 + latticeDomain->size()); diff --git a/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp b/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp index 550a571fd71460b1b7aabeab1fce22bde413bfa9..55e08b17b60bf15ea7025698f26e87078ad004b0 100644 --- a/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp +++ b/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp @@ -60,7 +60,7 @@ void SeqDomainSpectrumCreator::createDomain( size_t numberOfHistograms = m_matrixWorkspace->getNumberHistograms(); for (size_t i = 0; i < numberOfHistograms; ++i) { if (histogramIsUsable(i)) { - FunctionDomain1DSpectrumCreator *spectrumDomain = + auto spectrumDomain = new FunctionDomain1DSpectrumCreator; spectrumDomain->setMatrixWorkspace(m_matrixWorkspace); spectrumDomain->setWorkspaceIndex(i); diff --git a/Framework/DataHandling/src/CheckMantidVersion.cpp b/Framework/DataHandling/src/CheckMantidVersion.cpp index 01776379510adfeda238fd768ab2a72cf9949863..c64067efecffda8d31339cdcc36af2b7b1c24045 100644 --- a/Framework/DataHandling/src/CheckMantidVersion.cpp +++ b/Framework/DataHandling/src/CheckMantidVersion.cpp @@ -178,7 +178,7 @@ CheckMantidVersion::splitVersionString(const std::string &versionString) const { Poco::StringTokenizer tokenizer(versionString, ".", Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY); - Poco::StringTokenizer::Iterator h = tokenizer.begin(); + auto h = tokenizer.begin(); for (; h != tokenizer.end(); ++h) { try { diff --git a/Framework/DataHandling/src/DeleteTableRows.cpp b/Framework/DataHandling/src/DeleteTableRows.cpp index 3a9b1c3bbb4c034c2bb6dff9d20d186847f51303..6271253dabd8d6ea4932c4e97867a973f80d58d8 100644 --- a/Framework/DataHandling/src/DeleteTableRows.cpp +++ b/Framework/DataHandling/src/DeleteTableRows.cpp @@ -38,7 +38,7 @@ void DeleteTableRows::exec() { std::vector<size_t> rows = getProperty("Rows"); // sort the row indices in reverse order std::set<size_t, std::greater<size_t>> sortedRows(rows.begin(), rows.end()); - std::set<size_t, std::greater<size_t>>::iterator it = sortedRows.begin(); + auto it = sortedRows.begin(); for (; it != sortedRows.end(); ++it) { if (*it >= tw->rowCount()) continue; diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index 4932c10bea25c9b1a318719f087d93eee00be5dc..efc9b531f899e7b87e09b04042cb9bd6ea19a9d7 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -515,7 +515,7 @@ void FilterEventsByLogValuePreNexus::processProperties() { m_loadOnlySomeSpectra = (this->m_spectraList.size() > 0); // Turn the spectra list into a map, for speed of access - for (std::vector<int64_t>::iterator it = m_spectraList.begin(); + for (auto it = m_spectraList.begin(); it != m_spectraList.end(); it++) spectraLoadMap[*it] = true; @@ -676,7 +676,7 @@ void FilterEventsByLogValuePreNexus::processEventLogs() { void FilterEventsByLogValuePreNexus::addToWorkspaceLog(std::string logtitle, size_t mindex) { // Create TimeSeriesProperty - TimeSeriesProperty<double> *property = + auto property = new TimeSeriesProperty<double>(logtitle); // Add entries @@ -1377,7 +1377,7 @@ void FilterEventsByLogValuePreNexus::procEventsLinear( // Obtain the global map index for this wrong detector ID events entry in // local map size_t mindex = 0; - std::map<PixelType, size_t>::iterator git = + auto git = this->wrongdetidmap.find(tmpid); if (git == this->wrongdetidmap.end()) { // Create 'wrong detid' global map entry if not there @@ -1395,7 +1395,7 @@ void FilterEventsByLogValuePreNexus::procEventsLinear( } // Find local map index - std::map<PixelType, size_t>::iterator lit = local_pidindexmap.find(tmpid); + auto lit = local_pidindexmap.find(tmpid); size_t localindex = lit->second; // Append local (thread) loaded events (pulse + tof) to global wrong detid @@ -2253,7 +2253,7 @@ void FilterEventsByLogValuePreNexus::setupPixelSpectrumMap( eventws->getInstrument()->getDetectors(detector_map); // Set up - for (detid2det_map::iterator it = detector_map.begin(); + for (auto it = detector_map.begin(); it != detector_map.end(); it++) { if (!it->second->isMonitor()) { // Add non-monitor detector ID diff --git a/Framework/DataHandling/src/GroupDetectors.cpp b/Framework/DataHandling/src/GroupDetectors.cpp index 5ff3c1c1b7d2b4ecf235f9a8a1c9d7ae0058d6a0..40a8b84271df67fddb47f6b0f62094af2297e0e3 100644 --- a/Framework/DataHandling/src/GroupDetectors.cpp +++ b/Framework/DataHandling/src/GroupDetectors.cpp @@ -106,9 +106,9 @@ void GroupDetectors::exec() { firstSpectrum->addDetectorIDs(spec->getDetectorIDs()); // Add up all the Y spectra and store the result in the first one - MantidVec::iterator fEit = firstSpectrum->dataE().begin(); - MantidVec::iterator Yit = spec->dataY().begin(); - MantidVec::iterator Eit = spec->dataE().begin(); + auto fEit = firstSpectrum->dataE().begin(); + auto Yit = spec->dataY().begin(); + auto Eit = spec->dataE().begin(); for (auto fYit = firstY.begin(); fYit != firstY.end(); ++fYit, ++fEit, ++Yit, ++Eit) { *fYit += *Yit; diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 8e9b3d0d0927e0d5a746f0cf5c994dfbc6a40d3c..c38ccd472bf0c41c1d21b07f1eb9428e8584bbbe 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -535,7 +535,7 @@ void GroupDetectors2::processXMLFile(std::string fname, for (size_t i = 0; i < detids.size(); i++) { detid_t detid = detids[i]; - detid2index_map::const_iterator ind = detIdToWiMap.find(detid); + auto ind = detIdToWiMap.find(detid); if (ind != detIdToWiMap.end()) { size_t wsid = ind->second; wsindexes.push_back(wsid); @@ -564,7 +564,7 @@ void GroupDetectors2::processXMLFile(std::string fname, for (size_t i = 0; i < spectra.size(); i++) { int specid = spectra[i]; - spec2index_map::iterator ind = specs2index.find(specid); + auto ind = specs2index.find(specid); if (ind != specs2index.end()) { size_t wsid = ind->second; wsindexes.push_back(wsid); @@ -858,8 +858,8 @@ void GroupDetectors2::readSpectraIndexes(std::string line, std::string seperator) { // remove comments and white space Poco::StringTokenizer dataComment(line, seperator, IGNORE_SPACES); - Poco::StringTokenizer::Iterator iend = dataComment.end(); - for (Poco::StringTokenizer::Iterator itr = dataComment.begin(); itr != iend; + auto iend = dataComment.end(); + for (auto itr = dataComment.begin(); itr != iend; ++itr) { std::vector<size_t> specNums; specNums.reserve(output.capacity()); @@ -967,7 +967,7 @@ size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS, size_t nonMaskedSpectra(0); beh->dataX(outIndex)[0] = 0.0; beh->dataE(outIndex)[0] = 0.0; - for (std::vector<size_t>::const_iterator wsIter = it->second.begin(); + for (auto wsIter = it->second.begin(); wsIter != it->second.end(); ++wsIter) { const size_t originalWI = *wsIter; @@ -975,9 +975,9 @@ size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS, const ISpectrum *fromSpectrum = inputWS->getSpectrum(originalWI); // Add up all the Y spectra and store the result in the first one - MantidVec::iterator fEit = outSpec->dataE().begin(); - MantidVec::const_iterator Yit = fromSpectrum->dataY().begin(); - MantidVec::const_iterator Eit = fromSpectrum->dataE().begin(); + auto fEit = outSpec->dataE().begin(); + auto Yit = fromSpectrum->dataY().begin(); + auto Eit = fromSpectrum->dataE().begin(); for (auto fYit = firstY.begin(); fYit != firstY.end(); ++fYit, ++fEit, ++Yit, ++Eit) { *fYit += *Yit; @@ -1075,7 +1075,7 @@ GroupDetectors2::formGroupsEvent(DataObjects::EventWorkspace_const_sptr inputWS, size_t nonMaskedSpectra(0); beh->dataX(outIndex)[0] = 0.0; beh->dataE(outIndex)[0] = 0.0; - for (std::vector<size_t>::const_iterator wsIter = it->second.begin(); + for (auto wsIter = it->second.begin(); wsIter != it->second.end(); ++wsIter) { const size_t originalWI = *wsIter; @@ -1144,7 +1144,7 @@ void GroupDetectors2::moveOthers(const std::set<int64_t> &unGroupedSet, double prog4Copy = (1. - 1. * static_cast<double>(m_FracCompl)) / static_cast<double>(unGroupedSet.size()); - std::set<int64_t>::const_iterator copyFrIt = unGroupedSet.begin(); + auto copyFrIt = unGroupedSet.begin(); // go thorugh all the spectra in the input workspace for (; copyFrIt != unGroupedSet.end(); ++copyFrIt) { if (*copyFrIt == USED) @@ -1202,7 +1202,7 @@ void GroupDetectors2::moveOthersEvent( double prog4Copy = (1. - 1. * static_cast<double>(m_FracCompl)) / static_cast<double>(unGroupedSet.size()); - std::set<int64_t>::const_iterator copyFrIt = unGroupedSet.begin(); + auto copyFrIt = unGroupedSet.begin(); // go thorugh all the spectra in the input workspace for (; copyFrIt != unGroupedSet.end(); ++copyFrIt) { if (*copyFrIt == USED) @@ -1262,7 +1262,7 @@ void GroupDetectors2::RangeHelper::getList(const std::string &line, size_t loop = 0; do { Poco::StringTokenizer beforeHyphen(ranges[loop], " ", IGNORE_SPACES); - Poco::StringTokenizer::Iterator readPostion = beforeHyphen.begin(); + auto readPostion = beforeHyphen.begin(); if (readPostion == beforeHyphen.end()) { throw std::invalid_argument("'-' found at the start of a list, can't " "interpret range specification"); diff --git a/Framework/DataHandling/src/ISISDataArchive.cpp b/Framework/DataHandling/src/ISISDataArchive.cpp index 033e7187378799512317c1a90cf582ac62de2f57..b6f3ce17d803a1084c5693b1c37581c79a589350 100644 --- a/Framework/DataHandling/src/ISISDataArchive.cpp +++ b/Framework/DataHandling/src/ISISDataArchive.cpp @@ -42,18 +42,18 @@ const char *URL_PREFIX = "http://data.isis.rl.ac.uk/where.py/unixdir?name="; std::string ISISDataArchive::getArchivePath(const std::set<std::string> &filenames, const std::vector<std::string> &exts) const { - std::set<std::string>::const_iterator iter = filenames.begin(); + auto iter = filenames.begin(); for (; iter != filenames.end(); ++iter) { g_log.debug() << *iter << ")\n"; } - std::vector<std::string>::const_iterator iter2 = exts.begin(); + auto iter2 = exts.begin(); for (; iter2 != exts.end(); ++iter2) { g_log.debug() << *iter2 << ")\n"; } - std::vector<std::string>::const_iterator ext = exts.begin(); + auto ext = exts.begin(); for (; ext != exts.end(); ++ext) { - std::set<std::string>::const_iterator it = filenames.begin(); + auto it = filenames.begin(); for (; it != filenames.end(); ++it) { const std::string fullPath = getPath(*it + *ext); if (!fullPath.empty()) diff --git a/Framework/DataHandling/src/Load.cpp b/Framework/DataHandling/src/Load.cpp index 5eb84e66ba570152a4a122508fe1a358aaef3986..21819b803913afe8717bc536b4ed588edd3bae86 100644 --- a/Framework/DataHandling/src/Load.cpp +++ b/Framework/DataHandling/src/Load.cpp @@ -34,7 +34,7 @@ namespace { */ bool isSingleFile(const std::vector<std::vector<std::string>> &fileNames) { if (fileNames.size() == 1) { - std::vector<std::vector<std::string>>::const_iterator first = + auto first = fileNames.begin(); if (first->size() == 1) return true; @@ -386,7 +386,7 @@ void Load::loadMultipleFiles() { std::transform(allFilenames.begin(), allFilenames.end(), wsNames.begin(), generateWsNameFromFileNames); - std::vector<std::vector<std::string>>::const_iterator filenames = + auto filenames = allFilenames.begin(); std::vector<std::string>::const_iterator wsName = wsNames.begin(); assert(allFilenames.size() == wsNames.size()); @@ -398,7 +398,7 @@ void Load::loadMultipleFiles() { // Cycle through the filenames and wsNames. for (; filenames != allFilenames.end(); ++filenames, ++wsName) { - std::vector<std::string>::const_iterator filename = filenames->begin(); + auto filename = filenames->begin(); Workspace_sptr sumWS = loadFileToWs(*filename, *wsName); ++filename; @@ -648,7 +648,7 @@ API::Workspace_sptr Load::loadFileToWs(const std::string &fileName, const std::vector<Kernel::Property *> &props = getProperties(); // Loop through and set the properties on the Child Algorithm - std::vector<Kernel::Property *>::const_iterator prop = props.begin(); + auto prop = props.begin(); for (; prop != props.end(); ++prop) { const std::string &propName = (*prop)->name(); diff --git a/Framework/DataHandling/src/LoadAscii.cpp b/Framework/DataHandling/src/LoadAscii.cpp index 74dda663af566b72c71ca5209a90493ddff03af7..37c4d9da4fcb4e1b130e198db1475be06f5d27b4 100644 --- a/Framework/DataHandling/src/LoadAscii.cpp +++ b/Framework/DataHandling/src/LoadAscii.cpp @@ -278,9 +278,9 @@ int LoadAscii::splitIntoColumns(std::list<std::string> &columns, void LoadAscii::fillInputValues(std::vector<double> &values, const std::list<std::string> &columns) const { values.resize(columns.size()); - std::list<std::string>::const_iterator iend = columns.end(); + auto iend = columns.end(); int i = 0; - for (std::list<std::string>::const_iterator itr = columns.begin(); + for (auto itr = columns.begin(); itr != iend; ++itr) { std::string value = *itr; boost::trim(value); diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp index 94c2b59e2dc5b9cd91922a24db8994a9ca3518de..a5c4825e764ba4307a72d896671a032d19e5185f 100644 --- a/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Framework/DataHandling/src/LoadAscii2.cpp @@ -555,9 +555,9 @@ int LoadAscii2::splitIntoColumns(std::list<std::string> &columns, void LoadAscii2::fillInputValues(std::vector<double> &values, const std::list<std::string> &columns) const { values.resize(columns.size()); - std::list<std::string>::const_iterator iend = columns.end(); + auto iend = columns.end(); int i = 0; - for (std::list<std::string>::const_iterator itr = columns.begin(); + for (auto itr = columns.begin(); itr != iend; ++itr) { std::string value = *itr; boost::trim(value); @@ -670,7 +670,7 @@ void LoadAscii2::exec() { } // Else if the separator drop down choice is not UserDefined then we use that. else if (choice != "UserDefined") { - std::map<std::string, std::string>::iterator it = + auto it = m_separatorIndex.find(choice); sep = it->second; } diff --git a/Framework/DataHandling/src/LoadBBY.cpp b/Framework/DataHandling/src/LoadBBY.cpp index a1b1bb518c386230d85532a7f746dc2e3f37d8c4..15749cc1eeb8a0e4c07c314e71dce9122432a929 100644 --- a/Framework/DataHandling/src/LoadBBY.cpp +++ b/Framework/DataHandling/src/LoadBBY.cpp @@ -46,7 +46,7 @@ void AddSinglePointTimeSeriesProperty(API::LogManager &logManager, const std::string &name, const TYPE value) { // create time series property and add single value - Kernel::TimeSeriesProperty<TYPE> *p = + auto p = new Kernel::TimeSeriesProperty<TYPE>(name); p->addValue(time, value); diff --git a/Framework/DataHandling/src/LoadDaveGrp.cpp b/Framework/DataHandling/src/LoadDaveGrp.cpp index 45ddef1b6dcfb71749e2649ed8207bacd7b6f61b..abe45c25612a635b38e7b411947100f1210620ab 100644 --- a/Framework/DataHandling/src/LoadDaveGrp.cpp +++ b/Framework/DataHandling/src/LoadDaveGrp.cpp @@ -111,8 +111,8 @@ void LoadDaveGrp::exec() { int yLength = 0; - MantidVec *xAxis = new MantidVec(); - MantidVec *yAxis = new MantidVec(); + auto xAxis = new MantidVec(); + auto yAxis = new MantidVec(); std::vector<MantidVec *> data; std::vector<MantidVec *> errors; @@ -235,8 +235,8 @@ void LoadDaveGrp::getData(std::vector<MantidVec *> &data, // Skip the group comment line this->readLine(); // Read the data block - MantidVec *d = new MantidVec(); - MantidVec *e = new MantidVec(); + auto d = new MantidVec(); + auto e = new MantidVec(); for (std::size_t k = 0; k < static_cast<std::size_t>(this->xLength); k++) { this->readLine(); std::istringstream is(this->line); diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index 439c8be73f5faaa2e1560be63b4d0a17fa87367f..63d6f38c0b3d90965716dc7467ccd3b39fb8040f 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -212,7 +212,7 @@ void LoadDetectorsGroupingFile::setByComponents() { m_groupWS->getDetectorIDToWorkspaceIndexMap(true); // 2. Set - for (std::map<int, std::vector<std::string>>::iterator it = + for (auto it = m_groupComponentsMap.begin(); it != m_groupComponentsMap.end(); ++it) { g_log.debug() << "Group ID = " << it->first << " With " << it->second.size() @@ -243,7 +243,7 @@ void LoadDetectorsGroupingFile::setByComponents() { if (det) { // Component is DETECTOR: int32_t detid = det->getID(); - detid2index_map::const_iterator itx = indexmap.find(detid); + auto itx = indexmap.find(detid); if (itx != indexmap.end()) { size_t wsindex = itx->second; m_groupWS->dataY(wsindex)[0] = it->first; @@ -290,14 +290,14 @@ void LoadDetectorsGroupingFile::setByDetectors() { m_groupWS->getDetectorIDToWorkspaceIndexMap(true); // 2. Set GroupingWorkspace - for (std::map<int, std::vector<detid_t>>::iterator it = + for (auto it = m_groupDetectorsMap.begin(); it != m_groupDetectorsMap.end(); ++it) { g_log.debug() << "Group ID = " << it->first << std::endl; for (size_t i = 0; i < it->second.size(); i++) { detid_t detid = it->second[i]; - detid2index_map::const_iterator itx = indexmap.find(detid); + auto itx = indexmap.find(detid); if (itx != indexmap.end()) { size_t wsindex = itx->second; @@ -516,7 +516,7 @@ void LoadGroupXMLFile::parseXML() { } // b) Set in map - std::map<int, std::vector<std::string>>::iterator itc = + auto itc = m_groupComponentsMap.find(curgroupid); if (itc != m_groupComponentsMap.end()) { // Error! Duplicate Group ID defined in XML @@ -542,7 +542,7 @@ void LoadGroupXMLFile::parseXML() { } // "group" else if (pNode->nodeName().compare("component") == 0) { // Node "component" = value - std::map<int, std::vector<std::string>>::iterator it = + auto it = m_groupComponentsMap.find(curgroupid); if (it == m_groupComponentsMap.end()) { std::stringstream ss; @@ -566,7 +566,7 @@ void LoadGroupXMLFile::parseXML() { } // Component else if (pNode->nodeName().compare("detids") == 0) { // Node "detids" - std::map<int, std::vector<detid_t>>::iterator it = + auto it = m_groupDetectorsMap.find(curgroupid); if (it == m_groupDetectorsMap.end()) { std::stringstream ss; @@ -592,7 +592,7 @@ void LoadGroupXMLFile::parseXML() { } // "detids" else if (pNode->nodeName().compare("ids") == 0) { // Node ids: for spectrum number - std::map<int, std::vector<int>>::iterator it = + auto it = m_groupSpectraMap.find(curgroupid); if (it == m_groupSpectraMap.end()) { std::stringstream ss; diff --git a/Framework/DataHandling/src/LoadDspacemap.cpp b/Framework/DataHandling/src/LoadDspacemap.cpp index 751343163fff9bd27f8f21ff75109295bc040e25..675b6e52c30f1bfed11613e7aada757ee401f1a1 100644 --- a/Framework/DataHandling/src/LoadDspacemap.cpp +++ b/Framework/DataHandling/src/LoadDspacemap.cpp @@ -206,7 +206,7 @@ void LoadDspacemap::CalculateOffsetsFromVulcanFactors( Kernel::V3D referencePos; detid_t anydetinrefmodule = 21 * 1250 + 5; - std::map<detid_t, Geometry::IDetector_const_sptr>::iterator det_iter = + auto det_iter = allDetectors.find(anydetinrefmodule); if (det_iter == allDetectors.end()) { @@ -379,7 +379,7 @@ void LoadDspacemap::readVulcanBinaryFile(const std::string &fileName, BinaryFile<VulcanCorrectionFactor> file(fileName); std::vector<VulcanCorrectionFactor> *results = file.loadAll(); if (results) { - for (std::vector<VulcanCorrectionFactor>::iterator it = results->begin(); + for (auto it = results->begin(); it != results->end(); ++it) { // std::cout << it->pixelID << " :! " << it->factor << std::endl; vulcan[static_cast<detid_t>(it->pixelID)] = it->factor; diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index 97f26cabd38e5fc9e74cf7c7b7e1699a8f35232b..ec9d6a42275b56c8457f5915ed1f3d426cd7118a 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -699,7 +699,7 @@ public: */ void loadTof(::NeXus::File &file) { // Allocate the array - float *temp = new float[m_loadSize[0]]; + auto temp = new float[m_loadSize[0]]; delete[] m_event_time_of_flight; m_event_time_of_flight = temp; @@ -760,7 +760,7 @@ public: m_have_weight = true; // Allocate the array - float *temp = new float[m_loadSize[0]]; + auto temp = new float[m_loadSize[0]]; delete[] m_event_weight; m_event_weight = temp; @@ -793,7 +793,7 @@ public: //--------------------------------------------------------------------------------------------------- void run() { // The vectors we will be filling - std::vector<uint64_t> *event_index_ptr = new std::vector<uint64_t>(); + auto event_index_ptr = new std::vector<uint64_t>(); std::vector<uint64_t> &event_index = *event_index_ptr; // These give the limits in each file as to which events we actually load @@ -1950,7 +1950,7 @@ void LoadEventNexus::loadEvents(API::Progress *const prog, size_t numProg = bankNames.size() * (1 + 3); // 1 = disktask, 3 = proc task if (splitProcessing) numProg += bankNames.size() * 3; // 3 = second proc task - Progress *prog2 = new Progress(this, 0.3, 1.0, numProg); + auto prog2 = new Progress(this, 0.3, 1.0, numProg); const std::vector<int> periodLogVec = periodLog->valuesAsVector(); @@ -2724,8 +2724,8 @@ void LoadEventNexus::loadTimeOfFlightData(::NeXus::File &file, continue; size_t n = tof.size(); // iterate over the events and time bins - std::vector<TofEvent>::iterator ev = events.begin(); - std::vector<TofEvent>::iterator ev_end = events.end(); + auto ev = events.begin(); + auto ev_end = events.end(); for (size_t i = 1; i < n; ++i) { double right = double(tof[i]); // find the right boundary for the current event @@ -2744,13 +2744,13 @@ void LoadEventNexus::loadTimeOfFlightData(::NeXus::File &file, // spread the events uniformly inside the bin boost::uniform_real<> distribution(left, right); std::vector<double> random_numbers(m); - for (std::vector<double>::iterator it = random_numbers.begin(); + for (auto it = random_numbers.begin(); it != random_numbers.end(); ++it) { *it = distribution(rand_gen); } std::sort(random_numbers.begin(), random_numbers.end()); - std::vector<double>::iterator it = random_numbers.begin(); - for (std::vector<TofEvent>::iterator ev1 = ev - m; ev1 != ev; + auto it = random_numbers.begin(); + for (auto ev1 = ev - m; ev1 != ev; ++ev1, ++it) { ev1->m_tof = *it; } @@ -2847,7 +2847,7 @@ void LoadEventNexus::createSpectraList(int32_t min, int32_t max) { if (!m_specList.empty()) { // Check no negative/zero numbers have been passed - std::vector<int32_t>::iterator itr = + auto itr = std::find_if(m_specList.begin(), m_specList.end(), std::bind2nd(std::less<int32_t>(), 1)); if (itr != m_specList.end()) { diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 8b2b9b5e10469607256715ecf280d1468a130e90..49d9d6e02ae6c716a14e87a26a2c0ea6842052cb 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -479,7 +479,7 @@ void LoadEventPreNexus::procEvents( loadOnlySomeSpectra = (this->spectra_list.size() > 0); // Turn the spectra list into a map, for speed of access - for (std::vector<int64_t>::iterator it = spectra_list.begin(); + for (auto it = spectra_list.begin(); it != spectra_list.end(); it++) spectraLoadMap[*it] = true; diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index a1a4ada0e72f8cd69951d34397a226e54977b909..dcc23b7afbf6e3f803fe45c29e1b2d56aa616ab0 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -574,7 +574,7 @@ void LoadEventPreNexus2::processImbedLogs() { void LoadEventPreNexus2::addToWorkspaceLog(std::string logtitle, size_t mindex) { // Create TimeSeriesProperty - TimeSeriesProperty<double> *property = + auto property = new TimeSeriesProperty<double>(logtitle); // Add entries @@ -730,7 +730,7 @@ void LoadEventPreNexus2::procEvents( loadOnlySomeSpectra = (this->spectra_list.size() > 0); // Turn the spectra list into a map, for speed of access - for (std::vector<int64_t>::iterator it = spectra_list.begin(); + for (auto it = spectra_list.begin(); it != spectra_list.end(); it++) spectraLoadMap[*it] = true; @@ -1166,7 +1166,7 @@ void LoadEventPreNexus2::procEventsLinear( // Create class map entry if not there size_t mindex = 0; - std::map<PixelType, size_t>::iterator git = + auto git = this->wrongdetidmap.find(tmpid); if (git == this->wrongdetidmap.end()) { // create entry @@ -1184,7 +1184,7 @@ void LoadEventPreNexus2::procEventsLinear( } // 2. Find local - std::map<PixelType, size_t>::iterator lit = local_pidindexmap.find(tmpid); + auto lit = local_pidindexmap.find(tmpid); size_t localindex = lit->second; for (size_t iv = 0; iv < local_pulsetimes[localindex].size(); iv++) { diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index edc7330e572f73bc9864fb9bede7302f3a92a0fc..a2c42b93736e86596c17d49cee0c76088fb3ccd6 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -156,7 +156,7 @@ void LoadFullprofResolution::exec() { << ") is negative. It is not allowed and is ignored. " << ".\n"; } else { - vector<int>::iterator fiter = lower_bound( + auto fiter = lower_bound( vec_bankinirf.begin(), vec_bankinirf.end(), outputbankid); if (fiter == vec_bankinirf.end() || *fiter != outputbankid) { // Specified bank ID does not exist. @@ -694,7 +694,7 @@ TableWorkspace_sptr LoadFullprofResolution::genTableWorkspace( if (numbanks == 0) throw runtime_error("Unable to generate a table from an empty map!"); - map<int, map<string, double>>::iterator bankmapiter = bankparammap.begin(); + auto bankmapiter = bankparammap.begin(); size_t numparams = bankmapiter->second.size(); // vector of all parameter name diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp index cbef429b8df4e276a5786c3e5dc4b0ce24e809c2..60eb628e100ddda63ff803c51b1cb025a3ebb4d0 100644 --- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp @@ -182,7 +182,7 @@ void LoadGSASInstrumentFile::exec() { } } else { // Else, use all available banks - for (map<size_t, map<string, double>>::iterator it = bankparammap.begin(); + for (auto it = bankparammap.begin(); it != bankparammap.end(); ++it) { bankIds.push_back(static_cast<int>(it->first)); } @@ -411,7 +411,7 @@ TableWorkspace_sptr LoadGSASInstrumentFile::genTableWorkspace( if (numbanks == 0) throw runtime_error("Unable to generate a table from an empty map!"); - map<size_t, map<string, double>>::iterator bankmapiter = bankparammap.begin(); + auto bankmapiter = bankparammap.begin(); size_t numparams = bankmapiter->second.size(); // vector of all parameter name diff --git a/Framework/DataHandling/src/LoadInstrument.cpp b/Framework/DataHandling/src/LoadInstrument.cpp index b8e71c55013882d21383a5cbd756fb17c381a70e..431df970f99177607c23fd62805d0f2a4af4f3df 100644 --- a/Framework/DataHandling/src/LoadInstrument.cpp +++ b/Framework/DataHandling/src/LoadInstrument.cpp @@ -176,7 +176,7 @@ void LoadInstrument::exec() { InstrumentDataService::Instance().retrieve(instrumentNameMangled); } else { // Really create the instrument - Progress *prog = new Progress(this, 0, 1, 100); + auto prog = new Progress(this, 0, 1, 100); instrument = parser.parseXML(prog); delete prog; // Add to data service for later retrieval diff --git a/Framework/DataHandling/src/LoadLog.cpp b/Framework/DataHandling/src/LoadLog.cpp index a4d717b1ae7a01c68d18a4848ebef6d7f51695db..d14f24e514ffbb039e0b60542988033fa576213f 100644 --- a/Framework/DataHandling/src/LoadLog.cpp +++ b/Framework/DataHandling/src/LoadLog.cpp @@ -256,7 +256,7 @@ void LoadLog::loadThreeColumnLogFile(std::ifstream &logFileStream, isNumeric = !istr.fail(); if (isNumeric) { - std::map<std::string, Kernel::TimeSeriesProperty<double> *>::iterator + auto ditr = dMap.find(propname); if (ditr != dMap.end()) { Kernel::TimeSeriesProperty<double> *prop = ditr->second; @@ -268,7 +268,7 @@ void LoadLog::loadThreeColumnLogFile(std::ifstream &logFileStream, dMap.insert(dpair(propname, logd)); } } else { - std::map<std::string, Kernel::TimeSeriesProperty<std::string> *>::iterator + auto sitr = sMap.find(propname); if (sitr != sMap.end()) { Kernel::TimeSeriesProperty<std::string> *prop = sitr->second; @@ -356,7 +356,7 @@ bool LoadLog::LoadSNSText() { // Ok, create all the logs std::vector<TimeSeriesProperty<double> *> props; for (size_t i = 0; i < numCols; i++) { - TimeSeriesProperty<double> *p = new TimeSeriesProperty<double>(names[i]); + auto p = new TimeSeriesProperty<double>(names[i]); if (units.size() == numCols) p->setUnits(units[i]); props.push_back(p); diff --git a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp index f6ec882919c2a00f79be240fba05634083782134..71121c48c282b16c1a3d486bc57a6e5d1672eb19 100644 --- a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp +++ b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp @@ -137,7 +137,7 @@ void LoadLogsForSNSPulsedMagnet::ParseDelayTimeLogFile() { << " Old format = " << m_delayfileinoldformat << std::endl; // 3. Build data structure - unsigned int **delaytimes = new unsigned int *[numpulses]; + auto delaytimes = new unsigned int *[numpulses]; for (unsigned int i = 0; i < numpulses; i++) delaytimes[i] = new unsigned int[m_numchoppers]; @@ -208,7 +208,7 @@ void LoadLogsForSNSPulsedMagnet::ParsePulseIDLogFile() { BinaryFile<Pulse> pulseFile(m_pulseidfilename); this->m_numpulses = pulseFile.getNumElements(); pulses = pulseFile.loadAll(); - for (std::vector<Pulse>::iterator it = pulses->begin(); it != pulses->end(); + for (auto it = pulses->begin(); it != pulses->end(); ++it) { this->m_pulseidseconds.push_back(it->seconds); this->m_pulseidnanoseconds.push_back(it->nanoseconds); @@ -223,7 +223,7 @@ void LoadLogsForSNSPulsedMagnet::addProperty() { // std::vector<double> times; // std::vector<double> values;*/ - TimeSeriesProperty<double> **property = new TimeSeriesProperty<double> *[4]; + auto property = new TimeSeriesProperty<double> *[4]; for (int i = 0; i < 4; i++) { std::stringstream namess; namess << "PulsedMagnetDelay" << i; diff --git a/Framework/DataHandling/src/LoadMuonLog.cpp b/Framework/DataHandling/src/LoadMuonLog.cpp index 2cb1e7f47756176348b6fd98e5107b997e181eee..52d4668e9944ec0f36a7b92b9d476e35bd867e83 100644 --- a/Framework/DataHandling/src/LoadMuonLog.cpp +++ b/Framework/DataHandling/src/LoadMuonLog.cpp @@ -70,9 +70,9 @@ void LoadMuonLog::exec() { Progress prog(this, 0.0, 1.0, nxload.numberOfLogs()); for (int i = 0; i < nxload.numberOfLogs(); i++) { std::string logName = nxload.getLogName(i); - TimeSeriesProperty<double> *l_PropertyDouble = + auto l_PropertyDouble = new TimeSeriesProperty<double>(logName); - TimeSeriesProperty<std::string> *l_PropertyString = + auto l_PropertyString = new TimeSeriesProperty<std::string>(logName); // Read log file into Property which is then stored in Sample object diff --git a/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Framework/DataHandling/src/LoadMuonNexus1.cpp index 4a8f4b2b7185efbf9fd7d4f0568bbdd7976e1e42..d7a1621c0f981e0a87c08c3509fb0c59df159a00 100644 --- a/Framework/DataHandling/src/LoadMuonNexus1.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus1.cpp @@ -612,7 +612,7 @@ void LoadMuonNexus1::loadData(size_t hist, specid_t &i, specid_t specNo, // Populate the workspace. Loop starts from 1, hence i-1 // Create and fill another vector for the X axis - float *timeChannels = new float[lengthIn + 1](); + auto timeChannels = new float[lengthIn + 1](); nxload.getTimeChannels(timeChannels, static_cast<const int>(lengthIn + 1)); // Put the read in array into a vector (inside a shared pointer) boost::shared_ptr<MantidVec> timeChannelsVec( diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index 64d53f19109313bf42b095e486e9507fccb5b86d..2d74308f160569c86ed81292328d530878a514c4 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -575,7 +575,7 @@ LoadNexusLogs::createTimeSeries(::NeXus::File &file, throw; } // Make an int TSP - TimeSeriesProperty<int> *tsp = new TimeSeriesProperty<int>(prop_name); + auto tsp = new TimeSeriesProperty<int>(prop_name); tsp->create(start_time, time_double, values); tsp->setUnits(value_units); g_log.debug() << " done reading \"value\" array\n"; @@ -597,7 +597,7 @@ LoadNexusLogs::createTimeSeries(::NeXus::File &file, // The string may contain non-printable (i.e. control) characters, replace // these std::replace_if(values.begin(), values.end(), iscntrl, ' '); - TimeSeriesProperty<std::string> *tsp = + auto tsp = new TimeSeriesProperty<std::string>(prop_name); std::vector<DateAndTime> times; DateAndTime::createVector(start_time, time_double, times); @@ -619,7 +619,7 @@ LoadNexusLogs::createTimeSeries(::NeXus::File &file, file.closeData(); throw; } - TimeSeriesProperty<double> *tsp = new TimeSeriesProperty<double>(prop_name); + auto tsp = new TimeSeriesProperty<double>(prop_name); tsp->create(start_time, time_double, values); tsp->setUnits(value_units); g_log.debug() << " done reading \"value\" array\n"; diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp index c59b6fb24f441e29db68c3c3b1a4768f1842772d..ba167eda69db3587755b98f390e89ed2c955a9a2 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -1343,7 +1343,7 @@ API::MatrixWorkspace_sptr LoadNexusProcessed::loadNonEventEntry( // if spectrum list property is set read each spectrum separately by // setting blocksize=1 if (m_list) { - std::vector<int64_t>::iterator itr = m_spec_list.begin(); + auto itr = m_spec_list.begin(); for (; itr != m_spec_list.end(); ++itr) { int64_t specIndex = (*itr) - 1; progress(progressBegin + @@ -1402,7 +1402,7 @@ API::MatrixWorkspace_sptr LoadNexusProcessed::loadNonEventEntry( } // if (m_list) { - std::vector<int64_t>::iterator itr = m_spec_list.begin(); + auto itr = m_spec_list.begin(); for (; itr != m_spec_list.end(); ++itr) { int64_t specIndex = (*itr) - 1; progress(progressBegin + @@ -1540,7 +1540,7 @@ API::Workspace_sptr LoadNexusProcessed::loadEntry(NXRoot &root, // Setting a unit onto a TextAxis makes no sense. if (unit2 == "TextAxis") { - Mantid::API::TextAxis *newAxis = new Mantid::API::TextAxis(nspectra); + auto newAxis = new Mantid::API::TextAxis(nspectra); local_workspace->replaceAxis(1, newAxis); } else if (unit2 != "spectraNumber") { try { @@ -2132,7 +2132,7 @@ LoadNexusProcessed::calculateWorkspaceSize(const std::size_t numberofspectra, if (m_list) { if (m_interval) { - for (std::vector<int64_t>::iterator it = m_spec_list.begin(); + for (auto it = m_spec_list.begin(); it != m_spec_list.end();) if (*it >= m_spec_min && *it < m_spec_max) { it = m_spec_list.erase(it); diff --git a/Framework/DataHandling/src/LoadRKH.cpp b/Framework/DataHandling/src/LoadRKH.cpp index 7010146a819ca65ee598c2f864dc6129fafe5e9b..02042d336907fbd5a78ab02bc951d13d0251b582 100644 --- a/Framework/DataHandling/src/LoadRKH.cpp +++ b/Framework/DataHandling/src/LoadRKH.cpp @@ -346,7 +346,7 @@ const MatrixWorkspace_sptr LoadRKH::read2D(const std::string &firstLine) { // now read in the Y values MantidVec &YOut = outWrksp->dataY(i); - for (MantidVec::iterator it = YOut.begin(), end = YOut.end(); it != end; + for (auto it = YOut.begin(), end = YOut.end(); it != end; ++it) { m_fileIn >> *it; } @@ -356,7 +356,7 @@ const MatrixWorkspace_sptr LoadRKH::read2D(const std::string &firstLine) { // the error values form one big block after the Y-values for (size_t i = 0; i < nAxis1Values; ++i) { MantidVec &EOut = outWrksp->dataE(i); - for (MantidVec::iterator it = EOut.begin(), end = EOut.end(); it != end; + for (auto it = EOut.begin(), end = EOut.end(); it != end; ++it) { m_fileIn >> *it; } @@ -433,7 +433,7 @@ Progress LoadRKH::read2DHeader(const std::string &initalLine, outWrksp->getAxis(0)->unit() = UnitFactory::Instance().create(XUnit); outWrksp->setYUnitLabel(intensityUnit); - NumericAxis *const axis1 = new Mantid::API::NumericAxis(nAxis1Boundaries); + auto const axis1 = new Mantid::API::NumericAxis(nAxis1Boundaries); axis1->unit() = Mantid::Kernel::UnitFactory::Instance().create(YUnit); outWrksp->replaceAxis(1, axis1); for (int i = 0; i < nAxis1Boundaries; ++i) { @@ -478,7 +478,7 @@ const std::string LoadRKH::readUnit(const std::string &line) { // theQuantity will contain the name of the unit, which can be many words long std::string theQuantity; - Poco::StringTokenizer::Iterator current = codes.begin() + 1, + auto current = codes.begin() + 1, end = codes.end(); for (; current != end; ++current) { if (current != end - 1) { diff --git a/Framework/DataHandling/src/LoadRaw/isisraw.cpp b/Framework/DataHandling/src/LoadRaw/isisraw.cpp index 475c96358d3637d62e0030ac41939bca61816f33..b46931a54497d2a9a001392992f3836dad9d6bd2 100644 --- a/Framework/DataHandling/src/LoadRaw/isisraw.cpp +++ b/Framework/DataHandling/src/LoadRaw/isisraw.cpp @@ -476,7 +476,7 @@ int ISISRAW::ioRAW(FILE *file, bool from_file, bool read_data) { fgetpos(file, &dhdr_pos); ioRAW(file, &dhdr, 1, from_file); int ndes, nout, nwords, outbuff_size = 100000, offset; - char *outbuff = new char[outbuff_size]; + auto outbuff = new char[outbuff_size]; if (!read_data) { ndes = ndata = 0; dat1 = NULL; diff --git a/Framework/DataHandling/src/LoadRawHelper.cpp b/Framework/DataHandling/src/LoadRawHelper.cpp index 194b8ea672ac8c01340904cc6484f03557228069..263d4930c792202aa96bbd90a4502dedbf3c1ffa 100644 --- a/Framework/DataHandling/src/LoadRawHelper.cpp +++ b/Framework/DataHandling/src/LoadRawHelper.cpp @@ -475,7 +475,7 @@ bool LoadRawHelper::isAscii(FILE *file) const { std::vector<boost::shared_ptr<MantidVec>> LoadRawHelper::getTimeChannels(const int64_t ®imes, const int64_t &lengthIn) { - float *const timeChannels = new float[lengthIn]; + auto const timeChannels = new float[lengthIn]; isisRaw->getTimeChannels(timeChannels, static_cast<int>(lengthIn)); std::vector<boost::shared_ptr<MantidVec>> timeChannelsVec; @@ -498,7 +498,7 @@ LoadRawHelper::getTimeChannels(const int64_t ®imes, // In this case, also need to populate the map of spectrum-regime // correspondence const int64_t ndet = static_cast<int64_t>(isisRaw->i_det); - std::map<specid_t, specid_t>::iterator hint = m_specTimeRegimes.begin(); + auto hint = m_specTimeRegimes.begin(); for (int64_t j = 0; j < ndet; ++j) { // No checking for consistency here - that all detectors for given // spectrum @@ -959,7 +959,7 @@ specid_t LoadRawHelper::calculateWorkspaceSize() { if (m_list) { if (m_interval) { - for (std::vector<specid_t>::iterator it = m_spec_list.begin(); + for (auto it = m_spec_list.begin(); it != m_spec_list.end();) if (*it >= m_spec_min && *it < m_spec_max) { it = m_spec_list.erase(it); diff --git a/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp b/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp index 000c7be5294506eff2b77838db4c73b1ef55cee2..ab498a3769ff3b374864f81b418efe9ab02ea036 100644 --- a/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp +++ b/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp @@ -47,7 +47,7 @@ void LoadSampleDetailsFromRaw::exec() { throw Exception::FileError("Unable to open File:", filename); } - ISISRAW2 *isis_raw = new ISISRAW2; + auto isis_raw = new ISISRAW2; isis_raw->ioRAW(file, true); fclose(file); diff --git a/Framework/DataHandling/src/LoadSassena.cpp b/Framework/DataHandling/src/LoadSassena.cpp index 2f749d8a0784a85acbf2d1bd419044ba6cf13a20..f46666fc4be8b680b5b925881db3a451e2a1a2c0 100644 --- a/Framework/DataHandling/src/LoadSassena.cpp +++ b/Framework/DataHandling/src/LoadSassena.cpp @@ -113,7 +113,7 @@ const MantidVec LoadSassena::loadQvectors(const hid_t &h5file, "Unable to read " + setName + " dataset info:", m_filename); } int nq = static_cast<int>(dims[0]); // number of q-vectors - double *buf = new double[nq * 3]; + auto buf = new double[nq * 3]; this->dataSetDouble(h5file, "qvectors", buf); MantidVec qvmod; // store the modulus of the vector @@ -181,7 +181,7 @@ void LoadSassena::loadFQ(const hid_t &h5file, API::WorkspaceGroup_sptr gws, const std::string wsName = gwsName + std::string("_") + setName; ws->setTitle(wsName); - double *buf = new double[nq * 2]; + auto buf = new double[nq * 2]; this->dataSetDouble(h5file, setName, buf); MantidVec &re = ws->dataY(0); // store the real part ws->dataX(0) = qvmod; // X-axis values are the modulus of the q vector @@ -234,7 +234,7 @@ void LoadSassena::loadFQT(const hid_t &h5file, API::WorkspaceGroup_sptr gws, int nnt = static_cast<int>(dims[1]); // number of non-negative time points int nt = 2 * nnt - 1; // number of time points int origin = nnt - 1; - double *buf = new double[nq * nnt * 2]; + auto buf = new double[nq * nnt * 2]; this->dataSetDouble(h5file, setName, buf); DataObjects::Workspace2D_sptr wsRe = diff --git a/Framework/DataHandling/src/LoadSpiceAscii.cpp b/Framework/DataHandling/src/LoadSpiceAscii.cpp index 73e328e21d49c3b0ba3e8e2a37c89382aa6284db..4da9beb8d98adb1be87c4b4138c852a298e1ce22 100644 --- a/Framework/DataHandling/src/LoadSpiceAscii.cpp +++ b/Framework/DataHandling/src/LoadSpiceAscii.cpp @@ -48,7 +48,7 @@ static bool checkIntersection(std::vector<std::string> v1, // Check intersectiom std::vector<std::string> intersectvec(v1.size() + v2.size()); - std::vector<std::string>::iterator outiter = std::set_intersection( + auto outiter = std::set_intersection( v1.begin(), v1.end(), v2.begin(), v2.end(), intersectvec.begin()); if (static_cast<int>(outiter - intersectvec.begin()) == 0) return false; diff --git a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp index f2a49420e31cd3e3ea8a7568a4bfa39461576aa0..11025e99f4122b258374695daabc7cbb6457484d 100644 --- a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp +++ b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp @@ -559,7 +559,7 @@ void LoadSpiceXML2DDet::setupSampleLogFromSpiceTable( for (size_t ic = 1; ic < colnames.size(); ++ic) { double logvalue = spicetablews->cell<double>(ir, ic); std::string &logname = colnames[ic]; - TimeSeriesProperty<double> *newlogproperty = + auto newlogproperty = new TimeSeriesProperty<double>(logname); newlogproperty->addValue(anytime, logvalue); matrixws->mutableRun().addProperty(newlogproperty); diff --git a/Framework/DataHandling/src/LoadTOFRawNexus.cpp b/Framework/DataHandling/src/LoadTOFRawNexus.cpp index 06d7f8468c4d5ae5d848e1a9dc755b2a542ba4a3..6b503209a2e506cdf807937377adc3d85c82c536 100644 --- a/Framework/DataHandling/src/LoadTOFRawNexus.cpp +++ b/Framework/DataHandling/src/LoadTOFRawNexus.cpp @@ -98,7 +98,7 @@ void LoadTOFRawNexus::countPixels(const std::string &nexusfilename, bankNames.clear(); // Create the root Nexus class - ::NeXus::File *file = new ::NeXus::File(nexusfilename); + auto file = new ::NeXus::File(nexusfilename); // Open the default data group 'entry' file->openGroup(entry_name, "NXentry"); @@ -291,7 +291,7 @@ void LoadTOFRawNexus::loadBank(const std::string &nexusfilename, m_fileMutex.lock(); // Navigate to the point in the file - ::NeXus::File *file = new ::NeXus::File(nexusfilename); + auto file = new ::NeXus::File(nexusfilename); file->openGroup(entry_name, "NXentry"); file->openGroup("instrument", "NXinstrument"); file->openGroup(bankName, "NXdetector"); @@ -353,7 +353,7 @@ void LoadTOFRawNexus::loadBank(const std::string &nexusfilename, if (m_spec_max != Mantid::EMPTY_INT()) { uint32_t ifirst = pixel_id[0]; range_check out_range(m_spec_min, m_spec_max, id_to_wi); - std::vector<uint32_t>::iterator newEnd = + auto newEnd = std::remove_if(pixel_id.begin(), pixel_id.end(), out_range); pixel_id.erase(newEnd, pixel_id.end()); // check if beginning or end of array was erased @@ -457,7 +457,7 @@ void LoadTOFRawNexus::loadBank(const std::string &nexusfilename, /** @return the name of the entry that we will load */ std::string LoadTOFRawNexus::getEntryName(const std::string &filename) { std::string entry_name = "entry"; - ::NeXus::File *file = new ::NeXus::File(filename); + auto file = new ::NeXus::File(filename); std::map<std::string, std::string> entries = file->getEntries(); file->close(); delete file; @@ -499,7 +499,7 @@ void LoadTOFRawNexus::exec() { std::string entry_name = LoadTOFRawNexus::getEntryName(filename); // Count pixels and other setup - Progress *prog = new Progress(this, 0.0, 1.0, 10); + auto prog = new Progress(this, 0.0, 1.0, 10); prog->doReport("Counting pixels"); std::vector<std::string> bankNames; countPixels(filename, entry_name, bankNames); diff --git a/Framework/DataHandling/src/LoadVulcanCalFile.cpp b/Framework/DataHandling/src/LoadVulcanCalFile.cpp index 045b33fc56a64925e64eb58b7308353a388fccff..a443ee7188526593265cca6030172e92c72b0a24 100644 --- a/Framework/DataHandling/src/LoadVulcanCalFile.cpp +++ b/Framework/DataHandling/src/LoadVulcanCalFile.cpp @@ -393,10 +393,10 @@ void LoadVulcanCalFile::processOffsets( std::set<int> set_bankID; map<detid_t, pair<bool, int>> map_verify; // key: detector ID, value: flag to have a match, bank ID - for (map<detid_t, double>::iterator miter = map_detoffset.begin(); + for (auto miter = map_detoffset.begin(); miter != map_detoffset.end(); ++miter) { detid_t pid = miter->first; - map<detid_t, size_t>::iterator fiter = map_det2index.find(pid); + auto fiter = map_det2index.find(pid); if (fiter == map_det2index.end()) { map_verify.insert(make_pair(pid, make_pair(false, -1))); } else { @@ -426,7 +426,7 @@ void LoadVulcanCalFile::processOffsets( for (size_t j = 0; j < NUMBERDETECTORPERMODULE; ++j) { detid_t detindex = static_cast<detid_t>(bankindex * NUMBERRESERVEDPERMODULE + j); - map<detid_t, pair<bool, int>>::iterator miter = map_verify.find(detindex); + auto miter = map_verify.find(detindex); if (miter == map_verify.end()) throw runtime_error("It cannot happen!"); bool exist = miter->second.first; diff --git a/Framework/DataHandling/src/MergeLogs.cpp b/Framework/DataHandling/src/MergeLogs.cpp index 016280eb360a110ef417734e0aa1887bc8fdcb58..0e70ee6318e11351aeb6e87a0a7dfcd721ce9fd2 100644 --- a/Framework/DataHandling/src/MergeLogs.cpp +++ b/Framework/DataHandling/src/MergeLogs.cpp @@ -85,7 +85,7 @@ void Merge2WorkspaceLogs::mergeLogs(std::string ilogname1, std::vector<Kernel::DateAndTime> times1 = p1->timesAsVector(); std::vector<Kernel::DateAndTime> times2 = p2->timesAsVector(); - Kernel::TimeSeriesProperty<double> *rp = + auto rp = new Kernel::TimeSeriesProperty<double>(ologname); // 2. Merge diff --git a/Framework/DataHandling/src/NexusTester.cpp b/Framework/DataHandling/src/NexusTester.cpp index 2f1ed8f0471bad14b3da57c3519f3b60f07b7ef1..939ca1bcb8792f4488ab3a30e5d84a84ae6dbf91 100644 --- a/Framework/DataHandling/src/NexusTester.cpp +++ b/Framework/DataHandling/src/NexusTester.cpp @@ -106,7 +106,7 @@ void NexusTester::exec() { // Size of the chunk in number of integers size_t chunkSize = ChunkSizeKb * 1024 / sizeof(uint32_t); // ----------- Generate the fake data ----------------------------- - uint32_t *fakeData = new uint32_t[chunkSize]; + auto fakeData = new uint32_t[chunkSize]; if (FakeDataType == "Zeros") { for (size_t i = 0; i < chunkSize; i++) fakeData[i] = 0; diff --git a/Framework/DataHandling/src/ProcessDasNexusLog.cpp b/Framework/DataHandling/src/ProcessDasNexusLog.cpp index dbe09df1ff35951c02b136cfd3106283fd59ad8b..e2897a24d1661e8fb1e70d6cca1c6e969ed63117 100644 --- a/Framework/DataHandling/src/ProcessDasNexusLog.cpp +++ b/Framework/DataHandling/src/ProcessDasNexusLog.cpp @@ -176,7 +176,7 @@ void ProcessDasNexusLog::addLog(API::MatrixWorkspace_sptr ws, } // 2. Add log - Kernel::TimeSeriesProperty<double> *newlog = + auto newlog = new Kernel::TimeSeriesProperty<double>(logname); for (size_t i = 0; i < timevec.size(); i++) { newlog->addValue(timevec[i], unifylogvalue); diff --git a/Framework/DataHandling/src/SNSDataArchive.cpp b/Framework/DataHandling/src/SNSDataArchive.cpp index 028dcde170b592a6ae3672ea4e844d60a827ab44..a1f0534b821d48a537320eb1070ad3c68eae8990 100644 --- a/Framework/DataHandling/src/SNSDataArchive.cpp +++ b/Framework/DataHandling/src/SNSDataArchive.cpp @@ -39,13 +39,13 @@ DECLARE_ARCHIVESEARCH(SNSDataArchive, SNSDataSearch) std::string SNSDataArchive::getArchivePath(const std::set<std::string> &filenames, const std::vector<std::string> &exts) const { - std::set<std::string>::const_iterator iter = filenames.begin(); + auto iter = filenames.begin(); std::string filename = *iter; // ICAT4 web service take upper case filename such as HYSA_2662 std::transform(filename.begin(), filename.end(), filename.begin(), toupper); - std::vector<std::string>::const_iterator iter2 = exts.begin(); + auto iter2 = exts.begin(); for (; iter2 != exts.end(); ++iter2) { g_log.debug() << *iter2 << ";"; } @@ -80,7 +80,7 @@ SNSDataArchive::getArchivePath(const std::set<std::string> &filenames, } } - std::vector<std::string>::const_iterator ext = exts.begin(); + auto ext = exts.begin(); for (; ext != exts.end(); ++ext) { std::string datafile = filename + *ext; std::vector<std::string>::const_iterator iter = locations.begin(); diff --git a/Framework/DataHandling/src/SaveAscii.cpp b/Framework/DataHandling/src/SaveAscii.cpp index 1f9afaa65c605ee85433bb616ea91ff713ca9715..798a93297fa8359571c2bb71968a019dc8abe4f3 100644 --- a/Framework/DataHandling/src/SaveAscii.cpp +++ b/Framework/DataHandling/src/SaveAscii.cpp @@ -117,7 +117,7 @@ void SaveAscii::exec() { } // Else if the separator drop down choice is not UserDefined then we use that. else if (choice != "UserDefined") { - std::map<std::string, std::string>::iterator it = + auto it = m_separatorIndex.find(choice); sep = it->second; } @@ -186,7 +186,7 @@ void SaveAscii::exec() { file << " , DX" << spec; } else - for (std::set<int>::const_iterator spec = idx.begin(); spec != idx.end(); + for (auto spec = idx.begin(); spec != idx.end(); ++spec) { file << comstr << "Y" << *spec << comstr << errstr << *spec << errstr2; if (write_dx) @@ -220,7 +220,7 @@ void SaveAscii::exec() { file << ws->readE(spec)[bin]; } else - for (std::set<int>::const_iterator spec = idx.begin(); spec != idx.end(); + for (auto spec = idx.begin(); spec != idx.end(); ++spec) { file << sep; file << ws->readY(*spec)[bin]; diff --git a/Framework/DataHandling/src/SaveAscii2.cpp b/Framework/DataHandling/src/SaveAscii2.cpp index 2ac4139d17ceebf3cc66097a75f0f4bd3d4e28b7..2790987e41c6a66995ed54ff248cabc763b3af6f 100644 --- a/Framework/DataHandling/src/SaveAscii2.cpp +++ b/Framework/DataHandling/src/SaveAscii2.cpp @@ -138,7 +138,7 @@ void SaveAscii2::exec() { } // Else if the separator drop down choice is not UserDefined then we use that. else if (choice != "UserDefined") { - std::map<std::string, std::string>::iterator it = + auto it = m_separatorIndex.find(choice); m_sep = it->second; } @@ -233,7 +233,7 @@ void SaveAscii2::exec() { } } else { Progress progress(this, 0, 1, idx.size()); - for (std::set<int>::const_iterator i = idx.begin(); i != idx.end(); ++i) { + for (auto i = idx.begin(); i != idx.end(); ++i) { writeSpectra(i, file); progress.report(); } diff --git a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp index 3ad37864c6807070932d4b7be63ddfd5f84e3de3..60a24803bf681b2300ba8ec188f049bc6032cd8c 100644 --- a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp +++ b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp @@ -91,7 +91,7 @@ void SaveDetectorsGrouping::createGroupDetectorIDMap( int groupid = static_cast<int>(mGroupWS->dataY(iws)[0]); // b) Exist? Yes --> get hanlder on vector. No --> create vector and - std::map<int, std::vector<detid_t>>::iterator it = + auto it = groupwkspmap.find(groupid); if (it == groupwkspmap.end()) { std::vector<detid_t> tempvector; @@ -120,7 +120,7 @@ void SaveDetectorsGrouping::createGroupDetectorIDMap( throw; } detid_t detid = 0; - for (std::set<detid_t>::iterator it = detids.begin(); it != detids.end(); + for (auto it = detids.begin(); it != detids.end(); ++it) { detid = *it; } @@ -137,7 +137,7 @@ void SaveDetectorsGrouping::convertToDetectorsRanges( std::map<int, std::vector<detid_t>> groupdetidsmap, std::map<int, std::vector<detid_t>> &groupdetidrangemap) { - for (std::map<int, std::vector<detid_t>>::iterator it = + for (auto it = groupdetidsmap.begin(); it != groupdetidsmap.end(); ++it) { @@ -201,7 +201,7 @@ void SaveDetectorsGrouping::printToXML( } // 3. Append Groups - for (std::map<int, std::vector<detid_t>>::iterator it = + for (auto it = groupdetidrangemap.begin(); it != groupdetidrangemap.end(); ++it) { diff --git a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp index d533f02cb588615f35c32e8457a2e968f50413a7..a75c50b4df6c45f29908356c5ac13c351f1cc23e 100644 --- a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp @@ -145,7 +145,7 @@ bool ChopperConfiguration::hasBank(unsigned int bankid) const { double ChopperConfiguration::getParameter(unsigned int bankid, const string ¶mname) const { // Obtain index for the bank - map<unsigned int, size_t>::const_iterator biter = + auto biter = m_bankIDIndexMap.find(bankid); if (biter == m_bankIDIndexMap.end()) { stringstream errss; @@ -187,7 +187,7 @@ double ChopperConfiguration::getParameter(unsigned int bankid, */ void ChopperConfiguration::setParameter(unsigned int bankid, const string ¶mname, double value) { - map<unsigned, size_t>::iterator biter = m_bankIDIndexMap.find(bankid); + auto biter = m_bankIDIndexMap.find(bankid); if (biter == m_bankIDIndexMap.end()) { stringstream errss; @@ -369,7 +369,7 @@ void SaveGSASInstrumentFile::exec() { // Deal with a default if (m_vecBankID2File.empty()) { // Default is to export all banks - for (map<unsigned int, map<string, double>>::iterator miter = + for (auto miter = bankprofileparammap.begin(); miter != bankprofileparammap.end(); ++miter) { unsigned int bankid = miter->first; @@ -765,7 +765,7 @@ void SaveGSASInstrumentFile::buildGSASTabulatedProfile( const std::map<unsigned int, std::map<std::string, double>> &bankprofilemap, unsigned int bankid) { // Locate the profile map - map<unsigned int, map<string, double>>::const_iterator biter = + auto biter = bankprofilemap.find(bankid); if (biter == bankprofilemap.end()) throw runtime_error("Bank ID cannot be found in bank-profile-map-map. 001"); @@ -869,7 +869,7 @@ void SaveGSASInstrumentFile::writePRMSingleBank( const std::map<unsigned int, std::map<std::string, double>> &bankprofilemap, unsigned int bankid, const std::string &prmfilename) { // Get access to the profile map - map<unsigned int, map<string, double>>::const_iterator biter = + auto biter = bankprofilemap.find(bankid); if (biter == bankprofilemap.end()) throw runtime_error("Bank does not exist in bank-profile-map. 002"); @@ -1079,12 +1079,12 @@ SaveGSASInstrumentFile::getValueFromMap(const map<string, double> &profilemap, */ double SaveGSASInstrumentFile::getProfileParameterValue( const map<string, double> &profilemap, const string ¶mname) { - map<string, double>::const_iterator piter = profilemap.find(paramname); + auto piter = profilemap.find(paramname); if (piter == profilemap.end()) { stringstream errss; errss << "Profile map does not contain parameter " << paramname << ". Available parameters are "; - for (map<string, double>::const_iterator piter = profilemap.begin(); + for (auto piter = profilemap.begin(); piter != profilemap.end(); ++piter) { errss << piter->first << ", "; } diff --git a/Framework/DataHandling/src/SaveGSS.cpp b/Framework/DataHandling/src/SaveGSS.cpp index af536d1977a0afa2330f7b899b36a42d6e2c2031..2fbbb8dddea1c42758eed225ee2c11d1719f707e 100644 --- a/Framework/DataHandling/src/SaveGSS.cpp +++ b/Framework/DataHandling/src/SaveGSS.cpp @@ -472,7 +472,7 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os, bool norm_by_monitor = false; const Mantid::API::AlgorithmHistories &algohist = inputWS->getHistory().getAlgorithmHistories(); - for (Mantid::API::AlgorithmHistories::const_iterator it = algohist.begin(); + for (auto it = algohist.begin(); it != algohist.end(); ++it) { if ((*it)->name().compare("NormaliseByCurrent") == 0) norm_by_current = true; diff --git a/Framework/DataHandling/src/SaveISISNexus.cpp b/Framework/DataHandling/src/SaveISISNexus.cpp index 9313b64044e0758ba5cb268c6ed74b878b9953f1..07013b7e22245ebf07e18ae6d85411520efbb528 100644 --- a/Framework/DataHandling/src/SaveISISNexus.cpp +++ b/Framework/DataHandling/src/SaveISISNexus.cpp @@ -337,7 +337,7 @@ int SaveISISNexus::saveStringVectorOpen(const char *name, } if (buff_size <= 0) buff_size = 1; - char *buff = new char[buff_size]; + auto buff = new char[buff_size]; int dim[2]; dim[0] = static_cast<int>(str_vec.size()); dim[1] = buff_size; diff --git a/Framework/DataHandling/src/SaveNXTomo.cpp b/Framework/DataHandling/src/SaveNXTomo.cpp index efd42c3346d85889cac94edd6aaaf1ec4b2ec4db..02e49ef74d7d4de1bd83849c3b4cc206e0f33e3e 100644 --- a/Framework/DataHandling/src/SaveNXTomo.cpp +++ b/Framework/DataHandling/src/SaveNXTomo.cpp @@ -333,7 +333,7 @@ void SaveNXTomo::writeSingleWorkspace(const Workspace2D_sptr workspace, // Insert previous data. nxFile.openData("data"); - double *dataArr = new double[m_spectraCount]; + auto dataArr = new double[m_spectraCount]; for (int64_t i = 0; i < m_dimensions[1]; ++i) { for (int64_t j = 0; j < m_dimensions[2]; ++j) { @@ -422,7 +422,7 @@ void SaveNXTomo::writeLogValues(const DataObjects::Workspace2D_sptr workspace, size_t strSize = prop->value().length(); - char *val = new char[80](); + auto val = new char[80](); // If log value is from FITS file as it should be, // it won't be greater than this. Otherwise Shorten it diff --git a/Framework/DataHandling/src/SaveNexusProcessed.cpp b/Framework/DataHandling/src/SaveNexusProcessed.cpp index 261eb8079c01e9f164beb9f53ca1e13ab22833b9..54a7505e45210ed0e29081e1229511c4c42debec 100644 --- a/Framework/DataHandling/src/SaveNexusProcessed.cpp +++ b/Framework/DataHandling/src/SaveNexusProcessed.cpp @@ -228,7 +228,7 @@ void SaveNexusProcessed::doExec(Workspace_sptr inputWorkspace, nexusFile->openNexusWrite(m_filename, entryNumber); // Equivalent C++ API handle - ::NeXus::File *cppFile = new ::NeXus::File(nexusFile->fileID); + auto cppFile = new ::NeXus::File(nexusFile->fileID); prog_init.reportIncrement(1, "Opening file"); if (nexusFile->writeNexusProcessedHeader(m_title, wsName) != 0) diff --git a/Framework/DataHandling/src/SaveReflTBL.cpp b/Framework/DataHandling/src/SaveReflTBL.cpp index 5e46e716eab466c46cfcdd5600f0b0a076ee6079..80db3e60b2a8426b2a2e0d3a7033f36342cb2bdb 100644 --- a/Framework/DataHandling/src/SaveReflTBL.cpp +++ b/Framework/DataHandling/src/SaveReflTBL.cpp @@ -76,7 +76,7 @@ void SaveReflTBL::exec() { } typedef std::map<int, std::vector<size_t>>::iterator map_it_type; - for (map_it_type iterator = m_stichgroups.begin(); + for (auto iterator = m_stichgroups.begin(); iterator != m_stichgroups.end(); ++iterator) { std::vector<size_t> &rowNos = iterator->second; size_t i = 0; @@ -105,7 +105,7 @@ void SaveReflTBL::exec() { // now do the same for the ungrouped typedef std::vector<size_t>::iterator vec_it_type; - for (vec_it_type iterator = m_nogroup.begin(); iterator != m_nogroup.end(); + for (auto iterator = m_nogroup.begin(); iterator != m_nogroup.end(); ++iterator) { TableRow row = ws->getRow(*iterator); for (int j = 0; j < 5; ++j) { diff --git a/Framework/DataHandling/src/SaveSPE.cpp b/Framework/DataHandling/src/SaveSPE.cpp index 58902124d4daab9a15db5e4d357fd4a0e30eafc2..2dfb415299ca12e79ab013e36874ead3ac68928f 100644 --- a/Framework/DataHandling/src/SaveSPE.cpp +++ b/Framework/DataHandling/src/SaveSPE.cpp @@ -346,7 +346,7 @@ void SaveSPE::writeValue(const double value, FILE *const outFile) const { */ void SaveSPE::logMissingMasked(const std::vector<int> &inds, const size_t nonMasked, const int masked) const { - std::vector<int>::const_iterator index = inds.begin(), end = inds.end(); + auto index = inds.begin(), end = inds.end(); if (index != end) { g_log.information() << "Found " << inds.size() << " spectra without associated detectors, probably " diff --git a/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp b/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp index e2ed0353c817915be512838b5d0f67e7c2d73634..ef09a7a42dc857d719bc644c6ee4f12a4c755ede 100644 --- a/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp +++ b/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp @@ -274,7 +274,7 @@ int SaveToSNSHistogramNexus::WriteOutDataOrErrors( double saveTime = 0; // Make a buffer of floats will all the counts in that bank. - float *data = + auto data = new float[slabDimensions[0] * slabDimensions[1] * slabDimensions[2]]; // Only allocate an array for errors if it is needed diff --git a/Framework/DataHandling/src/SetScalingPSD.cpp b/Framework/DataHandling/src/SetScalingPSD.cpp index 3affb36b8cb1625621dd640030ab6ac6697faf87..84480275e12a6f901e8b9a01b741a342bd7f9d6c 100644 --- a/Framework/DataHandling/src/SetScalingPSD.cpp +++ b/Framework/DataHandling/src/SetScalingPSD.cpp @@ -248,7 +248,7 @@ void SetScalingPSD::movePos(API::MatrixWorkspace_sptr &WS, * @param scaleMap :: A map of integer detectorID and corresponding scaling * (in Y) */ - std::map<int, Kernel::V3D>::iterator iter = posMap.begin(); + auto iter = posMap.begin(); Geometry::ParameterMap &pmap = WS->instrumentParameters(); boost::shared_ptr<const Instrument> inst = WS->getInstrument(); boost::shared_ptr<const IComponent> comp; @@ -282,7 +282,7 @@ void SetScalingPSD::movePos(API::MatrixWorkspace_sptr &WS, *det, pmap, iter->second, Geometry::ComponentHelper::Relative); // Set the "sca" instrument parameter - std::map<int, double>::iterator it = scaleMap.find(idet); + auto it = scaleMap.find(idet); if (it != scaleMap.end()) { scale = it->second; if (minScale > scale) diff --git a/Framework/DataObjects/src/AffineMatrixParameterParser.cpp b/Framework/DataObjects/src/AffineMatrixParameterParser.cpp index 913b828a756999e8a817bb72b40bab51c55cf864..4342d339f0262fa4af4046674a406ce560502510 100644 --- a/Framework/DataObjects/src/AffineMatrixParameterParser.cpp +++ b/Framework/DataObjects/src/AffineMatrixParameterParser.cpp @@ -29,7 +29,7 @@ AffineMatrixParameter *AffineMatrixParameterParser::createParameter( boost::split(vecStrRows, sParameterValue, boost::is_any_of(";")); size_t nRows = vecStrRows.size(); - VecStrings::iterator row_it = vecStrRows.begin(); + auto row_it = vecStrRows.begin(); VecStrings::iterator col_it; size_t nCols = 0; @@ -59,7 +59,7 @@ AffineMatrixParameter *AffineMatrixParameterParser::createParameter( } // Create the parameter and set the matrix. - AffineMatrixParameter *parameter = + auto parameter = new AffineMatrixParameter(nRows - 1, nCols - 1); parameter->setMatrix(m); diff --git a/Framework/DataObjects/src/CoordTransformAffine.cpp b/Framework/DataObjects/src/CoordTransformAffine.cpp index 8f9584d60611d8494855d9ba7c35aa9cd2886a50..ab74efa064a104aa0765fce8c75e9fc45be29192 100644 --- a/Framework/DataObjects/src/CoordTransformAffine.cpp +++ b/Framework/DataObjects/src/CoordTransformAffine.cpp @@ -70,7 +70,7 @@ void CoordTransformAffine::copyRawMatrix() { /** Virtual cloner * @return a copy of this object */ CoordTransform *CoordTransformAffine::clone() const { - CoordTransformAffine *out = new CoordTransformAffine(inD, outD); + auto out = new CoordTransformAffine(inD, outD); out->setMatrix(this->getMatrix()); return out; } @@ -376,7 +376,7 @@ CoordTransformAffine::combineTransformations(CoordTransform *first, ownSecondAff = true; } // Initialize the affine matrix - CoordTransformAffine *out = + auto out = new CoordTransformAffine(firstAff->getInD(), secondAff->getOutD()); // Multiply the two matrices together Matrix<coord_t> outMat = secondAff->getMatrix() * firstAff->getMatrix(); diff --git a/Framework/DataObjects/src/CoordTransformAffineParser.cpp b/Framework/DataObjects/src/CoordTransformAffineParser.cpp index 7492f3aecaf1cde3c3215b4176a35b746d0e4bfe..fd7cc3514720289647103977c97e4c64bdcc5239 100644 --- a/Framework/DataObjects/src/CoordTransformAffineParser.cpp +++ b/Framework/DataObjects/src/CoordTransformAffineParser.cpp @@ -65,7 +65,7 @@ Mantid::API::CoordTransform *CoordTransformAffineParser::createTransform( affineMatrixDimParser.createParameter(parameter)); // Generate the coordinate transform with the matrix and return. - CoordTransformAffine *transform = + auto transform = new CoordTransformAffine(inDim->getValue(), outDim->getValue()); transform->setMatrix(affineMatrix->getAffineMatrix()); return transform; diff --git a/Framework/DataObjects/src/CoordTransformAligned.cpp b/Framework/DataObjects/src/CoordTransformAligned.cpp index 979079c6d39dd94497e10a42cfb912d394447424..54d8e027eff6c6467dd87ee10df34ad6a3e97d0d 100644 --- a/Framework/DataObjects/src/CoordTransformAligned.cpp +++ b/Framework/DataObjects/src/CoordTransformAligned.cpp @@ -101,7 +101,7 @@ CoordTransformAligned::CoordTransformAligned( /** Virtual cloner * @return a copy of this object */ CoordTransform *CoordTransformAligned::clone() const { - CoordTransformAligned *out = new CoordTransformAligned( + auto out = new CoordTransformAligned( inD, outD, m_dimensionToBinFrom, m_origin, m_scaling); return out; } diff --git a/Framework/DataObjects/src/CoordTransformDistance.cpp b/Framework/DataObjects/src/CoordTransformDistance.cpp index ed863adc5c26f6c3ca7dcd4ae9bb6079d2ede5b3..bcf6b6de9e765a044464854feba6f34fbfbf2acd 100644 --- a/Framework/DataObjects/src/CoordTransformDistance.cpp +++ b/Framework/DataObjects/src/CoordTransformDistance.cpp @@ -42,7 +42,7 @@ CoordTransformDistance::CoordTransformDistance(const size_t inD, /** Virtual cloner * @return a copy of this object */ CoordTransform *CoordTransformDistance::clone() const { - CoordTransformDistance *out = + auto out = new CoordTransformDistance(inD, m_center, m_dimensionsUsed); return out; } diff --git a/Framework/DataObjects/src/CoordTransformDistanceParser.cpp b/Framework/DataObjects/src/CoordTransformDistanceParser.cpp index c8fa1ac773c19772013d24f64e7b2124fbb94353..aa86b9c9b54090715d3568f783dd5b5db18d656c 100644 --- a/Framework/DataObjects/src/CoordTransformDistanceParser.cpp +++ b/Framework/DataObjects/src/CoordTransformDistanceParser.cpp @@ -74,7 +74,7 @@ Mantid::API::CoordTransform *CoordTransformDistanceParser::createTransform( dimsUsedVecParm(dimsUsedParser.createWithoutDelegation(parameter)); ////Generate the coordinate transform and return - CoordTransformDistance *transform = new CoordTransformDistance( + auto transform = new CoordTransformDistance( inDimParameter->getValue(), coordCenterParam->getPointerToStart(), dimsUsedVecParm->getPointerToStart()); diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index ba0b7472432e6e1d3b68e42fb709473b9ed6283d..ac8540a3538efaf6fe14ea7e68f7f8f861e854e4 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -343,7 +343,7 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) { // and append to the list this->weightedEvents.reserve(this->weightedEvents.size() + more_events.size()); - for (std::vector<TofEvent>::const_iterator it = more_events.begin(); + for (auto it = more_events.begin(); it != more_events.end(); ++it) this->weightedEvents.push_back(WeightedEvent(*it)); break; @@ -353,7 +353,7 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) { // and append to the list this->weightedEventsNoTime.reserve(this->weightedEventsNoTime.size() + more_events.size()); - for (std::vector<TofEvent>::const_iterator it = more_events.begin(); + for (auto it = more_events.begin(); it != more_events.end(); ++it) this->weightedEventsNoTime.push_back(WeightedEventNoTime(*it)); break; @@ -405,7 +405,7 @@ operator+=(const std::vector<WeightedEvent> &more_events) { // and append to the list this->weightedEventsNoTime.reserve(this->weightedEventsNoTime.size() + more_events.size()); - for (std::vector<WeightedEvent>::const_iterator it = more_events.begin(); + for (auto it = more_events.begin(); it != more_events.end(); ++it) this->weightedEventsNoTime.push_back(WeightedEventNoTime(*it)); break; @@ -501,8 +501,8 @@ void EventList::minusHelper(std::vector<T1> &events, * Using it caused a segault, Ticket #2306. * So we cache the end (this speeds up too). */ - typename std::vector<T2>::const_iterator more_begin = more_events.begin(); - typename std::vector<T2>::const_iterator more_end = more_events.end(); + auto more_begin = more_events.begin(); + auto more_end = more_events.end(); for (itev = more_begin; itev != more_end; itev++) { // We call the constructor for T1. In the case of WeightedEventNoTime, the @@ -1019,8 +1019,8 @@ void merge(typename std::vector<T>::iterator begin1, typename std::vector<T>::iterator begin2, typename std::vector<T>::iterator end2, typename std::vector<T> &result_vector) { - typename std::vector<T>::iterator it1 = begin1; - typename std::vector<T>::iterator it2 = begin2; + auto it1 = begin1; + auto it2 = begin2; while (!((it1 == end1) && (it2 == end2))) { if (it1 == end1) { // Only it2 makes sense @@ -1052,9 +1052,9 @@ void merge(typename std::vector<T>::iterator begin1, template <typename T> void parallel_sort2(typename std::vector<T> &vec) { size_t size = vec.size(); - typename std::vector<T>::iterator begin = vec.begin(); - typename std::vector<T>::iterator middle = begin + size / 2; - typename std::vector<T>::iterator end = vec.end(); + auto begin = vec.begin(); + auto middle = begin + size / 2; + auto end = vec.end(); PRAGMA_OMP(parallel sections) { PRAGMA_OMP(section) { @@ -1094,11 +1094,11 @@ template <typename T> void parallel_sort4(std::vector<T> &vec) { // int num_cores = PARALLEL_NUMBER_OF_THREADS; size_t size = vec.size(); - typename std::vector<T>::iterator begin = vec.begin(); - typename std::vector<T>::iterator middle1 = begin + size / 4; - typename std::vector<T>::iterator middle2 = begin + size / 2; - typename std::vector<T>::iterator middle3 = begin + 3 * size / 4; - typename std::vector<T>::iterator end = vec.end(); + auto begin = vec.begin(); + auto middle1 = begin + size / 4; + auto middle2 = begin + size / 2; + auto middle3 = begin + 3 * size / 4; + auto end = vec.end(); PRAGMA_OMP(parallel sections) { PRAGMA_OMP(section) { std::sort(begin, middle1); } @@ -1505,7 +1505,7 @@ const MantidVec &EventList::constDataX() const { return *this->refX; } * @return a pointer to a MantidVec */ MantidVec *EventList::makeDataY() const { - MantidVec *Y = new MantidVec(); + auto Y = new MantidVec(); MantidVec E; // Generate the Y histogram while skipping the E if possible. generateHistogram(*this->refX, *Y, E, true); @@ -1519,7 +1519,7 @@ MantidVec *EventList::makeDataY() const { */ MantidVec *EventList::makeDataE() const { MantidVec Y; - MantidVec *E = new MantidVec(); + auto E = new MantidVec(); generateHistogram(*this->refX, Y, *E); // Y is unused. return E; @@ -1548,7 +1548,7 @@ const MantidVec &EventList::constDataY() const { yData = new MantidVecWithMarker(this->m_specNo, this->m_lockedMRU); // prepare to update the uncertainties - MantidVecWithMarker *eData = + auto eData = new MantidVecWithMarker(this->m_specNo, this->m_lockedMRU); mru->ensureEnoughBuffersE(thread); @@ -1629,7 +1629,7 @@ EventList::compressEventsHelper(const std::vector<T> &events, double errorSquared = 0; typename std::vector<T>::const_iterator it; - typename std::vector<T>::const_iterator it_end = + auto it_end = events.end(); // cache for speed for (it = events.begin(); it != it_end; it++) { if ((it->m_tof - lastTof) <= tolerance) { @@ -1847,8 +1847,8 @@ void EventList::compressEvents(double tolerance, EventList *destination, template <class T> typename std::vector<T>::const_iterator EventList::findFirstEvent(const std::vector<T> &events, const double seek_tof) { - typename std::vector<T>::const_iterator itev = events.begin(); - typename std::vector<T>::const_iterator itev_end = + auto itev = events.begin(); + auto itev_end = events.end(); // cache for speed // if tof < X[0], that means that you need to skip some events @@ -1873,8 +1873,8 @@ template <class T> typename std::vector<T>::const_iterator EventList::findFirstPulseEvent(const std::vector<T> &events, const double seek_pulsetime) { - typename std::vector<T>::const_iterator itev = events.begin(); - typename std::vector<T>::const_iterator itev_end = + auto itev = events.begin(); + auto itev_end = events.end(); // cache for speed // if tof < X[0], that means that you need to skip some events @@ -1903,8 +1903,8 @@ template <class T> typename std::vector<T>::const_iterator EventList::findFirstTimeAtSampleEvent( const std::vector<T> &events, const double seek_time, const double &tofFactor, const double &tofOffset) const { - typename std::vector<T>::const_iterator itev = events.begin(); - typename std::vector<T>::const_iterator itev_end = + auto itev = events.begin(); + auto itev_end = events.end(); // cache for speed // if tof < X[0], that means that you need to skip some events @@ -1931,8 +1931,8 @@ typename std::vector<T>::const_iterator EventList::findFirstTimeAtSampleEvent( template <class T> typename std::vector<T>::iterator EventList::findFirstEvent(std::vector<T> &events, const double seek_tof) { - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); // cache for speed + auto itev = events.begin(); + auto itev_end = events.end(); // cache for speed // if tof < X[0], that means that you need to skip some events while ((itev != itev_end) && (itev->tof() < seek_tof)) @@ -1986,8 +1986,8 @@ void EventList::histogramForWeightsHelper(const std::vector<T> &events, // Do we even have any events to do? if (events.size() > 0) { // Iterate through all events (sorted by tof) - typename std::vector<T>::const_iterator itev = findFirstEvent(events, X[0]); - typename std::vector<T>::const_iterator itev_end = events.end(); + auto itev = findFirstEvent(events, X[0]); + auto itev_end = events.end(); // The above can still take you to end() if no events above X[0], so check // again. if (itev == itev_end) @@ -2180,7 +2180,7 @@ void EventList::generateCountsHistogramPulseTime(const MantidVec &X, if (this->events.size() > 0) { // Iterate through all events (sorted by pulse time) - std::vector<TofEvent>::const_iterator itev = + auto itev = findFirstPulseEvent(this->events, X[0]); std::vector<TofEvent>::const_iterator itev_end = events.end(); // cache for speed @@ -2254,7 +2254,7 @@ void EventList::generateCountsHistogramTimeAtSample( if (this->events.size() > 0) { // Iterate through all events (sorted by pulse time) - std::vector<TofEvent>::const_iterator itev = + auto itev = findFirstTimeAtSampleEvent(this->events, X[0], tofFactor, tofOffset); std::vector<TofEvent>::const_iterator itev_end = events.end(); // cache for speed @@ -2556,7 +2556,7 @@ void EventList::convertTofHelper(std::vector<T> &events, std::function<double(double)> func) { // iterate through all events typename std::vector<T>::iterator itev; - typename std::vector<T>::iterator itev_end = events.end(); // cache for speed + auto itev_end = events.end(); // cache for speed for (itev = events.begin(); itev != itev_end; itev++) itev->m_tof = func(itev->m_tof); } @@ -2570,7 +2570,7 @@ void EventList::convertTofHelper(std::vector<T> &events, void EventList::convertTof(const double factor, const double offset) { // fix the histogram parameter MantidVec &x = this->refX.access(); - for (MantidVec::iterator iter = x.begin(); iter != x.end(); ++iter) + for (auto iter = x.begin(); iter != x.end(); ++iter) *iter = (*iter) * factor + offset; // this->refX.access() = x; @@ -2608,7 +2608,7 @@ void EventList::convertTofHelper(std::vector<T> &events, const double factor, const double offset) { // iterate through all events typename std::vector<T>::iterator itev; - typename std::vector<T>::iterator itev_end = events.end(); // cache for speed + auto itev_end = events.end(); // cache for speed for (itev = events.begin(); itev != itev_end; itev++) itev->m_tof = itev->m_tof * factor + offset; } @@ -2640,7 +2640,7 @@ void EventList::addPulsetimeHelper(std::vector<T> &events, const double seconds) { // iterate through all events typename std::vector<T>::iterator itev; - typename std::vector<T>::iterator itev_end = events.end(); // cache for speed + auto itev_end = events.end(); // cache for speed for (itev = events.begin(); itev != itev_end; itev++) itev->m_pulsetime += seconds; } @@ -2762,7 +2762,7 @@ template <class T> void EventList::getTofsHelper(const std::vector<T> &events, std::vector<double> &tofs) { typename std::vector<T>::const_iterator itev; - typename std::vector<T>::const_iterator itev_end = + auto itev_end = events.end(); // cache for speed tofs.clear(); for (itev = events.begin(); itev != itev_end; itev++) @@ -2810,7 +2810,7 @@ template <class T> void EventList::getWeightsHelper(const std::vector<T> &events, std::vector<double> &weights) { typename std::vector<T>::const_iterator itev; - typename std::vector<T>::const_iterator itev_end = + auto itev_end = events.end(); // cache for speed weights.clear(); for (itev = events.begin(); itev != itev_end; itev++) @@ -2859,7 +2859,7 @@ template <class T> void EventList::getWeightErrorsHelper(const std::vector<T> &events, std::vector<double> &weightErrors) { typename std::vector<T>::const_iterator itev; - typename std::vector<T>::const_iterator itev_end = + auto itev_end = events.end(); // cache for speed weightErrors.clear(); for (itev = events.begin(); itev != itev_end; itev++) @@ -2909,7 +2909,7 @@ void EventList::getPulseTimesHelper( const std::vector<T> &events, std::vector<Mantid::Kernel::DateAndTime> ×) { typename std::vector<T>::const_iterator itev; - typename std::vector<T>::const_iterator itev_end = + auto itev_end = events.end(); // cache for speed times.clear(); for (itev = events.begin(); itev != itev_end; itev++) @@ -3291,7 +3291,7 @@ void EventList::multiplyHelper(std::vector<T> &events, const double value, double valueSquared = value * value; typename std::vector<T>::iterator itev; - typename std::vector<T>::iterator itev_end = events.end(); + auto itev_end = events.end(); if (error == 0) { // Error-less calculation @@ -3399,8 +3399,8 @@ void EventList::multiplyHistogramHelper(std::vector<T> &events, size_t x_size = X.size(); // Iterate through all events (sorted by tof) - typename std::vector<T>::iterator itev = findFirstEvent(events, X[0]); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = findFirstEvent(events, X[0]); + auto itev_end = events.end(); // The above can still take you to end() if no events above X[0], so check // again. if (itev == itev_end) @@ -3522,8 +3522,8 @@ void EventList::divideHistogramHelper(std::vector<T> &events, size_t x_size = X.size(); // Iterate through all events (sorted by tof) - typename std::vector<T>::iterator itev = findFirstEvent(events, X[0]); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = findFirstEvent(events, X[0]); + auto itev_end = events.end(); // The above can still take you to end() if no events above X[0], so check // again. if (itev == itev_end) @@ -3695,8 +3695,8 @@ template <class T> void EventList::filterByPulseTimeHelper(std::vector<T> &events, DateAndTime start, DateAndTime stop, std::vector<T> &output) { - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); // Find the first event with m_pulsetime >= start while ((itev != itev_end) && (itev->m_pulsetime < start)) itev++; @@ -3722,8 +3722,8 @@ void EventList::filterByTimeAtSampleHelper(std::vector<T> &events, DateAndTime start, DateAndTime stop, double tofFactor, double tofOffset, std::vector<T> &output) { - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); // Find the first event with m_pulsetime >= start while ((itev != itev_end) && (calculateCorrectedFullTime(itev->m_pulsetime.totalNanoseconds(), @@ -3832,17 +3832,17 @@ template <class T> void EventList::filterInPlaceHelper(Kernel::TimeSplitterType &splitter, typename std::vector<T> &events) { // Iterate through the splitter at the same time - Kernel::TimeSplitterType::iterator itspl = splitter.begin(); - Kernel::TimeSplitterType::iterator itspl_end = splitter.end(); + auto itspl = splitter.begin(); + auto itspl_end = splitter.end(); DateAndTime start, stop; // Iterate for the input - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); // Iterator for the outputted list; will follow the input except when events // are dropped. - typename std::vector<T>::iterator itOut = events.begin(); + auto itOut = events.begin(); // This is the time of the first section. Anything before is thrown out. while (itspl != itspl_end) { @@ -3939,13 +3939,13 @@ void EventList::splitByTimeHelper(Kernel::TimeSplitterType &splitter, size_t numOutputs = outputs.size(); // Iterate through the splitter at the same time - Kernel::TimeSplitterType::iterator itspl = splitter.begin(); - Kernel::TimeSplitterType::iterator itspl_end = splitter.end(); + auto itspl = splitter.begin(); + auto itspl_end = splitter.end(); DateAndTime start, stop; // Iterate through all events (sorted by tof) - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); // This is the time of the first section. Anything before is thrown out. while (itspl != itspl_end) { @@ -4049,12 +4049,12 @@ void EventList::splitByFullTimeHelper(Kernel::TimeSplitterType &splitter, bool docorrection, double toffactor, double tofshift) const { // 1. Prepare to Iterate through the splitter at the same time - Kernel::TimeSplitterType::iterator itspl = splitter.begin(); - Kernel::TimeSplitterType::iterator itspl_end = splitter.end(); + auto itspl = splitter.begin(); + auto itspl_end = splitter.end(); // 2. Prepare to Iterate through all events (sorted by tof) - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); // 3. This is the time of the first section. Anything before is thrown out. while (itspl != itspl_end) { @@ -4323,13 +4323,13 @@ void EventList::splitByPulseTimeHelper(Kernel::TimeSplitterType &splitter, std::map<int, EventList *> outputs, typename std::vector<T> &events) const { // Prepare to TimeSplitter Iterate through the splitter at the same time - Kernel::TimeSplitterType::iterator itspl = splitter.begin(); - Kernel::TimeSplitterType::iterator itspl_end = splitter.end(); + auto itspl = splitter.begin(); + auto itspl_end = splitter.end(); Kernel::DateAndTime start, stop; // Prepare to Events Iterate through all events (sorted by tof) - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); // Iterate (loop) on all splitters while (itspl != itspl_end) { @@ -4493,8 +4493,8 @@ template <class T> void EventList::convertUnitsViaTofHelper(typename std::vector<T> &events, Mantid::Kernel::Unit *fromUnit, Mantid::Kernel::Unit *toUnit) { - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); for (; itev != itev_end; itev++) { // Conver to TOF double tof = fromUnit->singleToTOF(itev->m_tof); @@ -4548,8 +4548,8 @@ template <class T> void EventList::convertUnitsQuicklyHelper(typename std::vector<T> &events, const double &factor, const double &power) { - typename std::vector<T>::iterator itev = events.begin(); - typename std::vector<T>::iterator itev_end = events.end(); + auto itev = events.begin(); + auto itev_end = events.end(); for (; itev != itev_end; itev++) { // Output unit = factor * (input) ^ power itev->m_tof = factor * std::pow(itev->m_tof, power); diff --git a/Framework/DataObjects/src/EventWorkspace.cpp b/Framework/DataObjects/src/EventWorkspace.cpp index 7130d5031920d8c0dd4568590cfee5ad5a68bbfe..f95f7cbac707fc49019adcfc4b8a27de1142dc81 100644 --- a/Framework/DataObjects/src/EventWorkspace.cpp +++ b/Framework/DataObjects/src/EventWorkspace.cpp @@ -126,8 +126,8 @@ void EventWorkspace::copyDataFrom(const EventWorkspace &source, // Copy the vector of EventLists EventListVector source_data = source.data; EventListVector::iterator it; - EventListVector::iterator it_start = source_data.begin(); - EventListVector::iterator it_end = source_data.end(); + auto it_start = source_data.begin(); + auto it_end = source_data.end(); size_t source_data_size = source_data.size(); // Do we copy only a range? @@ -142,7 +142,7 @@ void EventWorkspace::copyDataFrom(const EventWorkspace &source, for (it = it_start; it != it_end; ++it) { // Create a new event list, copying over the events - EventList *newel = new EventList(**it); + auto newel = new EventList(**it); // Make sure to update the MRU to point to THIS event workspace. newel->setMRU(this->mru); this->data.push_back(newel); @@ -165,7 +165,7 @@ size_t EventWorkspace::size() const { /// @returns the number of bins in the Y data size_t EventWorkspace::blocksize() const { // Pick the first pixel to find the blocksize. - EventListVector::const_iterator it = data.begin(); + auto it = data.begin(); if (it == data.end()) { throw std::range_error("EventWorkspace::blocksize, no pixels in workspace, " "therefore cannot determine blocksize (# of bins)."); @@ -378,7 +378,7 @@ void EventWorkspace::getEventXMinMax(double &xmin, double &xmax) const { /// @returns The total number of events size_t EventWorkspace::getNumberEvents() const { size_t total = 0; - for (EventListVector::const_iterator it = this->data.begin(); + for (auto it = this->data.begin(); it != this->data.end(); ++it) { total += (*it)->getNumberEvents(); } @@ -392,7 +392,7 @@ size_t EventWorkspace::getNumberEvents() const { */ Mantid::API::EventType EventWorkspace::getEventType() const { Mantid::API::EventType out = Mantid::API::TOF; - for (EventListVector::const_iterator it = this->data.begin(); + for (auto it = this->data.begin(); it != this->data.end(); ++it) { Mantid::API::EventType thisType = (*it)->getEventType(); if (static_cast<int>(out) < static_cast<int>(thisType)) { @@ -455,7 +455,7 @@ size_t EventWorkspace::getMemorySize() const { // TODO: Add the MRU buffer // Add the memory from all the event lists - for (EventListVector::const_iterator it = this->data.begin(); + for (auto it = this->data.begin(); it != this->data.end(); ++it) { total += (*it)->getMemorySize(); } @@ -525,7 +525,7 @@ EventWorkspace::getOrAddEventList(const std::size_t workspace_index) { // Increase the size of the eventlist lists. for (size_t wi = old_size; wi <= workspace_index; wi++) { // Need to make a new one! - EventList *newel = new EventList(mru, specid_t(wi)); + auto newel = new EventList(mru, specid_t(wi)); // Add to list this->data.push_back(newel); } @@ -790,7 +790,7 @@ void EventWorkspace::generateHistogramPulseTime(const std::size_t index, */ void EventWorkspace::setAllX(Kernel::cow_ptr<MantidVec> &x) { // int counter=0; - EventListVector::iterator i = this->data.begin(); + auto i = this->data.begin(); for (; i != this->data.end(); ++i) { (*i)->setX(x); } diff --git a/Framework/DataObjects/src/FakeMD.cpp b/Framework/DataObjects/src/FakeMD.cpp index 2f707c8ea88fb554ef668c7429b22e3e143aca41..0a4761e4cf02771dff470fea601931cd02f33eeb 100644 --- a/Framework/DataObjects/src/FakeMD.cpp +++ b/Framework/DataObjects/src/FakeMD.cpp @@ -251,7 +251,7 @@ void FakeMD::addFakeRandomData(const std::vector<double> ¶ms, "UniformParams: min must be < max for all dimensions."); boost::uniform_real<double> u(min, max); // Range - gen_t *gen = new gen_t(rng, u); + auto gen = new gen_t(rng, u); gens[d] = gen; } diff --git a/Framework/DataObjects/src/FractionalRebinning.cpp b/Framework/DataObjects/src/FractionalRebinning.cpp index 49d44dd3bacf55822cc09c5ff8105a0bd47273bb..6479b47a40e84d559dc2831aec8cba98286f3a66 100644 --- a/Framework/DataObjects/src/FractionalRebinning.cpp +++ b/Framework/DataObjects/src/FractionalRebinning.cpp @@ -43,9 +43,9 @@ bool getIntersectionRegion(MatrixWorkspace_const_sptr outputWS, yn_hi < verticalAxis.front() || yn_lo > verticalAxis.back()) return false; - MantidVec::const_iterator start_it = + auto start_it = std::upper_bound(xAxis.begin(), xAxis.end(), xn_lo); - MantidVec::const_iterator end_it = + auto end_it = std::upper_bound(xAxis.begin(), xAxis.end(), xn_hi); x_start = 0; x_end = xAxis.size() - 1; diff --git a/Framework/DataObjects/src/MDBoxFlatTree.cpp b/Framework/DataObjects/src/MDBoxFlatTree.cpp index 145e24246674856d2e1cfe7bc1d55293ee572f4a..9e3bfa2ef25c3c76ac2fe7dfb9e955fdde7b64f2 100644 --- a/Framework/DataObjects/src/MDBoxFlatTree.cpp +++ b/Framework/DataObjects/src/MDBoxFlatTree.cpp @@ -409,7 +409,7 @@ void MDBoxFlatTree::loadExperimentInfos( std::map<std::string, std::string> entries; file->getEntries(entries); std::list<uint16_t> ExperimentBlockNum; - std::map<std::string, std::string>::iterator it = entries.begin(); + auto it = entries.begin(); for (; it != entries.end(); ++it) { std::string name = it->first; if (boost::starts_with(name, "experiment")) { diff --git a/Framework/DataObjects/src/MDHistoWorkspace.cpp b/Framework/DataObjects/src/MDHistoWorkspace.cpp index 89a89d9e19c7d678f8a2055218d04e30ac07dd8b..895c2e81ce998f2c81d4ec17e0b0f46002a1a786 100644 --- a/Framework/DataObjects/src/MDHistoWorkspace.cpp +++ b/Framework/DataObjects/src/MDHistoWorkspace.cpp @@ -321,7 +321,7 @@ coord_t *MDHistoWorkspace::getVertexesArray(size_t linearIndex, numDimensions, linearIndex, m_indexMaker, m_indexMax, dimIndexes); // The output vertexes coordinates - coord_t *out = new coord_t[numDimensions * numVertices]; + auto out = new coord_t[numDimensions * numVertices]; for (size_t i = 0; i < numVertices; ++i) { size_t outIndex = i * numDimensions; // Offset the 0th box by the position of this linear index, in each diff --git a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp index 4003a4dee23bd2376b232166f50e95bde3e2bc1c..e5f9f6c3b73ded46c80fe3e0be4b8068556b86db 100644 --- a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp +++ b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp @@ -582,7 +582,7 @@ bool MDHistoWorkspaceIterator::isWithinBounds(size_t index) const { std::vector<int64_t> MDHistoWorkspaceIterator::createPermutations( const std::vector<int> &widths) const { // look-up - PermutationsMap::iterator it = m_permutationsVertexTouchingMap.find(widths); + auto it = m_permutationsVertexTouchingMap.find(widths); if (it == m_permutationsVertexTouchingMap.end()) { if (widths[0] % 2 == 0) { diff --git a/Framework/DataObjects/src/MaskWorkspace.cpp b/Framework/DataObjects/src/MaskWorkspace.cpp index edddf2db92edd4ae382925d287d1baa7f2e17220..016b248da1e942206dd0fa898326bc8e059f90c1 100644 --- a/Framework/DataObjects/src/MaskWorkspace.cpp +++ b/Framework/DataObjects/src/MaskWorkspace.cpp @@ -197,7 +197,7 @@ bool MaskWorkspace::isMasked(const std::set<detid_t> &detectorIDs) const { } bool masked(true); - for (std::set<detid_t>::const_iterator it = detectorIDs.begin(); + for (auto it = detectorIDs.begin(); it != detectorIDs.end(); ++it) { if (!this->isMasked(*it)) { masked = false; diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp index 7554f7f04ab8fa95178afe9f906f3cfffa88caf6..3d47ad357acedc51cebd7209de932841f7cab169 100644 --- a/Framework/DataObjects/src/PeakColumn.cpp +++ b/Framework/DataObjects/src/PeakColumn.cpp @@ -316,7 +316,7 @@ const void *PeakColumn::void_pointer(size_t index) const { } PeakColumn *PeakColumn::clone() const { - PeakColumn *temp = new PeakColumn(this->m_peaks, this->m_name); + auto temp = new PeakColumn(this->m_peaks, this->m_name); return temp; } diff --git a/Framework/DataObjects/src/PeakShapeEllipsoid.cpp b/Framework/DataObjects/src/PeakShapeEllipsoid.cpp index 81b6c6e4376711990ad6edd56ddc356391b5425f..cc5906df7526433e993a96fe9b21ae1ba0dbe878 100644 --- a/Framework/DataObjects/src/PeakShapeEllipsoid.cpp +++ b/Framework/DataObjects/src/PeakShapeEllipsoid.cpp @@ -82,7 +82,7 @@ std::vector<Kernel::V3D> PeakShapeEllipsoid::getDirectionInSpecificFrame( "compatible with the direction vector"); } - for (std::vector<Kernel::V3D>::const_iterator it = m_directions.begin(); + for (auto it = m_directions.begin(); it != m_directions.end(); ++it) { directionsInFrame.push_back(invertedGoniometerMatrix * (*it)); Mantid::Kernel::V3D d = invertedGoniometerMatrix * (*it); diff --git a/Framework/DataObjects/src/PeaksWorkspace.cpp b/Framework/DataObjects/src/PeaksWorkspace.cpp index 5f60d4dd27b2d85681491721f7ee737bdefb5355..5e5dc3fa4a4028c7c97b575aac549afa59bb63e8 100644 --- a/Framework/DataObjects/src/PeaksWorkspace.cpp +++ b/Framework/DataObjects/src/PeaksWorkspace.cpp @@ -783,7 +783,7 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const { file->makeData(name, NeXus::CHAR, dims, false); file->openData(name); - char *toNexus = new char[maxShapeJSONLength * np]; + auto toNexus = new char[maxShapeJSONLength * np]; for (size_t ii = 0; ii < np; ii++) { std::string rowStr = shapes[ii]; for (size_t ic = 0; ic < rowStr.size(); ic++) diff --git a/Framework/DataObjects/src/SpecialWorkspace2D.cpp b/Framework/DataObjects/src/SpecialWorkspace2D.cpp index ba520975e3e4e88160a8a83d42598b8da55f8cd8..2978a692b96a0cc52e20808cc98bdc1a680875e4 100644 --- a/Framework/DataObjects/src/SpecialWorkspace2D.cpp +++ b/Framework/DataObjects/src/SpecialWorkspace2D.cpp @@ -114,7 +114,7 @@ const std::string SpecialWorkspace2D::toString() const { * @throw std::invalid_argument if the detector ID was not found */ double SpecialWorkspace2D::getValue(const detid_t detectorID) const { - std::map<detid_t, size_t>::const_iterator it = detID_to_WI.find(detectorID); + auto it = detID_to_WI.find(detectorID); if (it == detID_to_WI.end()) { std::ostringstream os; @@ -137,7 +137,7 @@ double SpecialWorkspace2D::getValue(const detid_t detectorID) const { */ double SpecialWorkspace2D::getValue(const detid_t detectorID, const double defaultValue) const { - std::map<detid_t, size_t>::const_iterator it = detID_to_WI.find(detectorID); + auto it = detID_to_WI.find(detectorID); if (it == detID_to_WI.end()) return defaultValue; else { @@ -162,7 +162,7 @@ double SpecialWorkspace2D::getValue(const detid_t detectorID, */ void SpecialWorkspace2D::setValue(const detid_t detectorID, const double value, const double error) { - std::map<detid_t, size_t>::iterator it = detID_to_WI.find(detectorID); + auto it = detID_to_WI.find(detectorID); if (it == detID_to_WI.end()) { std::stringstream msg; msg << "SpecialWorkspace2D::setValue(): Input Detector ID = " << detectorID diff --git a/Framework/DataObjects/src/TableWorkspace.cpp b/Framework/DataObjects/src/TableWorkspace.cpp index e650c051c49aa5f2608b21fc64b82c4b56204608..fdfceca9c27be5eec19c17b8c75632a2f11d0d2b 100644 --- a/Framework/DataObjects/src/TableWorkspace.cpp +++ b/Framework/DataObjects/src/TableWorkspace.cpp @@ -34,7 +34,7 @@ TableWorkspace::TableWorkspace(const TableWorkspace &other) : ITableWorkspace(other), m_rowCount(0), m_LogManager(new API::LogManager) { setRowCount(other.m_rowCount); - column_const_it it = other.m_columns.begin(); + auto it = other.m_columns.begin(); while (it != other.m_columns.end()) { addColumn(boost::shared_ptr<API::Column>((*it)->clone())); it++; @@ -48,7 +48,7 @@ TableWorkspace::~TableWorkspace() {} size_t TableWorkspace::getMemorySize() const { size_t data_size = 0; - for (column_const_it c = m_columns.begin(); c != m_columns.end(); c++) { + for (auto c = m_columns.begin(); c != m_columns.end(); c++) { data_size += (*c)->sizeOfData(); } data_size += m_LogManager->getMemorySize(); @@ -71,7 +71,7 @@ API::Column_sptr TableWorkspace::addColumn(const std::string &type, return c; } // Check that there is no column with the same name. - column_it ci = + auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name)); if (ci != m_columns.end()) { g_log.error() << "Column with name " << name << " already exists.\n"; @@ -99,14 +99,14 @@ API::Column_sptr TableWorkspace::addColumn(const std::string &type, void TableWorkspace::setRowCount(size_t count) { if (count == rowCount()) return; - for (column_it ci = m_columns.begin(); ci != m_columns.end(); ci++) + for (auto ci = m_columns.begin(); ci != m_columns.end(); ci++) resizeColumn(ci->get(), count); m_rowCount = count; } /// Gets the shared pointer to a column. API::Column_sptr TableWorkspace::getColumn(const std::string &name) { - column_it ci = + auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name)); if (ci == m_columns.end()) { std::string str = "Column " + name + " does not exist.\n"; @@ -118,8 +118,8 @@ API::Column_sptr TableWorkspace::getColumn(const std::string &name) { /// Gets the shared pointer to a column. API::Column_const_sptr TableWorkspace::getColumn(const std::string &name) const { - column_const_it c_it = m_columns.begin(); - column_const_it c_end = m_columns.end(); + auto c_it = m_columns.begin(); + auto c_end = m_columns.end(); for (; c_it != c_end; c_it++) { if (c_it->get()->name() == name) { return *c_it; @@ -151,7 +151,7 @@ API::Column_const_sptr TableWorkspace::getColumn(size_t index) const { } void TableWorkspace::removeColumn(const std::string &name) { - column_it ci = + auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name)); if (ci != m_columns.end()) { if (!ci->unique()) { @@ -167,7 +167,7 @@ void TableWorkspace::removeColumn(const std::string &name) { size_t TableWorkspace::insertRow(size_t index) { if (index >= rowCount()) index = rowCount(); - for (column_it ci = m_columns.begin(); ci != m_columns.end(); ci++) + for (auto ci = m_columns.begin(); ci != m_columns.end(); ci++) insertInColumn(ci->get(), index); ++m_rowCount; return index; @@ -180,7 +180,7 @@ void TableWorkspace::removeRow(size_t index) { g_log.error() << "Attempt to delete a non-existing row (" << index << ")\n"; return; } - for (column_it ci = m_columns.begin(); ci != m_columns.end(); ci++) + for (auto ci = m_columns.begin(); ci != m_columns.end(); ci++) removeFromColumn(ci->get(), index); --m_rowCount; } @@ -194,7 +194,7 @@ std::vector<std::string> TableWorkspace::getColumnNames() const { } bool TableWorkspace::addColumn(boost::shared_ptr<API::Column> column) { - column_it ci = std::find_if(m_columns.begin(), m_columns.end(), + auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(column->name())); if (ci != m_columns.end()) { g_log.error() << "Column with name " << column->name() diff --git a/Framework/DataObjects/src/Workspace2D.cpp b/Framework/DataObjects/src/Workspace2D.cpp index 3b12727daea40382c02d33cc9dc42e7f0ff1d0d0..c92170bb5a47a6278086cd7de32dff179d14b34c 100644 --- a/Framework/DataObjects/src/Workspace2D.cpp +++ b/Framework/DataObjects/src/Workspace2D.cpp @@ -76,7 +76,7 @@ void Workspace2D::init(const std::size_t &NVectors, const std::size_t &XLength, t2.access().resize(YLength); for (size_t i = 0; i < m_noVectors; i++) { // Create the spectrum upon init - Histogram1D *spec = new Histogram1D(); + auto spec = new Histogram1D(); data[i] = spec; // Set the data and X spec->setX(t1); diff --git a/Framework/Geometry/src/Instrument.cpp b/Framework/Geometry/src/Instrument.cpp index 0990d31e19b2e3d79b816f62485c16a9f91b945f..cfea87fc43eda87f7373691077bfcecb2a238c3b 100644 --- a/Framework/Geometry/src/Instrument.cpp +++ b/Framework/Geometry/src/Instrument.cpp @@ -182,7 +182,7 @@ void Instrument::getDetectors(detid2det_map &out_map) const { const detid2det_map &in_dets = static_cast<const Instrument *>(m_base)->m_detectorCache; // And turn them into parametrized versions - for (detid2det_map::const_iterator it = in_dets.begin(); + for (auto it = in_dets.begin(); it != in_dets.end(); ++it) { out_map.insert(std::pair<detid_t, IDetector_sptr>( it->first, @@ -201,13 +201,13 @@ std::vector<detid_t> Instrument::getDetectorIDs(bool skipMonitors) const { if (m_map) { const detid2det_map &in_dets = static_cast<const Instrument *>(m_base)->m_detectorCache; - for (detid2det_map::const_iterator it = in_dets.begin(); + for (auto it = in_dets.begin(); it != in_dets.end(); ++it) if (!skipMonitors || !it->second->isMonitor()) out.push_back(it->first); } else { const detid2det_map &in_dets = m_detectorCache; - for (detid2det_map::const_iterator it = in_dets.begin(); + for (auto it = in_dets.begin(); it != in_dets.end(); ++it) if (!skipMonitors || !it->second->isMonitor()) out.push_back(it->first); @@ -231,13 +231,13 @@ std::size_t Instrument::getNumberDetectors(bool skipMonitors) const { if (m_map) { const detid2det_map &in_dets = static_cast<const Instrument *>(m_base)->m_detectorCache; - for (detid2det_map::const_iterator it = in_dets.begin(); + for (auto it = in_dets.begin(); it != in_dets.end(); ++it) if (it->second->isMonitor()) monitors += 1; } else { const detid2det_map &in_dets = m_detectorCache; - for (detid2det_map::const_iterator it = in_dets.begin(); + for (auto it = in_dets.begin(); it != in_dets.end(); ++it) if (it->second->isMonitor()) monitors += 1; @@ -468,7 +468,7 @@ IDetector_const_sptr Instrument::getDetector(const detid_t &detector_id) const { IDetector_const_sptr baseDet = m_instr->getDetector(detector_id); return ParComponentFactory::createDetector(baseDet.get(), m_map); } else { - detid2det_map::const_iterator it = m_detectorCache.find(detector_id); + auto it = m_detectorCache.find(detector_id); if (it == m_detectorCache.end()) { std::stringstream readInt; readInt << detector_id; @@ -486,7 +486,7 @@ IDetector_const_sptr Instrument::getDetector(const detid_t &detector_id) const { * @returns A const pointer to the detector object */ const IDetector *Instrument::getBaseDetector(const detid_t &detector_id) const { - detid2det_map::const_iterator it = m_instr->m_detectorCache.find(detector_id); + auto it = m_instr->m_detectorCache.find(detector_id); if (it == m_instr->m_detectorCache.end()) { return NULL; } @@ -495,7 +495,7 @@ const IDetector *Instrument::getBaseDetector(const detid_t &detector_id) const { bool Instrument::isMonitor(const detid_t &detector_id) const { // Find the (base) detector object in the map. - detid2det_map::const_iterator it = m_instr->m_detectorCache.find(detector_id); + auto it = m_instr->m_detectorCache.find(detector_id); if (it == m_instr->m_detectorCache.end()) return false; // This is the detector @@ -509,7 +509,7 @@ bool Instrument::isMonitor(const std::set<detid_t> &detector_ids) const { if (detector_ids.empty()) return false; - for (std::set<detid_t>::const_iterator it = detector_ids.begin(); + for (auto it = detector_ids.begin(); it != detector_ids.end(); ++it) { if (this->isMonitor(*it)) return true; @@ -528,7 +528,7 @@ bool Instrument::isDetectorMasked(const detid_t &detector_id) const { if (!isParametrized()) return false; // Find the (base) detector object in the map. - detid2det_map::const_iterator it = m_instr->m_detectorCache.find(detector_id); + auto it = m_instr->m_detectorCache.find(detector_id); if (it == m_instr->m_detectorCache.end()) return false; // This is the detector @@ -557,7 +557,7 @@ bool Instrument::isDetectorMasked(const std::set<detid_t> &detector_ids) const { if (detector_ids.empty()) return false; - for (std::set<detid_t>::const_iterator it = detector_ids.begin(); + for (auto it = detector_ids.begin(); it != detector_ids.end(); ++it) { if (!this->isDetectorMasked(*it)) return false; @@ -714,7 +714,7 @@ void Instrument::markAsDetector(const IDetector *det) { // Create a (non-deleting) shared pointer to it IDetector_const_sptr det_sptr = IDetector_const_sptr(det, NoDeleting()); - std::map<int, IDetector_const_sptr>::iterator it = m_detectorCache.end(); + auto it = m_detectorCache.end(); m_detectorCache.insert(it, std::map<int, IDetector_const_sptr>::value_type( det->getID(), det_sptr)); } @@ -760,7 +760,7 @@ void Instrument::removeDetector(IDetector *det) { m_detectorCache.erase(id); // Also need to remove from monitor cache if appropriate if (det->isMonitor()) { - std::vector<detid_t>::iterator it = + auto it = std::find(m_monitorCache.begin(), m_monitorCache.end(), id); if (it != m_monitorCache.end()) m_monitorCache.erase(it); @@ -832,7 +832,7 @@ void Instrument::getBoundingBox(BoundingBox &assemblyBox) const { m_cachedBoundingBox = new BoundingBox(); ComponentID sourceID = getSource()->getComponentID(); // Loop over the children and define a box large enough for all of them - for (const_comp_it it = m_children.begin(); it != m_children.end(); + for (auto it = m_children.begin(); it != m_children.end(); ++it) { BoundingBox compBox; IComponent *component = *it; @@ -958,9 +958,9 @@ double Instrument::calcConversion( const std::map<detid_t, double> &offsets) { double factor = 0.; double offset; - for (std::vector<detid_t>::const_iterator iter = detectors.begin(); + for (auto iter = detectors.begin(); iter != detectors.end(); ++iter) { - std::map<detid_t, double>::const_iterator off_iter = offsets.find(*iter); + auto off_iter = offsets.find(*iter); if (off_iter != offsets.end()) { offset = offsets.find(*iter)->second; } else { diff --git a/Framework/Geometry/src/Instrument/CompAssembly.cpp b/Framework/Geometry/src/Instrument/CompAssembly.cpp index a5f0948c5c9f834d59ca86e9fddb531134cacf64..19459f2c82c25ac954389a438bb5842135c1721f 100644 --- a/Framework/Geometry/src/Instrument/CompAssembly.cpp +++ b/Framework/Geometry/src/Instrument/CompAssembly.cpp @@ -65,7 +65,7 @@ CompAssembly::~CompAssembly() { if (m_cachedBoundingBox) delete m_cachedBoundingBox; // Iterate over pointers in m_children, deleting them - for (comp_it it = m_children.begin(); it != m_children.end(); ++it) { + for (auto it = m_children.begin(); it != m_children.end(); ++it) { delete *it; } m_children.clear(); @@ -150,7 +150,7 @@ int CompAssembly::remove(IComponent *comp) { "CompAssembly::remove() called for a parameterized CompAssembly."); // Look for the passed in component in the list of children - std::vector<IComponent *>::iterator it = + auto it = std::find(m_children.begin(), m_children.end(), comp); if (it != m_children.end()) { // If it's found, remove it from the list and then delete it @@ -372,7 +372,7 @@ void CompAssembly::getBoundingBox(BoundingBox &assemblyBox) const { if (!m_cachedBoundingBox) { m_cachedBoundingBox = new BoundingBox(); // Loop over the children and define a box large enough for all of them - for (const_comp_it it = m_children.begin(); it != m_children.end(); + for (auto it = m_children.begin(); it != m_children.end(); ++it) { BoundingBox compBox; if (*it) { diff --git a/Framework/Geometry/src/Instrument/DetectorGroup.cpp b/Framework/Geometry/src/Instrument/DetectorGroup.cpp index e375171b0c8a97a21f57bd0e4a0a27c0c12194e5..08312a88f88b3823ceac4182269a57bc7c83ce03 100644 --- a/Framework/Geometry/src/Instrument/DetectorGroup.cpp +++ b/Framework/Geometry/src/Instrument/DetectorGroup.cpp @@ -353,7 +353,7 @@ std::string DetectorGroup::getParameterAsString(const std::string &pname, void DetectorGroup::getBoundingBox(BoundingBox &boundingBox) const { // boundingBox = BoundingBox(); // this change may modify a lot of behaviour // -> verify - for (DetCollection::const_iterator cit = m_detectors.begin(); + for (auto cit = m_detectors.begin(); cit != m_detectors.end(); ++cit) { BoundingBox memberBox; if (!boundingBox.isAxisAligned()) { diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index 547f95e5a70e134f2a68d069a107be1b9c194574..71eb60a535d270c43075f6871adb62a89bab43ad 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -1108,7 +1108,7 @@ void InstrumentDefinitionParser::appendAssembly( InstrumentDefinitionParser::getParentComponent(pElem); // check if this location is in the exclude list - std::vector<std::string>::const_iterator it = + auto it = find(excludeList.begin(), excludeList.end(), InstrumentDefinitionParser::getNameOfLocationElement( pElem, pParentElem)); @@ -1231,7 +1231,7 @@ void InstrumentDefinitionParser::appendLeaf(Geometry::ICompAssembly *parent, pLocElem, pCompElem); // Create the bank with the given parent. - Geometry::RectangularDetector *bank = + auto bank = new Geometry::RectangularDetector(name, parent); // set location for this newly added comp and set facing if specified in @@ -1609,7 +1609,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE, */ bool InstrumentDefinitionParser::isAssembly(std::string type) const { const std::string filename = m_xmlFile->getFileFullPathStr(); - std::map<std::string, bool>::const_iterator it = isTypeAssembly.find(type); + auto it = isTypeAssembly.find(type); if (it == isTypeAssembly.end()) { throw Kernel::Exception::InstrumentDefinitionError( diff --git a/Framework/Geometry/src/Instrument/NearestNeighbours.cpp b/Framework/Geometry/src/Instrument/NearestNeighbours.cpp index 7cb8442303c44e396a2f716c3201f966250808f5..a23a77884f0f878b4938bdd0b41bcdd67ffef12a 100644 --- a/Framework/Geometry/src/Instrument/NearestNeighbours.cpp +++ b/Framework/Geometry/src/Instrument/NearestNeighbours.cpp @@ -163,11 +163,11 @@ void NearestNeighbours::build(const int noNeighbours) { ++pointNo; } - ANNkd_tree *annTree = new ANNkd_tree(dataPoints, nspectra, 3); + auto annTree = new ANNkd_tree(dataPoints, nspectra, 3); pointNo = 0; // Run the nearest neighbour search on each detector, reusing the arrays - ANNidxArray nnIndexList = new ANNidx[m_noNeighbours]; - ANNdistArray nnDistList = new ANNdist[m_noNeighbours]; + auto nnIndexList = new ANNidx[m_noNeighbours]; + auto nnDistList = new ANNdist[m_noNeighbours]; for (detIt = spectraDets.begin(); detIt != spectraDets.end(); ++detIt) { ANNpoint scaledPos = dataPoints[pointNo]; @@ -216,7 +216,7 @@ void NearestNeighbours::build(const int noNeighbours) { */ std::map<specid_t, V3D> NearestNeighbours::defaultNeighbours(const specid_t spectrum) const { - MapIV::const_iterator vertex = m_specToVertex.find(spectrum); + auto vertex = m_specToVertex.find(spectrum); if (vertex != m_specToVertex.end()) { std::map<specid_t, V3D> result; @@ -249,8 +249,8 @@ std::map<specid_t, IDetector_const_sptr> NearestNeighbours::getSpectraDetectors( std::map<specid_t, IDetector_const_sptr> spectra; if (spectraMap.empty()) return spectra; - ISpectrumDetectorMapping::const_iterator cend = spectraMap.cend(); - for (ISpectrumDetectorMapping::const_iterator citr = spectraMap.cbegin(); + auto cend = spectraMap.cend(); + for (auto citr = spectraMap.cbegin(); citr != cend; ++citr) { const std::vector<detid_t> detIDs(citr->second.begin(), citr->second.end()); IDetector_const_sptr det = instrument->getDetectorG(detIDs); diff --git a/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp b/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp index 3513f3e4cd21f0dbdae63b43b8a79520e0b6f84d..c461064c44b638c4ee69cf839dc9d3ce6ee70a43 100644 --- a/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp +++ b/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp @@ -78,7 +78,7 @@ ObjCompAssembly::ObjCompAssembly(const ObjCompAssembly &ass) ObjCompAssembly::~ObjCompAssembly() { // Iterate over pointers in group, deleting them // std::vector<IComponent*>::iterator it; - for (comp_it it = group.begin(); it != group.end(); ++it) { + for (auto it = group.begin(); it != group.end(); ++it) { delete *it; } group.clear(); diff --git a/Framework/Geometry/src/Instrument/ParameterMap.cpp b/Framework/Geometry/src/Instrument/ParameterMap.cpp index 5a635c160670aae0838d5b609b06da8b0dac3866..f4669676777aac0ac516e854fe1ccf18e0a34873 100644 --- a/Framework/Geometry/src/Instrument/ParameterMap.cpp +++ b/Framework/Geometry/src/Instrument/ParameterMap.cpp @@ -104,14 +104,14 @@ bool ParameterMap::operator==(const ParameterMap &rhs) const { // asString method turns the ComponentIDs to full-qualified name identifiers // so we will use the same approach to compare them - pmap_cit thisEnd = this->m_map.end(); - pmap_cit rhsEnd = rhs.m_map.end(); - for (pmap_cit thisIt = this->m_map.begin(); thisIt != thisEnd; ++thisIt) { + auto thisEnd = this->m_map.end(); + auto rhsEnd = rhs.m_map.end(); + for (auto thisIt = this->m_map.begin(); thisIt != thisEnd; ++thisIt) { const IComponent *comp = static_cast<IComponent *>(thisIt->first); const std::string fullName = comp->getFullName(); const auto ¶m = thisIt->second; bool match(false); - for (pmap_cit rhsIt = rhs.m_map.begin(); rhsIt != rhsEnd; ++rhsIt) { + for (auto rhsIt = rhs.m_map.begin(); rhsIt != rhsEnd; ++rhsIt) { const IComponent *rhsComp = static_cast<IComponent *>(rhsIt->first); const std::string rhsFullName = rhsComp->getFullName(); if (fullName == rhsFullName && (*param) == (*rhsIt->second)) { @@ -203,14 +203,14 @@ const std::string ParameterMap::diff(const ParameterMap &rhs, // so we will use the same approach to compare them std::stringstream strOutput; - pmap_cit thisEnd = this->m_map.end(); - pmap_cit rhsEnd = rhs.m_map.end(); - for (pmap_cit thisIt = this->m_map.begin(); thisIt != thisEnd; ++thisIt) { + auto thisEnd = this->m_map.end(); + auto rhsEnd = rhs.m_map.end(); + for (auto thisIt = this->m_map.begin(); thisIt != thisEnd; ++thisIt) { const IComponent *comp = static_cast<IComponent *>(thisIt->first); const std::string fullName = comp->getFullName(); const auto ¶m = thisIt->second; bool match(false); - for (pmap_cit rhsIt = rhs.m_map.begin(); rhsIt != rhsEnd; ++rhsIt) { + for (auto rhsIt = rhs.m_map.begin(); rhsIt != rhsEnd; ++rhsIt) { const IComponent *rhsComp = static_cast<IComponent *>(rhsIt->first); const std::string rhsFullName = rhsComp->getFullName(); if (fullName == rhsFullName && (*param) == (*rhsIt->second)) { @@ -227,7 +227,7 @@ const std::string ParameterMap::diff(const ParameterMap &rhs, << " and value: " << (*param).asString() << std::endl; bool componentWithSameNameRHS = false; bool parameterWithSameNameRHS = false; - for (pmap_cit rhsIt = rhs.m_map.begin(); rhsIt != rhsEnd; ++rhsIt) { + for (auto rhsIt = rhs.m_map.begin(); rhsIt != rhsEnd; ++rhsIt) { const IComponent *rhsComp = static_cast<IComponent *>(rhsIt->first); const std::string rhsFullName = rhsComp->getFullName(); if (fullName == rhsFullName) { @@ -259,7 +259,7 @@ const std::string ParameterMap::diff(const ParameterMap &rhs, */ void ParameterMap::clearParametersByName(const std::string &name) { // Key is component ID so have to search through whole lot - for (pmap_it itr = m_map.begin(); itr != m_map.end();) { + for (auto itr = m_map.begin(); itr != m_map.end();) { if (itr->second->name() == name) { m_map.erase(itr++); } else { @@ -280,7 +280,7 @@ void ParameterMap::clearParametersByName(const std::string &name, const IComponent *comp) { if (!m_map.empty()) { const ComponentID id = comp->getComponentID(); - pmap_it it_found = m_map.find(id); + auto it_found = m_map.find(id); if (it_found != m_map.end()) { if (it_found->second->name() == name) { m_map.erase(it_found++); @@ -662,7 +662,7 @@ bool ParameterMap::contains(const IComponent *comp, const char *name, const ComponentID id = comp->getComponentID(); std::pair<pmap_cit, pmap_cit> components = m_map.equal_range(id); bool anytype = (strlen(type) == 0); - for (pmap_cit itr = components.first; itr != components.second; ++itr) { + for (auto itr = components.first; itr != components.second; ++itr) { boost::shared_ptr<Parameter> param = itr->second; if (boost::iequals(param->name(), name) && (anytype || param->type() == type)) { @@ -683,10 +683,10 @@ bool ParameterMap::contains(const IComponent *comp, return false; const ComponentID id = comp->getComponentID(); - pmap_cit it_found = m_map.find(id); + auto it_found = m_map.find(id); if (it_found != m_map.end()) { - pmap_cit itr = m_map.lower_bound(id); - pmap_cit itr_end = m_map.upper_bound(id); + auto itr = m_map.lower_bound(id); + auto itr_end = m_map.upper_bound(id); for (; itr != itr_end; ++itr) { const Parameter_sptr ¶m = itr->second; if (*param == parameter) @@ -742,16 +742,16 @@ boost::shared_ptr<Parameter> ParameterMap::get(const IComponent *comp, */ component_map_it ParameterMap::positionOf(const IComponent *comp, const char *name, const char *type) { - pmap_it result = m_map.end(); + auto result = m_map.end(); if (!comp) return result; const bool anytype = (strlen(type) == 0); if (!m_map.empty()) { const ComponentID id = comp->getComponentID(); - pmap_it it_found = m_map.find(id); + auto it_found = m_map.find(id); if (it_found != m_map.end()) { - pmap_it itr = m_map.lower_bound(id); - pmap_it itr_end = m_map.upper_bound(id); + auto itr = m_map.lower_bound(id); + auto itr_end = m_map.upper_bound(id); for (; itr != itr_end; ++itr) { Parameter_sptr param = itr->second; if (boost::iequals(param->nameAsCString(), name) && @@ -775,16 +775,16 @@ component_map_it ParameterMap::positionOf(const IComponent *comp, component_map_cit ParameterMap::positionOf(const IComponent *comp, const char *name, const char *type) const { - pmap_cit result = m_map.end(); + auto result = m_map.end(); if (!comp) return result; const bool anytype = (strlen(type) == 0); if (!m_map.empty()) { const ComponentID id = comp->getComponentID(); - pmap_cit it_found = m_map.find(id); + auto it_found = m_map.find(id); if (it_found != m_map.end()) { - pmap_cit itr = m_map.lower_bound(id); - pmap_cit itr_end = m_map.upper_bound(id); + auto itr = m_map.lower_bound(id); + auto itr_end = m_map.upper_bound(id); for (; itr != itr_end; ++itr) { Parameter_sptr param = itr->second; if (boost::iequals(param->nameAsCString(), name) && @@ -809,11 +809,11 @@ Parameter_sptr ParameterMap::getByType(const IComponent *comp, PARALLEL_CRITICAL(m_mapAccess) { if (!m_map.empty()) { const ComponentID id = comp->getComponentID(); - pmap_cit it_found = m_map.find(id); + auto it_found = m_map.find(id); if (it_found != m_map.end()) { if (it_found->first) { - pmap_cit itr = m_map.lower_bound(id); - pmap_cit itr_end = m_map.upper_bound(id); + auto itr = m_map.lower_bound(id); + auto itr_end = m_map.upper_bound(id); for (; itr != itr_end; ++itr) { Parameter_sptr param = itr->second; if (boost::iequals(param->type(), type)) { @@ -917,14 +917,14 @@ std::string ParameterMap::getString(const IComponent *comp, std::set<std::string> ParameterMap::names(const IComponent *comp) const { std::set<std::string> paramNames; const ComponentID id = comp->getComponentID(); - pmap_cit it_found = m_map.find(id); + auto it_found = m_map.find(id); if (it_found == m_map.end()) { return paramNames; } - pmap_cit itr = m_map.lower_bound(id); - pmap_cit itr_end = m_map.upper_bound(id); - for (pmap_cit it = itr; it != itr_end; ++it) { + auto itr = m_map.lower_bound(id); + auto itr_end = m_map.upper_bound(id); + for (auto it = itr; it != itr_end; ++it) { paramNames.insert(it->second->name()); } @@ -939,7 +939,7 @@ std::set<std::string> ParameterMap::names(const IComponent *comp) const { */ std::string ParameterMap::asString() const { std::stringstream out; - for (pmap_cit it = m_map.begin(); it != m_map.end(); it++) { + for (auto it = m_map.begin(); it != m_map.end(); it++) { boost::shared_ptr<Parameter> p = it->second; if (p && it->first) { const IComponent *comp = (const IComponent *)(it->first); diff --git a/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp b/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp index 99d2c5e514aa7c099034850ef04393d8111b7f5e..1fed0609970e9a9453cea79648d8124cee5fdd08 100644 --- a/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp +++ b/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp @@ -46,7 +46,7 @@ std::string CompositeImplicitFunction::toXMLString() const { functionElement->appendChild(parameterListElement); std::string functionXML; - for (FunctionIterator it = m_Functions.begin(); it != m_Functions.end(); + for (auto it = m_Functions.begin(); it != m_Functions.end(); ++it) { functionXML += (*it)->toXMLString(); } diff --git a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp index 05f056be280b56bb3f454a665e721157025067ac..8e01aeafcfa23927382cafd09ffec508a61a177b 100644 --- a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp +++ b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp @@ -46,7 +46,7 @@ bool MDGeometryBuilderXML<CheckDimensionPolicy>::addOrdinaryDimension( bool bAdded = false; // Addition fails by default. if (dimensionToAdd.get() != NULL) { CompareIMDDimension_const_sptr comparitor(dimensionToAdd); - DimensionContainerType::iterator location = std::find_if( + auto location = std::find_if( m_vecDimensions.begin(), m_vecDimensions.end(), comparitor); if (location == m_vecDimensions.end()) { m_vecDimensions.push_back(dimensionToAdd); @@ -64,7 +64,7 @@ bool MDGeometryBuilderXML<CheckDimensionPolicy>::addOrdinaryDimension( template <typename CheckDimensionPolicy> void MDGeometryBuilderXML<CheckDimensionPolicy>::addManyOrdinaryDimensions( VecIMDDimension_sptr manyDims) const { - VecIMDDimension_sptr::iterator it = manyDims.begin(); + auto it = manyDims.begin(); for (; it != manyDims.end(); ++it) { addOrdinaryDimension(*it); } @@ -205,7 +205,7 @@ const std::string &MDGeometryBuilderXML<CheckDimensionPolicy>::create() const { // Loop through dimensions and generate xml for each. std::string dimensionXMLString; - DimensionContainerType::iterator it = m_vecDimensions.begin(); + auto it = m_vecDimensions.begin(); for (; it != m_vecDimensions.end(); ++it) { dimensionXMLString += (*it)->toXMLString(); diff --git a/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp b/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp index 341df4504d933a5f0792cc278ee62242089537e9..95432f1691541424c4495cb037716a1508f48bdb 100644 --- a/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp +++ b/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp @@ -89,7 +89,7 @@ void MDGeometryXMLParser::execute() { MDGeometryXMLDefinitions::workspaceRefDimensionElementName()) ->innerText(); if (!xDimId.empty()) { - Iterator xDimensionIt = + auto xDimensionIt = find_if(vecAllDims.begin(), vecAllDims.end(), findID(xDimId)); if (xDimensionIt == vecAllDims.end()) { throw std::invalid_argument("Cannot determine x-dimension mapping."); @@ -108,7 +108,7 @@ void MDGeometryXMLParser::execute() { ->innerText(); if (!yDimId.empty()) { - Iterator yDimensionIt = + auto yDimensionIt = find_if(vecAllDims.begin(), vecAllDims.end(), findID(yDimId)); if (yDimensionIt == vecAllDims.end()) { throw std::invalid_argument("Cannot determine y-dimension mapping."); @@ -127,7 +127,7 @@ void MDGeometryXMLParser::execute() { ->innerText(); if (!zDimId.empty()) { - Iterator zDimensionIt = + auto zDimensionIt = find_if(vecAllDims.begin(), vecAllDims.end(), findID(zDimId)); if (zDimensionIt == vecAllDims.end()) { throw std::invalid_argument("Cannot determine z-dimension mapping."); @@ -145,7 +145,7 @@ void MDGeometryXMLParser::execute() { MDGeometryXMLDefinitions::workspaceRefDimensionElementName()) ->innerText(); if (!tDimId.empty()) { - Iterator tDimensionIt = + auto tDimensionIt = find_if(vecAllDims.begin(), vecAllDims.end(), findID(tDimId)); if (tDimensionIt == vecAllDims.end()) { throw std::invalid_argument("Cannot determine t-dimension mapping."); diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp index 75c5fb5fe2be6d8d76bc081899ffbf8b4e10774a..0ea4f61ad130c7bfb0b37885501939cff7ab9168 100644 --- a/Framework/Geometry/src/Math/Acomp.cpp +++ b/Framework/Geometry/src/Math/Acomp.cpp @@ -533,7 +533,7 @@ It requires that the Intersect is the same for both return -1; if (!A.Units.empty()) { - std::vector<int>::iterator Ept = Units.end(); + auto Ept = Units.end(); Units.resize(Units.size() + A.Units.size()); copy(A.Units.begin(), A.Units.end(), Ept); std::sort(Units.begin(), Units.end()); @@ -841,7 +841,7 @@ Remove identical items. // Units are sorted sort(Units.begin(), Units.end()); - std::vector<int>::iterator ux = unique(Units.begin(), Units.end()); + auto ux = unique(Units.begin(), Units.end()); cnt += static_cast<int>(std::distance(ux, Units.end())); Units.erase(ux, Units.end()); return cnt; @@ -888,7 +888,7 @@ i.e. one pass. std::vector<BnId>::iterator vc; for (vc = Work.begin(); vc != Work.end(); ++vc) { const int GrpIndex(vc->TrueCount() + 1); - std::vector<BnId>::iterator oc = vc + 1; + auto oc = vc + 1; for (oc = vc + 1; oc != Work.end(); ++oc) { const int OCnt = oc->TrueCount(); if (OCnt > GrpIndex) diff --git a/Framework/Geometry/src/Math/Algebra.cpp b/Framework/Geometry/src/Math/Algebra.cpp index d87ab1a5ae91930e7923355d64b8a39245cdc92c..e44cc0128431323ad0eff8dee55972c38eab45d3 100644 --- a/Framework/Geometry/src/Math/Algebra.cpp +++ b/Framework/Geometry/src/Math/Algebra.cpp @@ -176,7 +176,7 @@ std::string Algebra::writeMCNPX() const std::ostringstream cx; for (int i = 0; i < lenOut; i++) { if (islower(Out[i]) || isupper(Out[i])) { - std::map<int, std::string>::const_iterator vc = find_if( + auto vc = find_if( SurfMap.begin(), SurfMap.end(), MapSupport::valEqual<int, std::string>(std::string(1, Out[i]))); if (vc == SurfMap.end()) { @@ -246,7 +246,7 @@ int Algebra::setFunctionObjStr(const std::string &A) N *= -1; neg = 1; } - std::map<int, std::string>::iterator mc = SurfMap.find(N); + auto mc = SurfMap.find(N); if (mc == SurfMap.end()) { if (!bigFlag) { SurfMap[N] = nLiteral; diff --git a/Framework/Geometry/src/Math/BnId.cpp b/Framework/Geometry/src/Math/BnId.cpp index 556e536328f8335cbaa46035cff0c20b17e8cfeb..b0d5888bc0977f276d2c36f34509bb5edd56b979 100644 --- a/Framework/Geometry/src/Math/BnId.cpp +++ b/Framework/Geometry/src/Math/BnId.cpp @@ -92,7 +92,7 @@ int BnId::operator==(const BnId &A) const if (A.size != size || A.Tnum != Tnum || A.Znum != Znum) return 0; std::vector<int>::const_iterator vc; - std::vector<int>::const_iterator ac = A.Tval.begin(); + auto ac = A.Tval.begin(); for (vc = Tval.begin(); vc != Tval.end(); ++vc, ++ac) { if (ac == A.Tval.end()) // This should neve happen return 0; @@ -150,8 +150,8 @@ int BnId::operator<(const BnId &A) const if (Tnum != A.Tnum) return (Tnum < A.Tnum) ? 1 : 0; - std::vector<int>::const_reverse_iterator tvc = Tval.rbegin(); - std::vector<int>::const_reverse_iterator avc = A.Tval.rbegin(); + auto tvc = Tval.rbegin(); + auto avc = A.Tval.rbegin(); while (tvc != Tval.rend()) { if (*tvc != *avc) return *tvc < *avc; @@ -319,7 +319,7 @@ std::pair<int, BnId> BnId::makeCombination(const BnId &A) const std::pair<int, int> Tcnt(0, 0); // this counter std::pair<int, int> Acnt(0, 0); // A counter std::vector<int>::const_iterator tvc; - std::vector<int>::const_iterator avc = A.Tval.begin(); + auto avc = A.Tval.begin(); std::vector<int>::const_iterator chpt; // change point for (tvc = Tval.begin(); tvc != Tval.end(); ++tvc, ++avc) { if ((*avc * *tvc) < 0) // false/true diff --git a/Framework/Geometry/src/Math/PolyBase.cpp b/Framework/Geometry/src/Math/PolyBase.cpp index b3738109c6f350986650c2eeba1589f1e7381a80..6c31f6ac4589ba6cada4a75c006435a4b81541d9 100644 --- a/Framework/Geometry/src/Math/PolyBase.cpp +++ b/Framework/Geometry/src/Math/PolyBase.cpp @@ -493,7 +493,7 @@ std::vector<std::complex<double>> PolyBase::calcRoots(const double epsilon) // WS contains the the hessian matrix if required (eigenvalues/vectors) // gsl_poly_complex_workspace *WS(gsl_poly_complex_workspace_alloc(iDegree + 1)); - double *RZ = new double[2 * (iDegree + 1)]; + auto RZ = new double[2 * (iDegree + 1)]; gsl_poly_complex_solve(&afCoeff.front(), iDegree + 1, WS, RZ); for (int i = 0; i < iDegree; i++) Out[i] = std::complex<double>(RZ[2 * i], RZ[2 * i + 1]); diff --git a/Framework/Geometry/src/Objects/Object.cpp b/Framework/Geometry/src/Objects/Object.cpp index 70333969901fb9b560d63a981b3ce90cf5a13ac3..57eeb2a1517cce2c7ac26bfa8a170d2e06ceb67f 100644 --- a/Framework/Geometry/src/Objects/Object.cpp +++ b/Framework/Geometry/src/Objects/Object.cpp @@ -183,7 +183,7 @@ std::string Object::cellStr(const std::map<int, Object> &MList) const { Mantid::Kernel::Strings::convPartNum(TopStr.substr(pos), cN); if (nLen > 0) { cx << "("; - std::map<int, Object>::const_iterator vc = MList.find(cN); + auto vc = MList.find(cN); if (vc == MList.end()) throw Kernel::Exception::NotFoundError( "Not found in the list of indexable hulls (Object::cellStr)", cN); @@ -279,7 +279,7 @@ int Object::populate(const std::map<int, boost::shared_ptr<Surface>> &Smap) { SurfPoint *KV = dynamic_cast<SurfPoint *>(T1); if (KV) { // Ensure that we have a it in the surface list: - std::map<int, boost::shared_ptr<Surface>>::const_iterator mf = + auto mf = Smap.find(KV->getKeyN()); if (mf != Smap.end()) { KV->setKey(mf->second); @@ -1338,8 +1338,8 @@ double Object::ConeSolidAngle(const V3D &observer, const int nslices(Mantid::Geometry::Cone::g_nslices); const double angle_step = 2 * M_PI / (double)nslices; // Store the (x,y) points as they are used quite frequently - double *cos_table = new double[nslices]; - double *sin_table = new double[nslices]; + auto cos_table = new double[nslices]; + auto sin_table = new double[nslices]; double solid_angle(0.0); for (int sl = 0; sl < nslices; ++sl) { diff --git a/Framework/Geometry/src/Objects/RuleItems.cpp b/Framework/Geometry/src/Objects/RuleItems.cpp index 1a303d440f151ea7cf88b1800647acf55b7a023d..7b7f4ff451799acba2659845f5234a1e3e17a682 100644 --- a/Framework/Geometry/src/Objects/RuleItems.cpp +++ b/Framework/Geometry/src/Objects/RuleItems.cpp @@ -815,7 +815,7 @@ bool SurfPoint::isValid(const std::map<int, int> &MX) const @return MX.second if key found or 0 */ { - std::map<int, int>::const_iterator lx = MX.find(keyN); + auto lx = MX.find(keyN); if (lx == MX.end()) return false; const int rtype = (lx->second) ? 1 : -1; diff --git a/Framework/Geometry/src/Objects/Rules.cpp b/Framework/Geometry/src/Objects/Rules.cpp index a36d02607e45275999c0acf58c5e425bcfdfaa97..c94bd9f171b04b2d1cd09d7681d2d26d31e1657e 100644 --- a/Framework/Geometry/src/Objects/Rules.cpp +++ b/Framework/Geometry/src/Objects/Rules.cpp @@ -632,7 +632,7 @@ int Rule::getKeyList(std::vector<int> &IList) const } } std::sort(IList.begin(), IList.end()); - std::vector<int>::iterator px = std::unique(IList.begin(), IList.end()); + auto px = std::unique(IList.begin(), IList.end()); IList.erase(px, IList.end()); return static_cast<int>(IList.size()); } diff --git a/Framework/Geometry/src/Objects/Track.cpp b/Framework/Geometry/src/Objects/Track.cpp index ccb4c9dca1a7969d2514c42b9dfa9474a4993414..1c20d73690925c6b711068f79a5c6c499b184e1f 100644 --- a/Framework/Geometry/src/Objects/Track.cpp +++ b/Framework/Geometry/src/Objects/Track.cpp @@ -80,11 +80,11 @@ int Track::nonComplete() const { if (m_links.size() < 2) { return 0; } - LType::const_iterator ac = m_links.begin(); + auto ac = m_links.begin(); if (m_startPoint.distance(ac->entryPoint) > Tolerance) { return 1; } - LType::const_iterator bc = ac; + auto bc = ac; ++bc; while (bc != m_links.end()) { @@ -106,8 +106,8 @@ void Track::removeCojoins() { if (m_links.empty()) { return; } - LType::iterator prevNode = m_links.begin(); - LType::iterator nextNode = m_links.begin(); + auto prevNode = m_links.begin(); + auto nextNode = m_links.begin(); ++nextNode; while (nextNode != m_links.end()) { if (prevNode->componentID == nextNode->componentID) { @@ -141,7 +141,7 @@ void Track::addPoint(const int directionFlag, const V3D &endPoint, const Object &obj, const ComponentID compID) { IntersectionPoint newPoint(directionFlag, endPoint, endPoint.distance(m_startPoint), obj, compID); - PType::iterator lowestPtr = + auto lowestPtr = std::lower_bound(m_surfPoints.begin(), m_surfPoints.end(), newPoint); m_surfPoints.insert(lowestPtr, newPoint); } @@ -166,7 +166,7 @@ int Track::addLink(const V3D &firstPoint, const V3D &secondPoint, m_links.push_back(newLink); index = 0; } else { - LType::iterator linkPtr = + auto linkPtr = std::lower_bound(m_links.begin(), m_links.end(), newLink); // must extract the distance before you insert otherwise the iterators are // incompatible @@ -188,7 +188,7 @@ void Track::buildLink() { // The surface points were added in order when they were built so no sorting // is required here. PType::const_iterator ac = m_surfPoints.begin(); - PType::const_iterator bc = ac; + auto bc = ac; ++bc; V3D workPt = m_startPoint; // last good point // First point is not necessarily in an object diff --git a/Framework/ICat/src/ICat3/ICat3Helper.cpp b/Framework/ICat/src/ICat3/ICat3Helper.cpp index 6c14fc259210ac7dd4ffebb8f4b9ae0715766d8c..cf3c5c2842316e848256e63178ef655d966fdb59 100644 --- a/Framework/ICat/src/ICat3/ICat3Helper.cpp +++ b/Framework/ICat/src/ICat3/ICat3Helper.cpp @@ -484,7 +484,7 @@ ICat3::ns1__advancedSearchDetails * CICatHelper::buildSearchQuery(const CatalogSearchParam &inputs) { // As this is a member variable we need to reset the search terms once // a new search is performed. - ICat3::ns1__advancedSearchDetails *advancedSearchDetails = + auto advancedSearchDetails = new ICat3::ns1__advancedSearchDetails; ns1__investigationInclude invesInclude = diff --git a/Framework/Kernel/src/CompositeValidator.cpp b/Framework/Kernel/src/CompositeValidator.cpp index 1d81d3d2498125b2a2b277235c04c8f4db9818f2..fb184156be4c71ec27cb1bd1e512ffe13cc89200 100644 --- a/Framework/Kernel/src/CompositeValidator.cpp +++ b/Framework/Kernel/src/CompositeValidator.cpp @@ -20,8 +20,8 @@ std::vector<std::string> CompositeValidator::allowedValues() const { std::multiset<std::string> elem_all; // how many validators return non-empty list of allowed values int n_combinations(0); - std::list<IValidator_sptr>::const_iterator itrEnd = m_children.end(); - for (std::list<IValidator_sptr>::const_iterator itr = m_children.begin(); + auto itrEnd = m_children.end(); + for (auto itr = m_children.begin(); itr != itrEnd; ++itr) { std::vector<std::string> subs = (*itr)->allowedValues(); if (subs.empty()) @@ -34,13 +34,13 @@ std::vector<std::string> CompositeValidator::allowedValues() const { if (n_combinations < 2) return std::vector<std::string>(elem_unique.begin(), elem_unique.end()); // there is more then one combination and we have to identify its union; - for (std::set<std::string>::const_iterator its = elem_unique.begin(); + for (auto its = elem_unique.begin(); its != elem_unique.end(); ++its) { - std::multiset<std::string>::iterator im = elem_all.find(*its); + auto im = elem_all.find(*its); elem_all.erase(im); } std::set<std::string> rez; - for (std::multiset<std::string>::const_iterator im = elem_all.begin(); + for (auto im = elem_all.begin(); im != elem_all.end(); ++im) { rez.insert(*im); } @@ -54,8 +54,8 @@ std::vector<std::string> CompositeValidator::allowedValues() const { Kernel::IValidator_sptr CompositeValidator::clone() const { boost::shared_ptr<CompositeValidator> copy = boost::make_shared<CompositeValidator>(); - std::list<IValidator_sptr>::const_iterator itrEnd = m_children.end(); - for (std::list<IValidator_sptr>::const_iterator itr = m_children.begin(); + auto itrEnd = m_children.end(); + for (auto itr = m_children.begin(); itr != itrEnd; ++itr) { copy->add((*itr)->clone()); } @@ -74,8 +74,8 @@ void CompositeValidator::add(Kernel::IValidator_sptr child) { * @return A user level description of the first problem it finds otherwise "" */ std::string CompositeValidator::check(const boost::any &value) const { - std::list<IValidator_sptr>::const_iterator itrEnd = m_children.end(); - for (std::list<IValidator_sptr>::const_iterator itr = m_children.begin(); + auto itrEnd = m_children.end(); + for (auto itr = m_children.begin(); itr != itrEnd; ++itr) { std::string error = (*itr)->check(value); // exit on the first error, to avoid passing doing more tests on invalid diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp index cb7b0e1b59f2e3414c8e15eca138d47ddb3835ec..6d4b2541b7b242cf54e14f1c6fb53a4e59d36baa 100644 --- a/Framework/Kernel/src/ConfigService.cpp +++ b/Framework/Kernel/src/ConfigService.cpp @@ -82,9 +82,9 @@ void splitPath(const std::string &path, std::vector<std::string> &splitted) { splitted.clear(); Poco::StringTokenizer tokenizer(path, ";,", options); - Poco::StringTokenizer::Iterator iend = tokenizer.end(); + auto iend = tokenizer.end(); splitted.reserve(tokenizer.count()); - for (Poco::StringTokenizer::Iterator itr = tokenizer.begin(); itr != iend; + for (auto itr = tokenizer.begin(); itr != iend; ++itr) { if (!itr->empty()) { splitted.push_back(*itr); @@ -551,7 +551,7 @@ std::string ConfigServiceImpl::makeAbsolute(const std::string &dir, // C++ doesn't have a const version of operator[] for maps so I can't call // that here - std::map<std::string, bool>::const_iterator it = m_ConfigPaths.find(key); + auto it = m_ConfigPaths.find(key); bool required = false; if (it != m_ConfigPaths.end()) { required = it->second; @@ -615,7 +615,7 @@ bool ConfigServiceImpl::isInDataSearchList(const std::string &path) const { std::string correctedPath = path; replace(correctedPath.begin(), correctedPath.end(), '\\', '/'); - std::vector<std::string>::const_iterator it = + auto it = std::find_if(m_DataSearchDirs.begin(), m_DataSearchDirs.end(), std::bind2nd(std::equal_to<std::string>(), correctedPath)); return (it != m_DataSearchDirs.end()); @@ -909,8 +909,8 @@ void ConfigServiceImpl::saveConfig(const std::string &filename) const { // current user properties so append them if (!m_changed_keys.empty()) { updated_file += "\n"; - std::set<std::string>::iterator key_end = m_changed_keys.end(); - for (std::set<std::string>::iterator key_itr = m_changed_keys.begin(); + auto key_end = m_changed_keys.end(); + for (auto key_itr = m_changed_keys.begin(); key_itr != key_end;) { updated_file += *key_itr + "="; std::string value = getString(*key_itr, false); @@ -952,7 +952,7 @@ void ConfigServiceImpl::saveConfig(const std::string &filename) const { std::string ConfigServiceImpl::getString(const std::string &keyName, bool use_cache) const { if (use_cache) { - std::map<std::string, std::string>::const_iterator mitr = + auto mitr = m_AbsolutePaths.find(keyName); if (mitr != m_AbsolutePaths.end()) { return (*mitr).second; @@ -1802,7 +1802,7 @@ ConfigServiceImpl::getInstrument(const std::string &instrumentName) const { } // Now let's look through the other facilities - std::vector<FacilityInfo *>::const_iterator it = m_facilities.begin(); + auto it = m_facilities.begin(); for (; it != m_facilities.end(); ++it) { try { g_log.debug() << "Looking for " << instrumentName << " at " @@ -1863,7 +1863,7 @@ ConfigServiceImpl::getFacility(const std::string &facilityName) const { if (facilityName.empty()) return this->getFacility(); - std::vector<FacilityInfo *>::const_iterator it = m_facilities.begin(); + auto it = m_facilities.begin(); for (; it != m_facilities.end(); ++it) { if ((**it).name() == facilityName) { return **it; diff --git a/Framework/Kernel/src/DiskBuffer.cpp b/Framework/Kernel/src/DiskBuffer.cpp index 0e2b61b091e48b9397c4c300c75de1a900d8cabb..0c84d36ce039c18fb0b400cd2f71446cc0fb3f03 100644 --- a/Framework/Kernel/src/DiskBuffer.cpp +++ b/Framework/Kernel/src/DiskBuffer.cpp @@ -168,7 +168,7 @@ void DiskBuffer::writeOldObjects() { // the value of the argument is // NOT GUARANTEED to be incremented or decremented before it is passed to // the function. - std::list<ISaveable *>::iterator it = --couldNotWrite.end(); + auto it = --couldNotWrite.end(); memoryNotWritten += obj->setBufferPosition(it); objectsNotWritten++; } @@ -377,9 +377,9 @@ void DiskBuffer::setFreeSpaceVector(std::vector<uint64_t> &free) { if (free.size() % 2 != 0) throw std::length_error("Free vector size is not a factor of 2."); - for (std::vector<uint64_t>::iterator it = free.begin(); it != free.end(); + for (auto it = free.begin(); it != free.end(); it += 2) { - std::vector<uint64_t>::iterator it_next = boost::next(it); + auto it_next = boost::next(it); if (*it == 0 && *it_next == 0) { continue; // Not really a free space block! diff --git a/Framework/Kernel/src/FacilityInfo.cpp b/Framework/Kernel/src/FacilityInfo.cpp index 9a42c5a20839d19cba3db33d3a9db7852cb8215c..09329a5e05a4463c26dac2ab004896f9c45c7e85 100644 --- a/Framework/Kernel/src/FacilityInfo.cpp +++ b/Framework/Kernel/src/FacilityInfo.cpp @@ -74,7 +74,7 @@ void FacilityInfo::fillExtensions(const Poco::XML::Element *elem) { typedef Poco::StringTokenizer tokenizer; tokenizer exts(extsStr, ",", tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM); - for (tokenizer::Iterator it = exts.begin(); it != exts.end(); ++it) { + for (auto it = exts.begin(); it != exts.end(); ++it) { addExtension(*it); } } @@ -190,7 +190,7 @@ const InstrumentInfo &FacilityInfo::instrument(std::string iName) const { } } - std::vector<InstrumentInfo>::const_iterator it = m_instruments.begin(); + auto it = m_instruments.begin(); for (; it != m_instruments.end(); ++it) { if (boost::iequals(it->name(), iName)) // Case-insensitive search { @@ -245,7 +245,7 @@ FacilityInfo::instruments(const std::string &tech) const { */ std::vector<std::string> FacilityInfo::computeResources() const { std::vector<std::string> names; - ComputeResourcesMap::const_iterator it = m_computeResources.begin(); + auto it = m_computeResources.begin(); while (it != m_computeResources.end()) { names.push_back((*it).first); ++it; diff --git a/Framework/Kernel/src/FileDescriptor.cpp b/Framework/Kernel/src/FileDescriptor.cpp index f9d6bcef937971c2b5ed42e9e56157aa7dbad127..d79863f0343e3e7d07c4b42f2cb26f7c34d8c105 100644 --- a/Framework/Kernel/src/FileDescriptor.cpp +++ b/Framework/Kernel/src/FileDescriptor.cpp @@ -75,7 +75,7 @@ bool FileDescriptor::isAscii(std::istream &data, const size_t nbytes) { */ bool FileDescriptor::isAscii(FILE *file, const size_t nbytes) { // read the data and reset the seek index back to the beginning - char *data = new char[nbytes]; + auto data = new char[nbytes]; char *pend = &data[fread(data, 1, nbytes, file)]; int retval = fseek(file, 0, SEEK_SET); if (retval < 0) diff --git a/Framework/Kernel/src/FilterChannel.cpp b/Framework/Kernel/src/FilterChannel.cpp index 4512ab60aed8410ab007f8edfd97845df5809105..711b9fd8b97ae7556e778adc40aeaf376c67e138 100644 --- a/Framework/Kernel/src/FilterChannel.cpp +++ b/Framework/Kernel/src/FilterChannel.cpp @@ -25,7 +25,7 @@ void FilterChannel::setProperty(const std::string &name, if (name.compare(0, 7, "channel") == 0) { StringTokenizer tokenizer(value, ",;", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); - for (StringTokenizer::Iterator it = tokenizer.begin(); + for (auto it = tokenizer.begin(); it != tokenizer.end(); ++it) { addChannel(LoggingRegistry::defaultRegistry().channelForName(*it)); } diff --git a/Framework/Kernel/src/LibraryManager.cpp b/Framework/Kernel/src/LibraryManager.cpp index da72c1042cb65c1941276552fe625c0181efb42c..aaf900a10dcd3090c7bc6c5304863066edad45ad 100644 --- a/Framework/Kernel/src/LibraryManager.cpp +++ b/Framework/Kernel/src/LibraryManager.cpp @@ -89,7 +89,7 @@ bool LibraryManagerImpl::skip(const std::string &filename) { initialized = true; } bool skipme(false); - for (std::set<std::string>::const_iterator itr = excludes.begin(); + for (auto itr = excludes.begin(); itr != excludes.end(); ++itr) { if (filename.find(*itr) != std::string::npos) { skipme = true; diff --git a/Framework/Kernel/src/LogParser.cpp b/Framework/Kernel/src/LogParser.cpp index 361c3ed225ad4f1a3696754177b98c5f37cdffb6..e07355142be115561db68d9ce57afac2695ec8e7 100644 --- a/Framework/Kernel/src/LogParser.cpp +++ b/Framework/Kernel/src/LogParser.cpp @@ -98,7 +98,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, return 0; if (isNumeric) { - Kernel::TimeSeriesProperty<double> *logv = + auto logv = new Kernel::TimeSeriesProperty<double>(name); auto it = change_times.begin(); for (; it != change_times.end(); ++it) { @@ -109,7 +109,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, } return logv; } else { - Kernel::TimeSeriesProperty<std::string> *logv = + auto logv = new Kernel::TimeSeriesProperty<std::string>(name); auto it = change_times.begin(); for (; it != change_times.end(); ++it) { diff --git a/Framework/Kernel/src/MagneticIon.cpp b/Framework/Kernel/src/MagneticIon.cpp index 40076c7c1641522d090d1f06f50ce1f12f507401..6a8be2ac24170589734ad55a9b8c4357bc98dda1 100644 --- a/Framework/Kernel/src/MagneticIon.cpp +++ b/Framework/Kernel/src/MagneticIon.cpp @@ -872,7 +872,7 @@ void createIonLookup(IonIndex &ion_map) { */ const MagneticIon &getMagneticIon(const std::string &symbol) { const IonIndex &ionIndex = ionMap(); - std::map<std::string, MagneticIon>::const_iterator cit = + auto cit = ionIndex.find(symbol); if (cit == ionIndex.end()) { diff --git a/Framework/Kernel/src/Matrix.cpp b/Framework/Kernel/src/Matrix.cpp index 014284f04c4da6b769c33f2d1157cb0390e3f336..530aa6b5cc6dc1188ec5a0430132a7c0ce40fcd0 100644 --- a/Framework/Kernel/src/Matrix.cpp +++ b/Framework/Kernel/src/Matrix.cpp @@ -568,7 +568,7 @@ template <typename T> void Matrix<T>::setMem(const size_t a, const size_t b) { nx = a; ny = b; if (nx * ny) { - T *tmpX = new T[nx * ny]; + auto tmpX = new T[nx * ny]; V = new T *[nx]; for (size_t i = 0; i < nx; i++) { V[i] = tmpX + (i * ny); @@ -793,8 +793,8 @@ Matrix<T> &Matrix<T>::Transpose() } // irregular matrix // get some memory - T *tmpX = new T[ny * nx]; - T **Vt = new T *[ny]; + auto tmpX = new T[ny * nx]; + auto Vt = new T *[ny]; for (size_t i = 0; i < ny; i++) { Vt[i] = tmpX + (i * nx); } @@ -974,9 +974,9 @@ T Matrix<T>::Invert() V[0][0] = static_cast<T>(1.) / V[0][0]; return det; } - int *indx = new int[nx]; // Set in lubcmp + auto indx = new int[nx]; // Set in lubcmp - double *col = new double[nx]; + auto col = new double[nx]; int d; Matrix<T> Lcomp(*this); Lcomp.lubcmp(indx, d); @@ -1114,7 +1114,7 @@ void Matrix<T>::lubcmp(int *rowperm, int &interchange) std::cerr << "Error with lubcmp" << std::endl; return; } - double *vv = new double[nx]; + auto vv = new double[nx]; interchange = 1; for (int i = 0; i < static_cast<int>(nx); i++) { big = 0.0; diff --git a/Framework/Kernel/src/MultiFileValidator.cpp b/Framework/Kernel/src/MultiFileValidator.cpp index 5c70ac32fc91815ef97eb5150bef9f3171dc2050..ec97fe5b2f63bc5f41b5494460c5be83d182d69c 100644 --- a/Framework/Kernel/src/MultiFileValidator.cpp +++ b/Framework/Kernel/src/MultiFileValidator.cpp @@ -60,7 +60,7 @@ std::string MultiFileValidator::checkValidity( VecVecString_cIt; typedef std::vector<std::string>::const_iterator VecString_cIt; - for (VecVecString_cIt rowIt = values.begin(); rowIt != values.end(); + for (auto rowIt = values.begin(); rowIt != values.end(); ++rowIt) { std::vector<std::string> row = (*rowIt); for (VecString_cIt valueIt = row.begin(); valueIt != row.end(); ++valueIt) { diff --git a/Framework/Kernel/src/NetworkProxyOSX.cpp b/Framework/Kernel/src/NetworkProxyOSX.cpp index 5bdae5c9c297078640f34c5be7d481dee3fc852e..1db21340e15d78b4739bea3863204d327fb6cda6 100644 --- a/Framework/Kernel/src/NetworkProxyOSX.cpp +++ b/Framework/Kernel/src/NetworkProxyOSX.cpp @@ -216,7 +216,7 @@ ProxyInfo findHttpProxy(const std::string &targetURLString, ProxyInfoVec info = proxyInformationFromPac(dict, targetURLString, logger); bool foundHttpProxy = false; - for (ProxyInfoVec::iterator it = info.begin(); it != info.end(); ++it) { + for (auto it = info.begin(); it != info.end(); ++it) { ProxyInfo proxyInfo = *it; if (proxyInfo.isHttpProxy()) { foundHttpProxy = true; diff --git a/Framework/Kernel/src/PropertyManager.cpp b/Framework/Kernel/src/PropertyManager.cpp index cdf6d916005cc33c5ea30b0e57dff4e622dabb0b..b4c84767d411f38f5087a87b4cb48f9530c9f45f 100644 --- a/Framework/Kernel/src/PropertyManager.cpp +++ b/Framework/Kernel/src/PropertyManager.cpp @@ -41,7 +41,7 @@ PropertyManager::PropertyManager(const PropertyManager &other) PropertyManager &PropertyManager::operator=(const PropertyManager &other) { // We need to do a deep copy here if (this != &other) { - for (PropertyMap::iterator it = m_properties.begin(); + for (auto it = m_properties.begin(); it != m_properties.end(); ++it) { delete it->second; } @@ -403,7 +403,7 @@ bool PropertyManager::existsProperty(const std::string &name) const { */ bool PropertyManager::validateProperties() const { bool allValid = true; - for (PropertyMap::const_iterator it = m_properties.begin(); + for (auto it = m_properties.begin(); it != m_properties.end(); ++it) { // check for errors in each property std::string error = it->second->isValid(); @@ -483,7 +483,7 @@ std::string PropertyManager::asString(bool withDefaultValues) const { */ Property *PropertyManager::getPointerToProperty(const std::string &name) const { const std::string key = createKey(name); - PropertyMap::const_iterator it = m_properties.find(key); + auto it = m_properties.find(key); if (it != m_properties.end()) { return it->second; } @@ -498,7 +498,7 @@ Property *PropertyManager::getPointerToProperty(const std::string &name) const { Property * PropertyManager::getPointerToPropertyOrNull(const std::string &name) const { const std::string key = createKey(name); - PropertyMap::const_iterator it = m_properties.find(key); + auto it = m_properties.find(key); if (it != m_properties.end()) { return it->second; } @@ -577,7 +577,7 @@ void PropertyManager::removeProperty(const std::string &name, */ void PropertyManager::clear() { m_orderedProperties.clear(); - for (PropertyMap::iterator it = m_properties.begin(); + for (auto it = m_properties.begin(); it != m_properties.end(); ++it) { delete it->second; } diff --git a/Framework/Kernel/src/RemoteJobManager.cpp b/Framework/Kernel/src/RemoteJobManager.cpp index 6932db398a632855731e8b9c6d894886d351afa8..e7bedf0c1100ceb3af71c02584c4e50b5dd2d427 100644 --- a/Framework/Kernel/src/RemoteJobManager.cpp +++ b/Framework/Kernel/src/RemoteJobManager.cpp @@ -122,7 +122,7 @@ std::istream &RemoteJobManager::httpPost(const std::string &path, // Need to be able to specify the content length, so build up the post body // here. std::ostringstream postBody; - PostDataMap::const_iterator it = postData.begin(); + auto it = postData.begin(); while (it != postData.end()) { postBody << boundaryLine; postBody << "Content-Disposition: form-data; name=\"" << (*it).first diff --git a/Framework/Kernel/src/Statistics.cpp b/Framework/Kernel/src/Statistics.cpp index 33da1c7436d6e580ef35e100d4883818c440938c..70c336668a992e5e6091b466c68b787585a5e971 100644 --- a/Framework/Kernel/src/Statistics.cpp +++ b/Framework/Kernel/src/Statistics.cpp @@ -97,7 +97,7 @@ std::vector<double> getZscore(const vector<TYPE> &data) { std::vector<double> Zscore(data.size(), 0.); return Zscore; } - typename vector<TYPE>::const_iterator it = data.begin(); + auto it = data.begin(); for (; it != data.end(); ++it) { double tmp = static_cast<double>(*it); Zscore.push_back(fabs((tmp - stats.mean) / stats.standard_deviation)); @@ -120,7 +120,7 @@ std::vector<double> getModifiedZscore(const vector<TYPE> &data, double tmp; size_t num_data = data.size(); // cache since it is frequently used double median = getMedian(data, num_data, sorted); - typename vector<TYPE>::const_iterator it = data.begin(); + auto it = data.begin(); for (; it != data.end(); ++it) { tmp = static_cast<double>(*it); MADvec.push_back(fabs(tmp - median)); @@ -166,7 +166,7 @@ Statistics getStatistics(const vector<TYPE> &data, const unsigned int flags) { stats.minimum = stats.mean; stats.maximum = stats.mean; double stddev = 0.; - typename vector<TYPE>::const_iterator it = data.begin(); + auto it = data.begin(); for (; it != data.end(); ++it) { double temp = static_cast<double>(*it); stddev += ((temp - stats.mean) * (temp - stats.mean)); diff --git a/Framework/Kernel/src/Strings.cpp b/Framework/Kernel/src/Strings.cpp index 44225dc1dbceae906bef58ab08bda5b599d093aa..c07af3a7bb40972fb312e3d4e4c9dc6138a8c42c 100644 --- a/Framework/Kernel/src/Strings.cpp +++ b/Framework/Kernel/src/Strings.cpp @@ -228,7 +228,7 @@ int getPartLine(std::istream &fh, std::string &Out, std::string &Excess, const int spc) { // std::string Line; if (fh.good()) { - char *ss = new char[spc + 1]; + auto ss = new char[spc + 1]; const int clen = static_cast<int>(spc - Out.length()); fh.getline(ss, clen, '\n'); ss[clen + 1] = 0; // incase line failed to read completely @@ -284,7 +284,7 @@ std::string removeSpace(const std::string &CLine) { * @return String read. */ std::string getLine(std::istream &fh, const int spc) { - char *ss = new char[spc + 1]; + auto ss = new char[spc + 1]; std::string Line; if (fh.good()) { fh.getline(ss, spc, '\n'); @@ -772,9 +772,9 @@ int writeFile(const std::string &Fname, const V<T, A> &X, const V<T, A> &Y, FX << "# " << Npts << " " << Epts << std::endl; FX.precision(10); FX.setf(std::ios::scientific, std::ios::floatfield); - typename V<T, A>::const_iterator xPt = X.begin(); - typename V<T, A>::const_iterator yPt = Y.begin(); - typename V<T, A>::const_iterator ePt = (Epts ? Err.begin() : Y.begin()); + auto xPt = X.begin(); + auto yPt = Y.begin(); + auto ePt = (Epts ? Err.begin() : Y.begin()); // Double loop to include/exclude a short error stack size_t eCount = 0; @@ -977,8 +977,8 @@ size_t split_path(const std::string &path, // allocate target vector to keep folder structure and fill it in size_t n_folders = split_pos.size() - 1; path_components.resize(n_folders); - std::list<int64_t>::iterator it1 = split_pos.begin(); - std::list<int64_t>::iterator it2 = it1; + auto it1 = split_pos.begin(); + auto it2 = it1; ++it2; int64_t ic(0); @@ -1075,7 +1075,7 @@ std::vector<int> parseRange(const std::string &str, const std::string &elemSep, // Estimation of the resulting number of elements result.reserve(elements->count()); - for (Tokenizer::Iterator it = elements->begin(); it != elements->end(); + for (auto it = elements->begin(); it != elements->end(); it++) { // See above for the reason space is added Tokenizer rangeElements(*it + " ", rangeSep, Tokenizer::TOK_TRIM); diff --git a/Framework/Kernel/src/ThreadPool.cpp b/Framework/Kernel/src/ThreadPool.cpp index 3e486fe8a5c11fcaa8983826a5e5d260b83bf541..c9a328fde4ecb14d0de46e0a8bbda51c3fef85e8 100644 --- a/Framework/Kernel/src/ThreadPool.cpp +++ b/Framework/Kernel/src/ThreadPool.cpp @@ -95,7 +95,7 @@ void ThreadPool::start(double waitSec) { m_threads.push_back(thread); // Make the runnable object and run it - ThreadPoolRunnable *runnable = + auto runnable = new ThreadPoolRunnable(i, m_scheduler, m_prog, waitSec); m_runnables.push_back(runnable); diff --git a/Framework/Kernel/src/TimeSeriesProperty.cpp b/Framework/Kernel/src/TimeSeriesProperty.cpp index f1a10e4b434adeb6455e9f99648ed6ac8673f76f..5292185095da4314ccf27bb567f94a48f2c52b5d 100644 --- a/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -456,7 +456,7 @@ void TimeSeriesProperty<TYPE>::splitByTime( size_t i_property = 0; // And at the same time, iterate through the splitter - Kernel::TimeSplitterType::iterator itspl = splitter.begin(); + auto itspl = splitter.begin(); size_t counter = 0; g_log.debug() << "[DB] Number of time series entries = " << m_values.size() @@ -752,7 +752,7 @@ double TimeSeriesProperty<TYPE>::averageValueInFilter( double numerator(0.0), totalTime(0.0); // Loop through the filter ranges - for (TimeSplitterType::const_iterator it = filter.begin(); it != filter.end(); + for (auto it = filter.begin(); it != filter.end(); ++it) { // Calculate the total time duration (in seconds) within by the filter totalTime += it->duration(); diff --git a/Framework/Kernel/src/TimeSplitter.cpp b/Framework/Kernel/src/TimeSplitter.cpp index c4beaf928def18188517f3d7cffb21daa278eae4..88dd6298392e49f7ec604dd9d931cd0dd57e91e9 100644 --- a/Framework/Kernel/src/TimeSplitter.cpp +++ b/Framework/Kernel/src/TimeSplitter.cpp @@ -174,7 +174,7 @@ TimeSplitterType removeFilterOverlap(const TimeSplitterType &a) { TimeSplitterType out; // Now we have to merge duplicate/overlapping intervals together - TimeSplitterType::const_iterator it = a.begin(); + auto it = a.begin(); while (it != a.end()) { // All following intervals will start at or after this one DateAndTime start = it->start(); diff --git a/Framework/Kernel/src/Unit.cpp b/Framework/Kernel/src/Unit.cpp index acbf825934e2399a6bbf6efcc89b401c78df1f0a..a0bce89c96584e93a1df7f831bc4a495814ca338 100644 --- a/Framework/Kernel/src/Unit.cpp +++ b/Framework/Kernel/src/Unit.cpp @@ -100,7 +100,7 @@ bool Unit::quickConversion(std::string destUnitName, double &factor, // See if there's a conversion listed for the requested destination unit std::transform(destUnitName.begin(), destUnitName.end(), destUnitName.begin(), toupper); - UnitConversions::const_iterator iter = it->second.find(destUnitName); + auto iter = it->second.find(destUnitName); // If not, return false if (iter == it->second.end()) return false; diff --git a/Framework/Kernel/src/VectorHelper.cpp b/Framework/Kernel/src/VectorHelper.cpp index 8764accf4f6cab5eefa4949cb3e9d311c35507aa..656bb73c7847d1d59a0d4bd8dbae750fdd4ddf13 100644 --- a/Framework/Kernel/src/VectorHelper.cpp +++ b/Framework/Kernel/src/VectorHelper.cpp @@ -262,7 +262,7 @@ void rebinHistogram(const std::vector<double> &xold, size_t iold = 0, inew = 0; // iold/inew is the bin number under consideration // (counting from 1, so index+1) if (xnew.front() > xold.front()) { - std::vector<double>::const_iterator it = + auto it = std::upper_bound(xold.begin(), xold.end(), xnew.front()); if (it == xold.end()) return; @@ -270,7 +270,7 @@ void rebinHistogram(const std::vector<double> &xold, iold = std::distance(xold.begin(), it) - 1; // Old bin to start at (counting from 0) } else { - std::vector<double>::const_iterator it = + auto it = std::upper_bound(xnew.begin(), xnew.end(), xold.front()); if (it == xnew.end()) return; @@ -410,7 +410,7 @@ void convertToBinBoundary(const std::vector<double> &bin_centers, */ bool isConstantValue(const std::vector<double> &arra) { // make comparisons with the first value - std::vector<double>::const_iterator i = arra.begin(); + auto i = arra.begin(); if (i == arra.end()) { // empty array return true; @@ -453,7 +453,7 @@ std::vector<NumT> splitStringIntoVector(std::string listString) { split_vector_type strs; boost::split(strs, listString, boost::is_any_of(", ")); - for (std::vector<std::string>::iterator it = strs.begin(); it != strs.end(); + for (auto it = strs.begin(); it != strs.end(); ++it) { if (!it->empty()) { // String not empty diff --git a/Framework/LiveData/src/ADARA/ADARAParser.cpp b/Framework/LiveData/src/ADARA/ADARAParser.cpp index 1fe48e4b00b4755d3c0e3a73e5c25c8caf289e86..585a442ec21f64686b22d26eb78a35d84a3a0ad6 100644 --- a/Framework/LiveData/src/ADARA/ADARAParser.cpp +++ b/Framework/LiveData/src/ADARA/ADARAParser.cpp @@ -297,7 +297,7 @@ void Parser::getDiscardedPacketsLogString(std::string &log_info) { uint64_t total_discarded = 0; // Append Each Discarded Packet Type Count... - for (std::map<PacketType::Enum, uint64_t>::iterator it = + for (auto it = m_discarded_packets.begin(); it != m_discarded_packets.end(); ++it) { std::stringstream ss; diff --git a/Framework/LiveData/src/SNSLiveEventDataListener.cpp b/Framework/LiveData/src/SNSLiveEventDataListener.cpp index 0c662636b1896a1f9f2897b2281eef32c8ac2172..4ea7b4d1f5ad9beee314f709414dc686c9d6974e 100644 --- a/Framework/LiveData/src/SNSLiveEventDataListener.cpp +++ b/Framework/LiveData/src/SNSLiveEventDataListener.cpp @@ -1336,7 +1336,7 @@ void SNSLiveEventDataListener::appendEvent( { // It'd be nice to use operator[], but we might end up inserting a value.... // Have to use find() instead. - detid2index_map::iterator it = m_indexMap.find(pixelId); + auto it = m_indexMap.find(pixelId); if (it != m_indexMap.end()) { std::size_t workspaceIndex = it->second; Mantid::DataObjects::TofEvent event(tof, pulseTime); diff --git a/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp b/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp index 819d3455cd510365c4e8e4ef3d56b8cd1ed2dea8..b58b8ffae1159278da7293635d9bc0e0b9e7ab09 100644 --- a/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp +++ b/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp @@ -535,7 +535,7 @@ void TOPAZLiveEventDataListener::appendEvent( { // It'd be nice to use operator[], but we might end up inserting a value.... // Have to use find() instead. - detid2index_map::iterator it = m_indexMap.find(pixelId); + auto it = m_indexMap.find(pixelId); if (it != m_indexMap.end()) { std::size_t workspaceIndex = it->second; Mantid::DataObjects::TofEvent event(tof, pulseTime); diff --git a/Framework/MDAlgorithms/src/BinMD.cpp b/Framework/MDAlgorithms/src/BinMD.cpp index f914d8e5b0c3d939ef2a99dc1803fbf3ad8a9fac..2e6b82e1a4a841ec46cf03e6f34fddc8c7e2957b 100644 --- a/Framework/MDAlgorithms/src/BinMD.cpp +++ b/Framework/MDAlgorithms/src/BinMD.cpp @@ -98,7 +98,7 @@ template <typename MDE, size_t nd> inline void BinMD::binMDBox(MDBox<MDE, nd> *box, const size_t *const chunkMin, const size_t *const chunkMax) { // An array to hold the rotated/transformed coordinates - coord_t *outCenter = new coord_t[m_outD]; + auto outCenter = new coord_t[m_outD]; // Evaluate whether the entire box is in the same bin if (box->getNPoints() > (1 << nd) * 2) { @@ -181,8 +181,8 @@ inline void BinMD::binMDBox(MDBox<MDE, nd> *box, const size_t *const chunkMin, // So you need to iterate through events. const std::vector<MDE> &events = box->getConstEvents(); - typename std::vector<MDE>::const_iterator it = events.begin(); - typename std::vector<MDE>::const_iterator it_end = events.end(); + auto it = events.begin(); + auto it_end = events.end(); for (; it != it_end; it++) { // Cache the center of the event (again for speed) const coord_t *inCenter = it->getCenter(); diff --git a/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp b/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp index 9f2fd500fc25f28eb9062662bbced9473e1127d9..8fe24a9e938278b945a1b993cc69bbd7e03a7e8f 100644 --- a/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp +++ b/Framework/MDAlgorithms/src/BoxControllerSettingsAlgorithm.cpp @@ -41,7 +41,7 @@ void BoxControllerSettingsAlgorithm::initBoxControllerProps( tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM); value.clear(); value.reserve(values.count()); - for (tokenizer::Iterator it = values.begin(); it != values.end(); ++it) + for (auto it = values.begin(); it != values.end(); ++it) value.push_back(boost::lexical_cast<int>(*it)); declareProperty( diff --git a/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp b/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp index 2946e000f5d7b527200b11cc870855f4b0ed4551..cffc67edd826aa9b8523cca745db8bb0b026a77f 100644 --- a/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp +++ b/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp @@ -47,8 +47,8 @@ size_t ConvToMDEventsWS::convertEventList(size_t workspaceIndex) { const typename std::vector<T> &events = *events_ptr; // Iterators to start/end - typename std::vector<T>::const_iterator it = events.begin(); - typename std::vector<T>::const_iterator it_end = events.end(); + auto it = events.begin(); + auto it_end = events.end(); it = events.begin(); for (; it != it_end; it++) { diff --git a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp index f2961f98ae6e8e8f4028cdcdbe3056273ba5e03e..0d3d63e4ec0ab3cbeeda2047ca71ba5565f615d3 100644 --- a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp @@ -346,7 +346,7 @@ void ConvertCWPDMDToSpectra::findXBoundary( // Get run number int runnumber = dataws->getExperimentInfo(irun)->getRunNumber(); g_log.debug() << "Run " << runnumber << ": "; - std::map<int, double>::const_iterator miter = + auto miter = map_runwavelength.find(runnumber); double wavelength = -1; if (miter != map_runwavelength.end()) { @@ -504,7 +504,7 @@ void ConvertCWPDMDToSpectra::binMD(API::IMDEventWorkspace_const_sptr mdws, else { if (temprun != currRunIndex) { // use map to find a new wavelength - std::map<int, double>::const_iterator miter = + auto miter = map_runlambda.find(temprun); if (miter == map_runlambda.end()) { std::stringstream errss; @@ -538,7 +538,7 @@ void ConvertCWPDMDToSpectra::binMD(API::IMDEventWorkspace_const_sptr mdws, xindex = static_cast<int>(vecy.size()) - 1; } else { // Other situation - std::vector<double>::const_iterator vfiter = + auto vfiter = std::lower_bound(vecx.begin(), vecx.end(), outx); xindex = static_cast<int>(vfiter - vecx.begin()); if ((xindex < static_cast<int>(vecx.size())) && diff --git a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp index d22a4ffcbfcf4693b2bd84dc522c4909d61a1218..4e3ce917410e4c32d333453886c6c29beecf5e8d 100644 --- a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp +++ b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp @@ -535,7 +535,7 @@ void ConvertSpiceDataToRealSpace::appendSampleLogs( } // Create a new log - TimeSeriesProperty<double> *templog = + auto templog = new TimeSeriesProperty<double>(logname); templog->addValues(vectimes, veclogval); diff --git a/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp b/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp index 3ffdd16bbc28c2db18b8f58446503298ec17ff77..045541cc996093242e9052fa213df2109e7e4b3d 100644 --- a/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp @@ -99,8 +99,8 @@ void ConvertToDetectorFaceMD::convertEventList( typename std::vector<T> &events = *events_ptr; // Iterators to start/end - typename std::vector<T>::iterator it = events.begin(); - typename std::vector<T>::iterator it_end = events.end(); + auto it = events.begin(); + auto it_end = events.end(); for (; it != it_end; it++) { coord_t tof = static_cast<coord_t>(it->tof()); diff --git a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp index 4f6bf32e23452dd2ec1d8b6ba2a0ed9ec04cddb4..2c839eee383f057731af43d98907f94097c2fe8b 100644 --- a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp @@ -261,8 +261,8 @@ void ConvertToDiffractionMDWorkspace::convertEventList(int workspaceIndex, typename std::vector<T> &events = *events_ptr; // Iterators to start/end - typename std::vector<T>::iterator it = events.begin(); - typename std::vector<T>::iterator it_end = events.end(); + auto it = events.begin(); + auto it_end = events.end(); for (; it != it_end; it++) { // Get the wavenumber in ang^-1 using the previously calculated constant. diff --git a/Framework/MDAlgorithms/src/DivideMD.cpp b/Framework/MDAlgorithms/src/DivideMD.cpp index 7174d81d5f25736b46c1103d1e2c4e7dbf466982..23c762fcd57067b0889ac3b13bcdad8c95b44d36 100644 --- a/Framework/MDAlgorithms/src/DivideMD.cpp +++ b/Framework/MDAlgorithms/src/DivideMD.cpp @@ -78,8 +78,8 @@ void DivideMD::execEventScalar(typename MDEventWorkspace<MDE, nd>::sptr ws) { if (box) { size_t ic(0); typename std::vector<MDE> &events = box->getEvents(); - typename std::vector<MDE>::iterator it = events.begin(); - typename std::vector<MDE>::iterator it_end = events.end(); + auto it = events.begin(); + auto it_end = events.end(); for (; it != it_end; it++) { // Multiply weight by a scalar, propagating error float oldSignal = it->getSignal(); diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp index ba70dd4bedd2239fcf40c699cdac43d92045abe3..de10c5dfc3cdd4719b40cac74e6412e886d8dc74 100644 --- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -328,7 +328,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { // Now we go (backwards) through the map // e.g. from highest density down to lowest density. typename std::multimap<double, boxPtr>::reverse_iterator it2; - typename std::multimap<double, boxPtr>::reverse_iterator it2_end = + auto it2_end = sortedBoxes.rend(); for (it2 = sortedBoxes.rbegin(); it2 != it2_end; it2++) { signal_t density = it2->first; @@ -342,7 +342,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { // Compare to all boxes already picked. bool badBox = false; - for (typename std::vector<boxPtr>::iterator it3 = peakBoxes.begin(); + for (auto it3 = peakBoxes.begin(); it3 != peakBoxes.end(); it3++) { #ifndef MDBOX_TRACK_CENTROID @@ -388,7 +388,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { prog->resetNumSteps(numBoxesFound, 0.95, 1.0); // --- Convert the "boxes" to peaks ---- - for (typename std::vector<boxPtr>::iterator it3 = peakBoxes.begin(); + for (auto it3 = peakBoxes.begin(); it3 != peakBoxes.end(); it3++) { // The center of the box = Q in the lab frame boxPtr box = *it3; @@ -509,7 +509,7 @@ void FindPeaksMD::findPeaksHisto( // Now we go (backwards) through the map // e.g. from highest density down to lowest density. std::multimap<double, size_t>::reverse_iterator it2; - std::multimap<double, size_t>::reverse_iterator it2_end = + auto it2_end = sortedBoxes.rend(); for (it2 = sortedBoxes.rbegin(); it2 != it2_end; ++it2) { signal_t density = it2->first; @@ -519,7 +519,7 @@ void FindPeaksMD::findPeaksHisto( // Compare to all boxes already picked. bool badBox = false; - for (std::vector<size_t>::iterator it3 = peakBoxes.begin(); + for (auto it3 = peakBoxes.begin(); it3 != peakBoxes.end(); ++it3) { VMD otherCenter = ws->getCenter(*it3); @@ -554,7 +554,7 @@ void FindPeaksMD::findPeaksHisto( } } // --- Convert the "boxes" to peaks ---- - for (std::vector<size_t>::iterator it3 = peakBoxes.begin(); + for (auto it3 = peakBoxes.begin(); it3 != peakBoxes.end(); ++it3) { size_t index = *it3; // The center of the box = Q in the lab frame diff --git a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp index 7c0bd18db53bbf0dce03dde8fd69866cab553fac..8f4e328118a8100e3b2e304917e83cd4ef0efa07 100644 --- a/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ImportMDEventWorkspace.cpp @@ -122,7 +122,7 @@ void ImportMDEventWorkspace::addEventsData( typename MDEventWorkspace<MDE, nd>::sptr ws) { /// Creates a new instance of the MDEventInserter. MDEventInserter<typename MDEventWorkspace<MDE, nd>::sptr> inserter(ws); - DataCollectionType::iterator mdEventEntriesIterator = m_posMDEventStart; + auto mdEventEntriesIterator = m_posMDEventStart; std::vector<Mantid::coord_t> centers(nd); for (size_t i = 0; i < m_nDataObjects; ++i) { float signal = convert<float>(*(++mdEventEntriesIterator)); @@ -165,9 +165,9 @@ void ImportMDEventWorkspace::quickFileCheck() { throw std::invalid_argument(message); } // Are the mandatory block in the correct order. - DataCollectionType::iterator posDimStart = + auto posDimStart = std::find(m_file_data.begin(), m_file_data.end(), DimensionBlockFlag()); - DataCollectionType::iterator posMDEventStart = + auto posMDEventStart = std::find(m_file_data.begin(), m_file_data.end(), MDEventBlockFlag()); int posDiffDims = static_cast<int>(std::distance(posDimStart, posMDEventStart)); @@ -184,7 +184,7 @@ void ImportMDEventWorkspace::quickFileCheck() { } const size_t nDimensions = (posDiffDims - 1) / 4; // Are the dimension entries all of the correct type. - DataCollectionType::iterator dimEntriesIterator = posDimStart; + auto dimEntriesIterator = posDimStart; for (size_t i = 0; i < nDimensions; ++i) { convert<std::string>(*(++dimEntriesIterator)); convert<std::string>(*(++dimEntriesIterator)); @@ -278,7 +278,7 @@ void ImportMDEventWorkspace::exec() { // Get the min and max extents in each dimension. std::vector<double> extentMins(m_nDimensions); std::vector<double> extentMaxs(m_nDimensions); - DataCollectionType::iterator mdEventEntriesIterator = m_posMDEventStart; + auto mdEventEntriesIterator = m_posMDEventStart; for (size_t i = 0; i < m_nDataObjects; ++i) { mdEventEntriesIterator += 2; if (m_IsFullDataObjects) { @@ -296,7 +296,7 @@ void ImportMDEventWorkspace::exec() { m_nDimensions, m_IsFullDataObjects ? "MDEvent" : "MDLeanEvent"); // Extract Dimensions and add to the output workspace. - DataCollectionType::iterator dimEntriesIterator = m_posDimStart; + auto dimEntriesIterator = m_posDimStart; auto unitFactory = makeMDUnitFactoryChain(); for (size_t i = 0; i < m_nDimensions; ++i) { std::string id = convert<std::string>(*(++dimEntriesIterator)); diff --git a/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp index acc17b1befc756ab028defd5f402deb66851dc0f..5a870b4e8c6e613d9001b2eb8b591f95fba43e87 100644 --- a/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ImportMDHistoWorkspace.cpp @@ -104,9 +104,9 @@ void ImportMDHistoWorkspace::exec() { // Write to the signal and error array from the deque. size_t currentBox = 0; - for (box_collection::iterator it = box_elements.begin(); + for (auto it = box_elements.begin(); it != box_elements.end(); it += 2) { - box_collection::iterator temp = it; + auto temp = it; double signal = atof((*(temp)).c_str()); double error = atof((*(++temp)).c_str()); signals[currentBox] = signal; diff --git a/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp b/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp index d41e949de2e65d5c62bf1f35d8df83150e03b843..ea4fe2b931169b813bea9c12beeabe53607b0c5c 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp @@ -219,9 +219,9 @@ void IntegratePeaksMD::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) { "Workspace2D", histogramNumber, numSteps, numSteps); wsDiff2D = boost::dynamic_pointer_cast<Workspace2D>(wsDiff); AnalysisDataService::Instance().addOrReplace("ProfilesFitDiff", wsDiff2D); - TextAxis *const newAxis1 = new TextAxis(peakWS->getNumberPeaks()); - TextAxis *const newAxis2 = new TextAxis(peakWS->getNumberPeaks()); - TextAxis *const newAxis3 = new TextAxis(peakWS->getNumberPeaks()); + auto const newAxis1 = new TextAxis(peakWS->getNumberPeaks()); + auto const newAxis2 = new TextAxis(peakWS->getNumberPeaks()); + auto const newAxis3 = new TextAxis(peakWS->getNumberPeaks()); wsProfile2D->replaceAxis(1, newAxis1); wsFit2D->replaceAxis(1, newAxis2); wsDiff2D->replaceAxis(1, newAxis3); diff --git a/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index bb4289bee23b665d4d0ce41e4d1b11ca8367c81f..e1f350b33d398f7d3a852930a9b3bcdebea4ca87 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -225,9 +225,9 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) { "Workspace2D", histogramNumber, numSteps, numSteps); wsDiff2D = boost::dynamic_pointer_cast<Workspace2D>(wsDiff); AnalysisDataService::Instance().addOrReplace("ProfilesFitDiff", wsDiff2D); - TextAxis *const newAxis1 = new TextAxis(peakWS->getNumberPeaks()); - TextAxis *const newAxis2 = new TextAxis(peakWS->getNumberPeaks()); - TextAxis *const newAxis3 = new TextAxis(peakWS->getNumberPeaks()); + auto const newAxis1 = new TextAxis(peakWS->getNumberPeaks()); + auto const newAxis2 = new TextAxis(peakWS->getNumberPeaks()); + auto const newAxis3 = new TextAxis(peakWS->getNumberPeaks()); wsProfile2D->replaceAxis(1, newAxis1); wsFit2D->replaceAxis(1, newAxis2); wsDiff2D->replaceAxis(1, newAxis3); diff --git a/Framework/MDAlgorithms/src/LoadMD.cpp b/Framework/MDAlgorithms/src/LoadMD.cpp index 47e35bf338cd6e21467e61e9b4a19785126f8761..89c360a58fc4b9a523afd1eeb0208e4f5e4d39ba 100644 --- a/Framework/MDAlgorithms/src/LoadMD.cpp +++ b/Framework/MDAlgorithms/src/LoadMD.cpp @@ -442,7 +442,7 @@ void LoadMD::doLoad(typename MDEventWorkspace<MDE, nd>::sptr ws) { ": this is not possible."); CPUTimer tim; - Progress *prog = new Progress(this, 0.0, 1.0, 100); + auto prog = new Progress(this, 0.0, 1.0, 100); prog->report("Opening file."); std::string title; @@ -608,7 +608,7 @@ CoordTransform *LoadMD::loadAffineMatrix(std::string entry_name) { Matrix<coord_t> mat(vec); CoordTransform *transform = NULL; if (("CoordTransformAffine" == type) || ("CoordTransformAligned" == type)) { - CoordTransformAffine *affine = new CoordTransformAffine(inD, outD); + auto affine = new CoordTransformAffine(inD, outD); affine->setMatrix(mat); transform = affine; } else { diff --git a/Framework/MDAlgorithms/src/LoadSQW.cpp b/Framework/MDAlgorithms/src/LoadSQW.cpp index 04bc0d1d72f7de3de7b8704fb53b88dcc8528f9a..e0beda7bcb671c9e9af7b54ef84ca0e0e5174b94 100644 --- a/Framework/MDAlgorithms/src/LoadSQW.cpp +++ b/Framework/MDAlgorithms/src/LoadSQW.cpp @@ -105,7 +105,7 @@ void LoadSQW::exec() { parseMetadata(m_fileName); // Create a new output workspace. - MDEventWorkspace<MDEvent<4>, 4> *pWs = new MDEventWorkspace<MDEvent<4>, 4>; + auto pWs = new MDEventWorkspace<MDEvent<4>, 4>; Mantid::API::IMDEventWorkspace_sptr ws(pWs); // Add dimensions onto workspace. diff --git a/Framework/MDAlgorithms/src/MergeMD.cpp b/Framework/MDAlgorithms/src/MergeMD.cpp index 02eece157d4a05a07022c8eca5349f65235d2616..5965871db3af61c45055b4aabcdbaa51e02b12de 100644 --- a/Framework/MDAlgorithms/src/MergeMD.cpp +++ b/Framework/MDAlgorithms/src/MergeMD.cpp @@ -67,7 +67,7 @@ void MergeMD::init() { * @param inputs :: list of names of input MDWorkspaces */ void MergeMD::createOutputWorkspace(std::vector<std::string> &inputs) { - std::vector<std::string>::iterator it = inputs.begin(); + auto it = inputs.begin(); for (; it != inputs.end(); it++) { IMDEventWorkspace_sptr ws = boost::dynamic_pointer_cast<IMDEventWorkspace>( AnalysisDataService::Instance().retrieve(*it)); diff --git a/Framework/MDAlgorithms/src/MergeMDFiles.cpp b/Framework/MDAlgorithms/src/MergeMDFiles.cpp index e75ca0941b94ca06120a1ee8c3014d64dabb29eb..052b710d6aac8926929fa4a23ca54e3f739439a6 100644 --- a/Framework/MDAlgorithms/src/MergeMDFiles.cpp +++ b/Framework/MDAlgorithms/src/MergeMDFiles.cpp @@ -239,7 +239,7 @@ void MergeMDFiles::doExecByCloning(Mantid::API::IMDEventWorkspace_sptr ws, // Prepare thread pool CPUTimer overallTime; - ThreadSchedulerFIFO *ts = new ThreadSchedulerFIFO(); + auto ts = new ThreadSchedulerFIFO(); ThreadPool tp(ts); Kernel::DiskBuffer *DiskBuf(NULL); diff --git a/Framework/MDAlgorithms/src/MinusMD.cpp b/Framework/MDAlgorithms/src/MinusMD.cpp index db96f50294c828e1e1e34d183b986f4141744980..d2f71147314990e0e71d366b1069b4ba1d97c7ee 100644 --- a/Framework/MDAlgorithms/src/MinusMD.cpp +++ b/Framework/MDAlgorithms/src/MinusMD.cpp @@ -101,7 +101,7 @@ void MinusMD::doMinus(typename MDEventWorkspace<MDE, nd>::sptr ws) { } while (it2.next()); this->progress(0.41, "Splitting Boxes"); - Progress *prog2 = new Progress(this, 0.4, 0.9, 100); + auto prog2 = new Progress(this, 0.4, 0.9, 100); ThreadScheduler *ts = new ThreadSchedulerFIFO(); ThreadPool tp(ts, 0, prog2); ws1->splitAllIfNeeded(ts); diff --git a/Framework/MDAlgorithms/src/MultiplyMD.cpp b/Framework/MDAlgorithms/src/MultiplyMD.cpp index 2873d6a079793ec1487fafb9cad836abc1bb6b56..c9352192194e4a1b8d52a1e4f07de47a4c152438 100644 --- a/Framework/MDAlgorithms/src/MultiplyMD.cpp +++ b/Framework/MDAlgorithms/src/MultiplyMD.cpp @@ -79,8 +79,8 @@ void MultiplyMD::execEventScalar(typename MDEventWorkspace<MDE, nd>::sptr ws) { if (box) { typename std::vector<MDE> &events = box->getEvents(); size_t ic(events.size()); - typename std::vector<MDE>::iterator it = events.begin(); - typename std::vector<MDE>::iterator it_end = events.end(); + auto it = events.begin(); + auto it_end = events.end(); for (; it != it_end; it++) { // Multiply weight by a scalar, propagating error float oldSignal = it->getSignal(); diff --git a/Framework/MDAlgorithms/src/PlusMD.cpp b/Framework/MDAlgorithms/src/PlusMD.cpp index 8d71dda9da34dbe2cd6d44e10091567961882ae5..1e91e4530b45faf979b94287dcecba9ef098f1ed 100644 --- a/Framework/MDAlgorithms/src/PlusMD.cpp +++ b/Framework/MDAlgorithms/src/PlusMD.cpp @@ -69,7 +69,7 @@ void PlusMD::doPlus(typename MDEventWorkspace<MDE, nd>::sptr ws) { } while (it2.next()); this->progress(0.41, "Splitting Boxes"); - Progress *prog2 = new Progress(this, 0.4, 0.9, 100); + auto prog2 = new Progress(this, 0.4, 0.9, 100); ThreadScheduler *ts = new ThreadSchedulerFIFO(); ThreadPool tp(ts, 0, prog2); ws1->splitAllIfNeeded(ts); diff --git a/Framework/MDAlgorithms/src/SaveMD.cpp b/Framework/MDAlgorithms/src/SaveMD.cpp index 18c6cd62bf20adbd2555aaf8e13e5032c4853a49..077faf57bbfd1d007245e6bacc53682d24e00441 100644 --- a/Framework/MDAlgorithms/src/SaveMD.cpp +++ b/Framework/MDAlgorithms/src/SaveMD.cpp @@ -111,7 +111,7 @@ void SaveMD::doSaveEvents(typename MDEventWorkspace<MDE, nd>::sptr ws) { oldFile.remove(); } - Progress *prog = new Progress(this, 0.0, 0.05, 1); + auto prog = new Progress(this, 0.0, 0.05, 1); if (update) // workspace has its own file and ignores any changes to the // algorithm parameters { diff --git a/Framework/MDAlgorithms/src/SaveZODS.cpp b/Framework/MDAlgorithms/src/SaveZODS.cpp index 2570bfae893af1275d85de94cb2faa5897a438eb..1dab2ec8fbe9a4e306297c60bdcebd88ab26797e 100644 --- a/Framework/MDAlgorithms/src/SaveZODS.cpp +++ b/Framework/MDAlgorithms/src/SaveZODS.cpp @@ -75,7 +75,7 @@ void SaveZODS::exec() { << std::endl; // Create a HDF5 file - ::NeXus::File *file = new ::NeXus::File(Filename, NXACC_CREATE5); + auto file = new ::NeXus::File(Filename, NXACC_CREATE5); // ----------- Coordinate system ----------- uint32_t isLocal = 1; diff --git a/Framework/MDAlgorithms/src/SliceMD.cpp b/Framework/MDAlgorithms/src/SliceMD.cpp index b6200070dfe846a498b01638de1870fedfa55274..948bb94aafd322acc23707050e2ac751d9dd3255 100644 --- a/Framework/MDAlgorithms/src/SliceMD.cpp +++ b/Framework/MDAlgorithms/src/SliceMD.cpp @@ -197,7 +197,7 @@ void SliceMD::slice(typename MDEventWorkspace<MDE, nd>::sptr ws) { if (fileBackedWS) API::IMDNode::sortObjByID(boxes); - Progress *prog = new Progress(this, 0.0, 1.0, boxes.size()); + auto prog = new Progress(this, 0.0, 1.0, boxes.size()); // The root of the output workspace MDBoxBase<OMDE, ond> *outRootBox = outWS->getBox(); @@ -217,8 +217,8 @@ void SliceMD::slice(typename MDEventWorkspace<MDE, nd>::sptr ws) { const std::vector<MDE> &events = box->getConstEvents(); - typename std::vector<MDE>::const_iterator it = events.begin(); - typename std::vector<MDE>::const_iterator it_end = events.end(); + auto it = events.begin(); + auto it_end = events.end(); for (; it != it_end; it++) { // Cache the center of the event (again for speed) const coord_t *inCenter = it->getCenter(); diff --git a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp index 828bcc13d2e68e5f25d1fe55f39bff453abe58a0..ba755c06aed76e2e8acaf1462dafe7a1e7241fc9 100644 --- a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp +++ b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp @@ -393,7 +393,7 @@ void SlicingAlgorithm::createGeneralTransform() { // std::cout << m_inputMinPoint << " m_inputMinPoint " << std::endl; // Create the CoordTransformAffine for BINNING with these basis vectors - DataObjects::CoordTransformAffine *ct = + auto ct = new DataObjects::CoordTransformAffine(inD, m_outD); // Note: the scaling makes the coordinate correspond to a bin index // ct->buildOrthogonal(m_inputMinPoint, this->m_bases, @@ -403,7 +403,7 @@ void SlicingAlgorithm::createGeneralTransform() { this->m_transform = ct; // Transformation original->binned - DataObjects::CoordTransformAffine *ctFrom = + auto ctFrom = new DataObjects::CoordTransformAffine(inD, m_outD); // ctFrom->buildOrthogonal(m_translation, this->m_bases, // VMD(m_transformScaling)); @@ -427,7 +427,7 @@ void SlicingAlgorithm::createGeneralTransform() { m_transformToOriginal = NULL; if (m_outD == inD) { // Can't reverse transform if you lost dimensions. - DataObjects::CoordTransformAffine *ctTo = + auto ctTo = new DataObjects::CoordTransformAffine(inD, m_outD); Matrix<coord_t> fromMatrix = ctFrom->getMatrix(); Matrix<coord_t> toMatrix = fromMatrix; @@ -596,7 +596,7 @@ void SlicingAlgorithm::createAlignedTransform() { // dimension index is that? Matrix<coord_t> mat = m_transformFromOriginal->makeAffineMatrix(); mat.Invert(); - DataObjects::CoordTransformAffine *tmp = + auto tmp = new DataObjects::CoordTransformAffine(inD, m_outD); tmp->setMatrix(mat); m_transformToOriginal = tmp; @@ -809,7 +809,7 @@ SlicingAlgorithm::getGeneralImplicitFunction(const size_t *const chunkMin, size_t nd = m_inWS->getNumDims(); // General implicit function - MDImplicitFunction *func = new MDImplicitFunction; + auto func = new MDImplicitFunction; // First origin = min of each basis vector VMD o1 = m_translation; @@ -997,7 +997,7 @@ SlicingAlgorithm::getImplicitFunctionForChunk(const size_t *const chunkMin, function_max[d] = m_binDimensions[bd]->getX(m_binDimensions[bd]->getNBins()); } - MDBoxImplicitFunction *function = + auto function = new MDBoxImplicitFunction(function_min, function_max); return function; } else { diff --git a/Framework/MDAlgorithms/src/UserFunctionMD.cpp b/Framework/MDAlgorithms/src/UserFunctionMD.cpp index 85c8cef79f22c666a5214e64969e1c693801f6e6..adb9d3d389fd577b3515c4aec3f2b8996e16d7b0 100644 --- a/Framework/MDAlgorithms/src/UserFunctionMD.cpp +++ b/Framework/MDAlgorithms/src/UserFunctionMD.cpp @@ -106,7 +106,7 @@ double UserFunctionMD::functionMD(const API::IMDIterator &r) const { double *UserFunctionMD::AddVariable(const char *varName, void *pufun) { UserFunctionMD &fun = *reinterpret_cast<UserFunctionMD *>(pufun); - std::vector<std::string>::iterator x = + auto x = std::find(fun.m_varNames.begin(), fun.m_varNames.end(), varName); if (x != fun.m_varNames.end()) { // std::vector<std::string>::difference_type i = diff --git a/Framework/Nexus/src/NexusClasses.cpp b/Framework/Nexus/src/NexusClasses.cpp index 15cb5abfa4f386753cc17d4417f4c2c8e47b6cff..a0e7011fc25f1fc475e611f995d83856d7be5eca 100644 --- a/Framework/Nexus/src/NexusClasses.cpp +++ b/Framework/Nexus/src/NexusClasses.cpp @@ -8,7 +8,7 @@ namespace NeXus { std::vector<std::string> NXAttributes::names() const { std::vector<std::string> out; - std::map<std::string, std::string>::const_iterator it = m_values.begin(); + auto it = m_values.begin(); for (; it != m_values.end(); ++it) out.push_back(it->first); return out; @@ -16,7 +16,7 @@ std::vector<std::string> NXAttributes::names() const { std::vector<std::string> NXAttributes::values() const { std::vector<std::string> out; - std::map<std::string, std::string>::const_iterator it = m_values.begin(); + auto it = m_values.begin(); for (; it != m_values.end(); ++it) out.push_back(it->second); return out; @@ -28,7 +28,7 @@ std::vector<std::string> NXAttributes::values() const { * otherwise */ std::string NXAttributes::operator()(const std::string &name) const { - std::map<std::string, std::string>::const_iterator it = m_values.find(name); + auto it = m_values.find(name); if (it == m_values.end()) return ""; return it->second; @@ -319,7 +319,7 @@ std::vector<std::string> &NXNote::data() { NXopendata(m_fileID, "data"); NXgetinfo(m_fileID, &rank, dims, &type); int n = dims[0]; - char *buffer = new char[n]; + auto buffer = new char[n]; NXstatus stat = NXgetdata(m_fileID, buffer); NXclosedata(m_fileID); m_data.clear(); diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp index 72ee5808ca9d5075db2c50500861f3957367ae91..06e0be120337e6b6ad90a2e3ae5a6319954789f9 100644 --- a/Framework/Nexus/src/NexusFileIO.cpp +++ b/Framework/Nexus/src/NexusFileIO.cpp @@ -105,7 +105,7 @@ void NexusFileIO::openNexusWrite(const std::string &fileName, g_log.error("Unable to open file " + fileName); throw Exception::FileError("Unable to open File:", fileName); } - ::NeXus::File *file = new ::NeXus::File(fileID, true); + auto file = new ::NeXus::File(fileID, true); // clang-format off m_filehandle = boost::shared_ptr< ::NeXus::File>(file); // clang-format on @@ -231,7 +231,7 @@ bool NexusFileIO::writeNxStringArray( NXputattr(fileID, attributes[it].c_str(), reinterpret_cast<void *>(const_cast<char *>(avalues[it].c_str())), static_cast<int>(avalues[it].size() + 1), NX_CHAR); - char *strs = new char[values.size() * maxlen]; + auto strs = new char[values.size() * maxlen]; for (size_t i = 0; i < values.size(); i++) { strncpy(&strs[i * maxlen], values[i].c_str(), maxlen); } @@ -541,7 +541,7 @@ void NexusFileIO::writeTableColumn(int type, const std::string &interpret_as, const int nRows = static_cast<int>(col.size()); int dims_array[1] = {nRows}; - NexusT *toNexus = new NexusT[nRows]; + auto toNexus = new NexusT[nRows]; for (int ii = 0; ii < nRows; ii++) toNexus[ii] = static_cast<NexusT>(col.cell<ColumnT>(ii)); NXwritedata(columnName.c_str(), type, 1, dims_array, (void *)(toNexus), @@ -698,7 +698,7 @@ int NexusFileIO::writeNexusTableWorkspace( NXcompmakedata(fileID, str.c_str(), NX_CHAR, 2, dims_array, false, asize); NXopendata(fileID, str.c_str()); - char *toNexus = new char[maxStr * nRows]; + auto toNexus = new char[maxStr * nRows]; for (int ii = 0; ii < nRows; ii++) { std::string rowStr = col->cell<std::string>(ii); for (size_t ic = 0; ic < rowStr.size(); ic++) @@ -859,10 +859,10 @@ void NexusFileIO::writeEventListData(std::vector<T> events, bool writeTOF, return; size_t num = events.size(); - double *tofs = new double[num]; - double *weights = new double[num]; - double *errorSquareds = new double[num]; - int64_t *pulsetimes = new int64_t[num]; + auto tofs = new double[num]; + auto weights = new double[num]; + auto errorSquareds = new double[num]; + auto pulsetimes = new int64_t[num]; typename std::vector<T>::const_iterator it; typename std::vector<T>::const_iterator it_end = events.end(); @@ -1199,7 +1199,7 @@ bool NexusFileIO::writeNexusBinMasking( const API::MatrixWorkspace::MaskList &mList = ws->maskedBins(i); spectra.push_back(spectra_count); spectra.push_back(offset); - API::MatrixWorkspace::MaskList::const_iterator it = mList.begin(); + auto it = mList.begin(); for (; it != mList.end(); ++it) { bins.push_back(it->first); weights.push_back(it->second); @@ -1320,7 +1320,7 @@ int getNexusEntryTypes(const std::string &fileName, stat = NXgetinfo(fileH, &rank, dims, &type); if (stat == NX_ERROR) continue; - char *value = new char[dims[0] + 1]; + auto value = new char[dims[0] + 1]; stat = NXgetdata(fileH, value); if (stat == NX_ERROR) continue; diff --git a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp index 05a5f7045434a46b2bbd1ba14e0f7e9a2b35ec6a..d4ea4c9e8a107064cda78d64e8cd91b942654f0a 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmHistory.cpp @@ -28,7 +28,7 @@ boost::python::object getChildrenAsList(boost::shared_ptr<AlgorithmHistory> self) { boost::python::list names; const auto histories = self->getChildHistories(); - Mantid::API::AlgorithmHistories::const_iterator itr = histories.begin(); + auto itr = histories.begin(); for (; itr != histories.end(); ++itr) { names.append(*itr); } @@ -44,9 +44,9 @@ getChildrenAsList(boost::shared_ptr<AlgorithmHistory> self) { boost::python::object getPropertiesAsList(AlgorithmHistory &self) { boost::python::list names; const auto histories = self.getProperties(); - std::vector<Mantid::Kernel::PropertyHistory_sptr>::const_iterator iend = + auto iend = histories.end(); - for (std::vector<Mantid::Kernel::PropertyHistory_sptr>::const_iterator itr = + for (auto itr = histories.begin(); itr != iend; ++itr) { names.append(*itr); diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp index fe017452e91fa5d579d9c62205dd7e40a78dfb8e..6da723d03a25331d0dca2e669edf81828962bc42 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp @@ -141,10 +141,10 @@ PyObject *getAlgorithmPropertiesOrdered(IAlgorithm &self) { */ PyObject *getOutputProperties(IAlgorithm &self) { const PropertyVector &properties(self.getProperties()); // No copy - PropertyVector::const_iterator iend = properties.end(); + auto iend = properties.end(); // Build the list PyObject *names = PyList_New(0); - for (PropertyVector::const_iterator itr = properties.begin(); itr != iend; + for (auto itr = properties.begin(); itr != iend; ++itr) { Property *p = *itr; if (p->direction() == Direction::Output) { diff --git a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp index 9a32321b85fe93b711c88e770ae089e673720b86..c971b85337698d9c47bc5d7077ab007e766e29d4 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceHistory.cpp @@ -26,7 +26,7 @@ namespace Policies = Mantid::PythonInterface::Policies; boost::python::object getHistoriesAsList(WorkspaceHistory &self) { boost::python::list names; const auto histories = self.getAlgorithmHistories(); - Mantid::API::AlgorithmHistories::const_iterator itr = histories.begin(); + auto itr = histories.begin(); for (; itr != histories.end(); ++itr) { names.append(*itr); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp index 5aef737a654e84fc3e27b1d69d2519589aae449d..92e79372a809361b7b2dc416f08931d06428131e 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/BoundedValidator.cpp @@ -20,7 +20,7 @@ namespace { template <typename T> BoundedValidator<T> *createBoundedValidator(object lower = object(), object upper = object()) { - BoundedValidator<T> *validator = new BoundedValidator<T>(); + auto validator = new BoundedValidator<T>(); if (!Mantid::PythonInterface::isNone(lower)) { validator->setLower(extract<T>(lower)); } @@ -42,7 +42,7 @@ BoundedValidator<T> * createExclusiveBoundedValidator(object lower = object(), object upper = object(), const bool exclusive = false) { - BoundedValidator<T> *validator = new BoundedValidator<T>(); + auto validator = new BoundedValidator<T>(); if (lower.ptr() != Py_None) { validator->setLower(extract<T>(lower)); validator->setLowerExclusive(exclusive); diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp index 94f4416922ee772c84d371210918a467694f1e29..efbbc6e390ba34213a94dabecf120730c803acef 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/CompositeValidator.cpp @@ -16,7 +16,7 @@ namespace { CompositeValidator * createCompositeValidator(const boost::python::list &validators) { namespace bpl = boost::python; - CompositeValidator *composite = new CompositeValidator; + auto composite = new CompositeValidator; const bpl::ssize_t nitems = bpl::len(validators); for (bpl::ssize_t i = 0; i < nitems; ++i) { try { diff --git a/Framework/RemoteAlgorithms/src/SimpleJSON.cpp b/Framework/RemoteAlgorithms/src/SimpleJSON.cpp index 8ab1a4ebfefc11035cde76a5e475d2ae096e11e4..13d9febfb3c416e540c0f60914f7a25b609d11c8 100644 --- a/Framework/RemoteAlgorithms/src/SimpleJSON.cpp +++ b/Framework/RemoteAlgorithms/src/SimpleJSON.cpp @@ -685,7 +685,7 @@ void prettyPrint(const JSONObject &obj, std::ostream &ostr, unsigned indentLevel) { // Prints keys/value pairs. One pair per line (Does not print opening or // closing braces...) - JSONObject::const_iterator it = obj.begin(); + auto it = obj.begin(); while (it != obj.end()) { for (unsigned i = 0; i < indentLevel; i++) { ostr << "\t"; diff --git a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp index 4e984538f4d94f6cb43219f35140766abaefba0b..dafa0a13dea64f5b4c3a83c9d2778e78a2dd12e5 100644 --- a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp +++ b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp @@ -105,7 +105,7 @@ std::istream &MantidWebServiceAPIHelper::httpPost( // Need to be able to specify the content length, so build up the post body // here. std::ostringstream postBody; - PostDataMap::const_iterator it = postData.begin(); + auto it = postData.begin(); while (it != postData.end()) { postBody << boundaryLine; postBody << "Content-Disposition: form-data; name=\"" << (*it).first diff --git a/Framework/RemoteJobManagers/src/SimpleJSON.cpp b/Framework/RemoteJobManagers/src/SimpleJSON.cpp index 7c86266e3fae1401c1cc3d9d45c2de1f4a888f4e..c61badd898c7fdb3ab407f9445772e4b48b1f652 100644 --- a/Framework/RemoteJobManagers/src/SimpleJSON.cpp +++ b/Framework/RemoteJobManagers/src/SimpleJSON.cpp @@ -685,7 +685,7 @@ void prettyPrint(const JSONObject &obj, std::ostream &ostr, unsigned indentLevel) { // Prints keys/value pairs. One pair per line (Does not print opening or // closing braces...) - JSONObject::const_iterator it = obj.begin(); + auto it = obj.begin(); while (it != obj.end()) { for (unsigned i = 0; i < indentLevel; i++) { ostr << "\t"; diff --git a/Framework/SINQ/src/InvertMDDim.cpp b/Framework/SINQ/src/InvertMDDim.cpp index 80ee9f461f40cc94f19fbf7de32f2a281ef335f9..f266f70ab46c145178eb9764a4cd20afaff11ce7 100644 --- a/Framework/SINQ/src/InvertMDDim.cpp +++ b/Framework/SINQ/src/InvertMDDim.cpp @@ -43,7 +43,7 @@ void InvertMDDim::exec() { outWS->setTo(.0, .0, .0); int rank = static_cast<int>(inWS->getNumDims()); - int *idx = new int[rank]; + auto idx = new int[rank]; if (idx == NULL || outWS == NULL) { throw std::runtime_error("Out of memory in InvertMDDim"); } diff --git a/Framework/SINQ/src/PoldiAutoCorrelation5.cpp b/Framework/SINQ/src/PoldiAutoCorrelation5.cpp index 727d442d865be78c6873924b34240cdf0647caf8..f885f4a8e27e40ee05cdf6d5cb45e06d2bb2352d 100644 --- a/Framework/SINQ/src/PoldiAutoCorrelation5.cpp +++ b/Framework/SINQ/src/PoldiAutoCorrelation5.cpp @@ -153,7 +153,7 @@ void PoldiAutoCorrelation5::logConfigurationInformation( g_log.information() << "_Poldi - Number of dead wires: " << deadWires.size() << std::endl; g_log.information() << "_Poldi - Wire indices: "; - for (std::set<int>::const_iterator dw = deadWires.begin(); + for (auto dw = deadWires.begin(); dw != deadWires.end(); ++dw) { g_log.information() << *dw << " "; } diff --git a/Framework/SINQ/src/PoldiPeakSearch.cpp b/Framework/SINQ/src/PoldiPeakSearch.cpp index eab554e70b5311114c89e847f61ca3298478325d..48b115ce537d101a88e8371149fecbd32bbb6ebb 100644 --- a/Framework/SINQ/src/PoldiPeakSearch.cpp +++ b/Framework/SINQ/src/PoldiPeakSearch.cpp @@ -145,7 +145,7 @@ std::list<MantidVec::const_iterator> PoldiPeakSearch::findPeaksRecursive(MantidVec::const_iterator begin, MantidVec::const_iterator end) const { // find the maximum intensity in the range (begin - end)... - MantidVec::const_iterator maxInRange = std::max_element(begin, end); + auto maxInRange = std::max_element(begin, end); std::list<MantidVec::const_iterator> peaks; peaks.push_back(maxInRange); @@ -281,7 +281,7 @@ PoldiPeakSearch::getFWHMEstimate(const MantidVec::const_iterator &baseListStart, * - average positions i-1 and i as guess for position of fwhm * - return difference to peak position * 2 */ - MantidVec::const_iterator nextIntensity = peakPosition; + auto nextIntensity = peakPosition; while (nextIntensity != baseListEnd && (*nextIntensity > halfPeakIntensity)) { nextIntensity += 1; } @@ -332,7 +332,7 @@ MantidVec PoldiPeakSearch::getBackground( MantidVec background; background.reserve(backgroundPoints); - for (MantidVec::const_iterator point = correlationCounts.begin() + 1; + for (auto point = correlationCounts.begin() + 1; point != correlationCounts.end() - 1; ++point) { if (distanceToPeaksGreaterThanMinimum(peakPositions, point)) { background.push_back(*point); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp index 48b5317b0eacdd7fdf4cc32a6cb5af86b2223ca7..df2c46d2bedf244e2b1bcab18bf8c2a7406e1f04 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp @@ -267,7 +267,7 @@ std::vector<double> PoldiAutoCorrelationCore::calculateDWeights( std::vector<double> tofs; tofs.reserve(tofsFor1Angstrom.size()); - for (std::vector<double>::const_iterator tofFor1Angstrom = + for (auto tofFor1Angstrom = tofsFor1Angstrom.begin(); tofFor1Angstrom != tofsFor1Angstrom.end(); ++tofFor1Angstrom) { tofs.push_back(*tofFor1Angstrom * deltaD); @@ -302,7 +302,7 @@ PoldiAutoCorrelationCore::getRawCorrelatedIntensity(double dValue, std::vector<UncertainValue> current; current.reserve(m_chopper->slitTimes().size()); - for (std::vector<double>::const_iterator slitOffset = + for (auto slitOffset = m_chopper->slitTimes().begin(); slitOffset != m_chopper->slitTimes().end(); ++slitOffset) { /* For each offset, the sum of correlation intensity and error (for each @@ -576,7 +576,7 @@ PoldiAutoCorrelationCore::getDistances(const std::vector<int> &elements) const { std::vector<double> distances; distances.reserve(elements.size()); - for (std::vector<int>::const_iterator element = elements.begin(); + for (auto element = elements.begin(); element != elements.end(); ++element) { distances.push_back(chopperDistance + m_detector->distanceFromSample(*element)); @@ -686,7 +686,7 @@ double PoldiAutoCorrelationCore::getSumOfCounts( double sum = 0.0; for (int t = 0; t < timeBinCount; ++t) { - for (std::vector<int>::const_iterator e = detectorElements.begin(); + for (auto e = detectorElements.begin(); e != detectorElements.end(); ++e) { sum += getCounts(*e, t); } diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp index aa4ce506f4fd8aee9a836a7b8584068a9e05f966..4282351ce0911fbf04064ffcaf52a2f2859893f6 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiDeadWireDecorator.cpp @@ -25,7 +25,7 @@ PoldiDeadWireDecorator::PoldiDeadWireDecorator( std::vector<detid_t> allDetectorIds = poldiInstrument->getDetectorIDs(); std::vector<detid_t> deadDetectorIds(allDetectorIds.size()); - std::vector<detid_t>::iterator endIterator = std::remove_copy_if( + auto endIterator = std::remove_copy_if( allDetectorIds.begin(), allDetectorIds.end(), deadDetectorIds.begin(), boost::bind<bool>(&PoldiDeadWireDecorator::detectorIsNotMasked, poldiInstrument, _1)); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp index 916484b919b120f7818851d7c0b7023b01a7f1ff..4ff30b979854d279e3629f96179145d7b4de6b04 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp @@ -271,7 +271,7 @@ std::vector<double> PoldiSpectrumDomainFunction::getChopperSlitOffsets( const std::vector<double> &chopperSlitTimes = chopper->slitTimes(); std::vector<double> offsets; offsets.reserve(chopperSlitTimes.size()); - for (std::vector<double>::const_iterator time = chopperSlitTimes.begin(); + for (auto time = chopperSlitTimes.begin(); time != chopperSlitTimes.end(); ++time) { offsets.push_back(*time + chopper->zeroOffset()); } diff --git a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp index 8f9c780a0657dda09520521dd1e1c5b5943f2447..c9124b6ba622eeb8231972e55458ce96f49fb39d 100644 --- a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp +++ b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp @@ -475,7 +475,7 @@ std::vector<std::string> ScriptRepositoryImpl::listFiles() { // and also fill up the output vector (in reverse order) Mantid::API::SCRIPTSTATUS acc_status = Mantid::API::BOTH_UNCHANGED; std::string last_directory = ""; - for (Repository::reverse_iterator it = repo.rbegin(); it != repo.rend(); + for (auto it = repo.rbegin(); it != repo.rend(); ++it) { // for every entry, it takes the path and RepositoryEntry std::string entry_path = it->first; @@ -619,7 +619,7 @@ void ScriptRepositoryImpl::download_directory( std::string directory_path_with_slash = std::string(directory_path).append("/"); bool found = false; - for (Repository::iterator it = repo.begin(); it != repo.end(); ++it) { + for (auto it = repo.begin(); it != repo.end(); ++it) { // skip all entries that are not children of directory_path // the map will list the entries in alphabetical order, so, // when it first find the directory, it will list all the @@ -840,7 +840,7 @@ void ScriptRepositoryImpl::upload(const std::string &file_path, form.add("path", folder); // inserting the file - FilePartSource *m_file = new FilePartSource(absolute_path); + auto m_file = new FilePartSource(absolute_path); form.addPart("file", m_file); inetHelper.setBody(form); @@ -1256,7 +1256,7 @@ std::vector<std::string> ScriptRepositoryImpl::check4Update(void) { std::vector<std::string> output_list; // look for all the files in the list, to check those that // has the auto_update and check it they have changed. - for (Repository::iterator it = repo.begin(); it != repo.end(); ++it) { + for (auto it = repo.begin(); it != repo.end(); ++it) { if (it->second.auto_update) { // THE SAME AS it->status in (REMOTE_CHANGED, BOTH_CHANGED) if (it->second.status & REMOTE_CHANGED) { @@ -1312,7 +1312,7 @@ int ScriptRepositoryImpl::setAutoUpdate(const std::string &input_path, ensureValidRepository(); std::string path = convertPath(input_path); std::vector<std::string> files_to_update; - for (Repository::reverse_iterator it = repo.rbegin(); it != repo.rend(); + for (auto it = repo.rbegin(); it != repo.rend(); ++it) { // for every entry, it takes the path and RepositoryEntry std::string entry_path = it->first; @@ -1551,7 +1551,7 @@ void ScriptRepositoryImpl::parseDownloadedEntries(Repository &repo) { } } - for (std::vector<std::string>::iterator it = entries_to_delete.begin(); + for (auto it = entries_to_delete.begin(); it != entries_to_delete.end(); ++it) { // remove this entry pt.removeMember(*it); diff --git a/Framework/TestHelpers/src/MDEventsTestHelper.cpp b/Framework/TestHelpers/src/MDEventsTestHelper.cpp index 52bd09f73443cda6ae7a16583a7b411c8e0bb49e..bb77a83eaae6e4d60b76376b1dfa40562e4f3ff7 100644 --- a/Framework/TestHelpers/src/MDEventsTestHelper.cpp +++ b/Framework/TestHelpers/src/MDEventsTestHelper.cpp @@ -161,9 +161,7 @@ MDBox<MDLeanEvent<1>, 1> *makeMDBox1(size_t splitInto, // Splits into 10 boxes splitter->setSplitInto(splitInto); // Set the size - MDBox<MDLeanEvent<1>, 1> *out = new MDBox<MDLeanEvent<1>, 1>(splitter); - out->setExtents(0, 0.0, 10.0); - out->calcVolume(); + auto ->calcVolume(); return out; } @@ -174,17 +172,13 @@ MDBox<MDLeanEvent<1>, 1> *makeMDBox1(size_t splitInto, MDBox<MDLeanEvent<3>, 3> *makeMDBox3() { // Split at 5 events - BoxController *splitter = new BoxController(3); - - splitter->setSplitThreshold(5); + auto tter->setSplitThreshold(5); // Splits into 10x5x2 boxes splitter->setSplitInto(10); splitter->setSplitInto(1, 5); splitter->setSplitInto(2, 2); // Set the size to 10.0 in all directions - MDBox<MDLeanEvent<3>, 3> *out = new MDBox<MDLeanEvent<3>, 3>(splitter); - for (size_t d = 0; d < 3; d++) - out->setExtents(d, 0.0, 10.0); + auto ut->setExtents(d, 0.0, 10.0); out->calcVolume(); return out; } diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp index 53f44d0a328cdd9a87d27257766d2ca0da55fee6..4f3f6ff471db33f9a63eb18509d11f0ffd3c5688 100644 --- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp +++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp @@ -136,9 +136,7 @@ Workspace2D_sptr Create2DWorkspaceWhereYIsWorkspaceIndex(int nhist, Workspace2D_sptr create2DWorkspaceThetaVsTOF(int nHist, int nBins) { Workspace2D_sptr outputWS = Create2DWorkspaceBinned(nHist, nBins); - NumericAxis *const newAxis = new NumericAxis(nHist); - outputWS->replaceAxis(1, newAxis); - newAxis->unit() = boost::shared_ptr<Unit>(new Units::Degrees); + auto boost::shared_ptr<Unit>(new Units::Degrees); for (int i = 0; i < nHist; ++i) { newAxis->setValue(i, i + 1); } @@ -463,9 +461,7 @@ createEventWorkspaceWithFullInstrument(int numBanks, int numPixels, // Set the X axes MantidVec x = ws->readX(0); - NumericAxis *ax0 = new NumericAxis(x.size()); - ax0->setUnit("dSpacing"); - for (size_t i = 0; i < x.size(); i++) + auto i++) ax0->setValue(i, x[i]); ws->replaceAxis(0, ax0); @@ -712,14 +708,7 @@ CreateGroupedEventWorkspace(std::vector<std::vector<int>> groups, int numBins, for (size_t g = 0; g < groups.size(); g++) { retVal->getOrAddEventList(g).clearDetectorIDs(); std::vector<int> dets = groups[g]; - for (std::vector<int>::iterator it = dets.begin(); it != dets.end(); ++it) { - for (int i = 0; i < numBins; i++) - retVal->getOrAddEventList(g) += TofEvent((i + 0.5) * binDelta, 1); - retVal->getOrAddEventList(g).addDetectorID(*it); - } - } - - // Create the x-axis for histogramming. + for (autoing. MantidVecPtr x1; MantidVec &xRef = x1.access(); double x0 = 0; @@ -748,10 +737,7 @@ EventWorkspace_sptr CreateRandomEventWorkspace(size_t numbins, size_t numpixels, retVal->initialize(numpixels, numbins, numbins - 1); // and X-axis for references: - NumericAxis *pAxis0 = new NumericAxis(numbins); - - // Create the original X axis to histogram on. - // Create the x-axis for histogramming. + auto the x-axis for histogramming. Kernel::cow_ptr<MantidVec> axis; MantidVec &xRef = axis.access(); xRef.resize(numbins); @@ -917,10 +903,7 @@ createProcessedWorkspaceWithCylComplexInstrument(size_t numPixels, Mantid::API::MatrixWorkspace_sptr ws = CreateGroupedWorkspace2DWithRingsAndBoxes(rHist, 10, 0.1); - NumericAxis *pAxis0 = new NumericAxis(numBins); - - for (size_t i = 0; i < numBins; i++) { - double dE = -1.0 + static_cast<double>(i) * 0.8; + auto 0 + static_cast<double>(i) * 0.8; pAxis0->setValue(i, dE); } pAxis0->setUnit("DeltaE"); @@ -991,9 +974,7 @@ createProcessedInelasticWS(const std::vector<double> &L2, } } // set axis, correspondent to the X-values - NumericAxis *pAxis0 = new NumericAxis(numBins); - MantidVec &E_transfer = ws->dataX(0); - for (size_t i = 0; i < numBins; i++) { + auto i < numBins; i++) { double E = 0.5 * (E_transfer[i] + E_transfer[i + 1]); pAxis0->setValue(i, E); } diff --git a/Framework/WorkflowAlgorithms/src/DgsReduction.cpp b/Framework/WorkflowAlgorithms/src/DgsReduction.cpp index cef396262826762383c9636ad1cc354ff1276003..b8add73bc7f3286c07e3faf984c40ca70376f1b9 100644 --- a/Framework/WorkflowAlgorithms/src/DgsReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/DgsReduction.cpp @@ -688,7 +688,7 @@ void DgsReduction::exec() { // Put all properties except input files/workspaces into property manager. const std::vector<Property *> props = this->getProperties(); - std::vector<Property *>::const_iterator iter = props.begin(); + auto iter = props.begin(); for (; iter != props.end(); ++iter) { if (!boost::contains((*iter)->name(), "Input")) { this->reductionManager->declareProperty((*iter)->clone()); diff --git a/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp b/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp index e93f43068f858c373d6eaa75efbd6a9deb7a1ba9..92974ad24f8580eb88d7604a258e5a8d7bbb7ea5 100644 --- a/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp +++ b/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp @@ -123,7 +123,7 @@ std::string EQSANSLoad::findConfigFile(const int &run) { const std::vector<std::string> &searchPaths = Kernel::ConfigService::Instance().getDataSearchDirs(); - std::vector<std::string>::const_iterator it = searchPaths.begin(); + auto it = searchPaths.begin(); int max_run_number = 0; std::string config_file = "";