diff --git a/Framework/API/inc/MantidAPI/Algorithm.tcc b/Framework/API/inc/MantidAPI/Algorithm.tcc index 41b5052182533bb8e923862bfcc8c11978bfa57a..26b6cfc7d2b604af04ebdae7eccb5173a00cebb0 100644 --- a/Framework/API/inc/MantidAPI/Algorithm.tcc +++ b/Framework/API/inc/MantidAPI/Algorithm.tcc @@ -69,9 +69,9 @@ void Algorithm::declareWorkspaceInputProperties(const std::string &propertyName, "index type; Indices are entered as a comma-separated list " "of values, and/or ranges; For example, '4,6,10-20,1000';"); - m_reservedList.push_back(propertyName); - m_reservedList.push_back(indexTypePropName); - m_reservedList.push_back(indexPropName); + m_reservedList.emplace_back(propertyName); + m_reservedList.emplace_back(indexTypePropName); + m_reservedList.emplace_back(indexPropName); } template <typename T1, typename T2, typename WsType> diff --git a/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc b/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc index 6a01f7edec2abbc7922889fd293552eb7e911277..9b7b3f4a414590c8d76ec963297cd47994bb9107 100644 --- a/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc +++ b/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc @@ -327,7 +327,7 @@ std::vector<std::string> WorkspaceProperty<TYPE>::allowedValues() const { Mantid::Kernel::DataServiceSort::Sorted); if (isOptional()) // Insert an empty option { - vals.push_back(""); + vals.emplace_back(""); } // Copy-construct a temporary workspace property to test the validity of // each workspace diff --git a/Framework/API/src/ADSValidator.cpp b/Framework/API/src/ADSValidator.cpp index f4fe0ca541d9e2912c64641c29ce84c33964694d..fa5c817172489b0a74e80eb8a4632806e77391f8 100644 --- a/Framework/API/src/ADSValidator.cpp +++ b/Framework/API/src/ADSValidator.cpp @@ -74,7 +74,7 @@ std::vector<std::string> ADSValidator::allowedValues() const { Mantid::Kernel::DataServiceSort::Sorted); if (isOptional()) // Insert an empty option { - vals.push_back(""); + vals.emplace_back(""); } return vals; } diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp index a9c04a2d467ea94120b5e8d1862c02ecfc3e8474..5c8b770354daee24705989c8b74c1b9609222e9e 100644 --- a/Framework/API/src/Algorithm.cpp +++ b/Framework/API/src/Algorithm.cpp @@ -321,15 +321,15 @@ void Algorithm::cacheWorkspaceProperties() { continue; switch (prop->direction()) { case Kernel::Direction::Input: - m_inputWorkspaceProps.push_back(wsProp); + m_inputWorkspaceProps.emplace_back(wsProp); break; case Kernel::Direction::InOut: - m_inputWorkspaceProps.push_back(wsProp); - m_outputWorkspaceProps.push_back(wsProp); + m_inputWorkspaceProps.emplace_back(wsProp); + m_outputWorkspaceProps.emplace_back(wsProp); break; case Kernel::Direction::Output: - m_outputWorkspaceProps.push_back(wsProp); - m_pureOutputWorkspaceProps.push_back(wsProp); + m_outputWorkspaceProps.emplace_back(wsProp); + m_pureOutputWorkspaceProps.emplace_back(wsProp); break; default: throw std::logic_error( @@ -433,7 +433,7 @@ void Algorithm::lockWorkspaces() { // Write-lock it if not already debugLog << "Write-locking " << ws->getName() << '\n'; ws->getLock()->writeLock(); - m_writeLockedWorkspaces.push_back(ws); + m_writeLockedWorkspaces.emplace_back(ws); } } } @@ -451,7 +451,7 @@ void Algorithm::lockWorkspaces() { // Read-lock it if not already write-locked debugLog << "Read-locking " << ws->getName() << '\n'; ws->getLock()->readLock(); - m_readLockedWorkspaces.push_back(ws); + m_readLockedWorkspaces.emplace_back(ws); } } } @@ -773,7 +773,7 @@ void Algorithm::store() { throw; } } else { - groupWsIndicies.push_back(i); + groupWsIndicies.emplace_back(i); } } } @@ -870,7 +870,7 @@ void Algorithm::setupAsChildAlgorithm(Algorithm_sptr alg, // in parallel safely. boost::weak_ptr<IAlgorithm> weakPtr(alg); PARALLEL_CRITICAL(Algorithm_StoreWeakPtr) { - m_ChildAlgorithms.push_back(weakPtr); + m_ChildAlgorithms.emplace_back(weakPtr); } } @@ -1390,7 +1390,7 @@ bool Algorithm::processGroups() { auto *prop = dynamic_cast<Property *>(pureOutputWorkspaceProp); if (prop && !prop->value().empty()) { auto outWSGrp = boost::make_shared<WorkspaceGroup>(); - outGroups.push_back(outWSGrp); + outGroups.emplace_back(outWSGrp); // Put the GROUP in the ADS AnalysisDataService::Instance().addOrReplace(prop->value(), outWSGrp); outWSGrp->observeADSNotifications(false); diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp index 0727fcd6090e9b4989211f3224b3d5a9a0eb76e0..7056e7963452c040297aa2716a1f1e5926af08a6 100644 --- a/Framework/API/src/AlgorithmFactory.cpp +++ b/Framework/API/src/AlgorithmFactory.cpp @@ -216,7 +216,7 @@ AlgorithmFactoryImpl::getKeys(bool includeHidden) const { if (!toBeRemoved) { // just mark them to be removed as we are iterating around the vector at // the moment - validNames.push_back(name); + validNames.emplace_back(name); } } return validNames; @@ -383,7 +383,7 @@ AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const { } if (!categoryIsHidden) - res.push_back(desc); + res.emplace_back(desc); } } return res; diff --git a/Framework/API/src/AlgorithmHistory.cpp b/Framework/API/src/AlgorithmHistory.cpp index cdfff07512281349c2a8ece692966656a7668b5a..faeb6b0077fd7aff6496fc632cb99bf77fc91c91 100644 --- a/Framework/API/src/AlgorithmHistory.cpp +++ b/Framework/API/src/AlgorithmHistory.cpp @@ -91,7 +91,7 @@ void AlgorithmHistory::setProperties(const Algorithm *const alg) { // objects. const std::vector<Property *> &properties = alg->getProperties(); for (const auto &property : properties) { - m_properties.push_back( + m_properties.emplace_back( boost::make_shared<PropertyHistory>(property->createHistory())); } } @@ -147,7 +147,7 @@ void AlgorithmHistory::addExecutionInfo(const DateAndTime &start, void AlgorithmHistory::addProperty(const std::string &name, const std::string &value, bool isdefault, const unsigned int &direction) { - m_properties.push_back(boost::make_shared<PropertyHistory>( + m_properties.emplace_back(boost::make_shared<PropertyHistory>( name, value, "", isdefault, direction)); } diff --git a/Framework/API/src/AlgorithmManager.cpp b/Framework/API/src/AlgorithmManager.cpp index 0170c4eb4cf5af290593e1079b1b00174ba9c2b3..b86d5dd9e2593f61fce8f995223a0bf6d92a3669 100644 --- a/Framework/API/src/AlgorithmManager.cpp +++ b/Framework/API/src/AlgorithmManager.cpp @@ -112,7 +112,7 @@ IAlgorithm_sptr AlgorithmManagerImpl::create(const std::string &algName, } // Add to list of managed ones - m_managed_algs.push_back(alg); + m_managed_algs.emplace_back(alg); alg->initialize(); } catch (std::runtime_error &ex) { diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp index df08f1338bdc959b3c18694bef25f43560b040c4..86ff360fa1550136bd721faa3cdb6c2afb822573 100644 --- a/Framework/API/src/AlgorithmProxy.cpp +++ b/Framework/API/src/AlgorithmProxy.cpp @@ -144,7 +144,7 @@ void AlgorithmProxy::addObserver(const Poco::AbstractObserver &observer) const { } // save the observer in any case because m_alg can be reset (eg in // createConcreteAlg()) - m_externalObservers.push_back(obs); + m_externalObservers.emplace_back(obs); } /** Remove an observer. diff --git a/Framework/API/src/CompositeCatalog.cpp b/Framework/API/src/CompositeCatalog.cpp index 3128bc74e86e17b708bca0ec1d4cb8e804dff7b6..d8f99882c257a55e2e291096214c5278951d7cc0 100644 --- a/Framework/API/src/CompositeCatalog.cpp +++ b/Framework/API/src/CompositeCatalog.cpp @@ -17,7 +17,7 @@ CompositeCatalog::CompositeCatalog() : m_catalogs() {} * @param catalog :: The catalog to add to the container. */ void CompositeCatalog::add(const ICatalog_sptr catalog) { - m_catalogs.push_back(catalog); + m_catalogs.emplace_back(catalog); } /** diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp index e1b589627bf6e5ed22902adb86d4f5313b5e3313..6627c5c0f3e42075d73e5ac2ed8f4d5fc9009b03 100644 --- a/Framework/API/src/CompositeFunction.cpp +++ b/Framework/API/src/CompositeFunction.cpp @@ -403,13 +403,13 @@ void CompositeFunction::clear() { */ size_t CompositeFunction::addFunction(IFunction_sptr f) { m_IFunction.insert(m_IFunction.end(), f->nParams(), m_functions.size()); - m_functions.push_back(f); + m_functions.emplace_back(f); //?f->init(); if (m_paramOffsets.empty()) { - m_paramOffsets.push_back(0); + m_paramOffsets.emplace_back(0); m_nParams = f->nParams(); } else { - m_paramOffsets.push_back(m_nParams); + m_paramOffsets.emplace_back(m_nParams); m_nParams += f->nParams(); } return m_functions.size() - 1; @@ -828,14 +828,14 @@ CompositeFunction::createEquivalentFunctions() const { std::vector<std::vector<IFunction_sptr>> equiv; equiv.reserve(nf); for (size_t i = 0; i < nf; ++i) { - equiv.push_back(getFunction(i)->createEquivalentFunctions()); + equiv.emplace_back(getFunction(i)->createEquivalentFunctions()); } std::vector<IFunction_sptr> funs; funs.reserve(nd); for (size_t i = 0; i < nd; ++i) { auto comp = new CompositeFunction; - funs.push_back(IFunction_sptr(comp)); + funs.emplace_back(IFunction_sptr(comp)); for (size_t j = 0; j < nf; ++j) { comp->addFunction(equiv[j][i]); } diff --git a/Framework/API/src/DetectorSearcher.cpp b/Framework/API/src/DetectorSearcher.cpp index 5bfb9108e6c01341a4a8e564cb20424165786214..9ffbcb36d0a5010913dc4e0a5f2a37539fc95cf6 100644 --- a/Framework/API/src/DetectorSearcher.cpp +++ b/Framework/API/src/DetectorSearcher.cpp @@ -86,8 +86,8 @@ void DetectorSearcher::createDetectorCache() { if (point.hasNaN() || up.coLinear(beam, pos)) continue; - points.push_back(point); - m_indexMap.push_back(pointNo); + points.emplace_back(point); + m_indexMap.emplace_back(pointNo); } // create KDtree of cached detector Q vectors diff --git a/Framework/API/src/Expression.cpp b/Framework/API/src/Expression.cpp index ba5b76605c74c6f40e49762a10e36dd295855b07..77daf5ccdc020e02c1dfb3761152e9cdd30cd486 100644 --- a/Framework/API/src/Expression.cpp +++ b/Framework/API/src/Expression.cpp @@ -205,7 +205,7 @@ void Expression::parse(const std::string &str) { setFunct(*tkz.begin()); for (size_t i = 0; i <= m_tokens.size(); i++) { - m_terms.push_back(Expression(this)); + m_terms.emplace_back(Expression(this)); Expression &t = m_terms.back(); if (i) t.m_op = GetOp(i - 1); @@ -330,7 +330,7 @@ void Expression::tokenize() { if (prec < min_prec) min_prec = prec; Token tok(is, i - 1, is1, prec); - tokens.push_back(tok); + tokens.emplace_back(tok); is = is1; } @@ -429,7 +429,7 @@ void Expression::setFunct(const std::string &name) { m_funct = op; Expression tmp(this); tmp.parse(name.substr(op.size())); - m_terms.push_back(tmp); + m_terms.emplace_back(tmp); return; } } @@ -473,7 +473,7 @@ void Expression::setFunct(const std::string &name) { tmp.parse(args); if (tmp.name() != EMPTY_EXPRESSION_NAME && (!tmp.isFunct() || tmp.name() != ",")) { - m_terms.push_back(tmp); + m_terms.emplace_back(tmp); } else { if (f.empty() && tmp.name() == ",") { f = ","; diff --git a/Framework/API/src/FileFinder.cpp b/Framework/API/src/FileFinder.cpp index 547df5836bb889924836f004e6e83b8d2caf0408..928982bf0d87a56c7df954baa9e57a691ce411bf 100644 --- a/Framework/API/src/FileFinder.cpp +++ b/Framework/API/src/FileFinder.cpp @@ -392,7 +392,7 @@ FileFinderImpl::getArchiveSearch(const Kernel::FacilityInfo &facility) const { for (const auto &facilityname : facility.archiveSearch()) { g_log.debug() << "get archive search for the facility..." << facilityname << "\n"; - archs.push_back(ArchiveSearchFactory::Instance().create(facilityname)); + archs.emplace_back(ArchiveSearchFactory::Instance().create(facilityname)); } } return archs; @@ -485,7 +485,7 @@ std::string FileFinderImpl::findRun(const std::string &hintstr, std::vector<std::string> uniqueExts; uniqueExts.reserve(1 + exts.size() + extensions.size()); if (!extension.empty()) - uniqueExts.push_back(extension); + uniqueExts.emplace_back(extension); // If provided exts are empty, or useExtsOnly is false, // we want to include facility exts as well @@ -530,7 +530,7 @@ void FileFinderImpl::getUniqueExtensions( const auto searchItr = std::find(uniqueExts.begin(), uniqueExts.end(), transformed); if (searchItr == uniqueExts.end()) { - uniqueExts.push_back(transformed); + uniqueExts.emplace_back(transformed); } } } @@ -613,7 +613,7 @@ FileFinderImpl::findRuns(const std::string &hintstr, run.insert(0, "0"); std::string path = findRun(p1.first + run, exts, useExtsOnly); if (!path.empty()) { - res.push_back(path); + res.emplace_back(path); } else { throw Kernel::Exception::NotFoundError("Unable to find file:", run); } @@ -621,7 +621,7 @@ FileFinderImpl::findRuns(const std::string &hintstr, } else { std::string path = findRun(*h, exts, useExtsOnly); if (!path.empty()) { - res.push_back(path); + res.emplace_back(path); } else { throw Kernel::Exception::NotFoundError("Unable to find file:", *h); } diff --git a/Framework/API/src/FileProperty.cpp b/Framework/API/src/FileProperty.cpp index ae6ffbefb725f7e9a5802313e50faa7b864205ed..a01f64c9969587627881291d90c9f6e711c54f14 100644 --- a/Framework/API/src/FileProperty.cpp +++ b/Framework/API/src/FileProperty.cpp @@ -59,7 +59,7 @@ void addExtension(const std::string &extension, extensions.end()) return; else - extensions.push_back(extension); + extensions.emplace_back(extension); } /** diff --git a/Framework/API/src/FunctionDomainGeneral.cpp b/Framework/API/src/FunctionDomainGeneral.cpp index 8caeb89f21dfd098b48cdfbf11d44a59445f4e2c..e6ce56eeaf5a8e606298eaa0eb17d9c7b6df0eb7 100644 --- a/Framework/API/src/FunctionDomainGeneral.cpp +++ b/Framework/API/src/FunctionDomainGeneral.cpp @@ -32,7 +32,7 @@ void FunctionDomainGeneral::addColumn(boost::shared_ptr<Column> column) { "All columns must have the same size."); } - m_columns.push_back(column); + m_columns.emplace_back(column); } /// Get i-th column. diff --git a/Framework/API/src/FunctionFactory.cpp b/Framework/API/src/FunctionFactory.cpp index e3bc61ef351e99305df774d4d0a5ddf5ae084bd9..5696c33753429a37cf597010fc14393f26fcd083 100644 --- a/Framework/API/src/FunctionFactory.cpp +++ b/Framework/API/src/FunctionFactory.cpp @@ -365,9 +365,9 @@ void FunctionFactoryImpl::addTie(IFunction_sptr fun, std::vector<std::string> FunctionFactoryImpl::getFunctionNamesGUI() const { auto allNames = getFunctionNames<IFunction1D>(); - allNames.push_back("ProductFunction"); - allNames.push_back("CompositeFunction"); - allNames.push_back("Convolution"); + allNames.emplace_back("ProductFunction"); + allNames.emplace_back("CompositeFunction"); + allNames.emplace_back("Convolution"); std::sort(allNames.begin(), allNames.end()); std::vector<std::string> names; names.reserve(allNames.size()); diff --git a/Framework/API/src/GroupingLoader.cpp b/Framework/API/src/GroupingLoader.cpp index 3d7e0a19ba1162c7827389e87c1fcef744b8f767..25ccefb8bd968f53706a9bfaec2f921587b49075 100644 --- a/Framework/API/src/GroupingLoader.cpp +++ b/Framework/API/src/GroupingLoader.cpp @@ -239,7 +239,7 @@ boost::shared_ptr<Grouping> GroupingLoader::getDummyGrouping() { auto dummyGrouping = boost::make_shared<Mantid::API::Grouping>(); dummyGrouping->description = "Dummy grouping"; dummyGrouping->groupNames.emplace_back("all"); - dummyGrouping->groups.push_back(all.str()); + dummyGrouping->groups.emplace_back(all.str()); return dummyGrouping; } @@ -258,14 +258,14 @@ Grouping::Grouping(ITableWorkspace_sptr table) { // Convert to a range string, i.e. 1-5,6-8,9 std::string detectorRange = Kernel::Strings::toString(detectors); - this->groupNames.push_back(std::to_string(row + 1)); - this->groups.push_back(detectorRange); + this->groupNames.emplace_back(std::to_string(row + 1)); + this->groups.emplace_back(detectorRange); } // If we have 2 groups only - create a longitudinal pair if (this->groups.size() == 2) { this->pairNames.emplace_back("long"); - this->pairAlphas.push_back(1.0); + this->pairAlphas.emplace_back(1.0); this->pairs.emplace_back(0, 1); } } diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index 9689ccfbf77638725df0b4ed49d4068dd6d7d407..422f6e35ba76ece04a7d23e68c6cac646eea89dc 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -266,7 +266,7 @@ void IFunction::addTie(std::unique_ptr<ParameterTie> tie) { } } if (!found) { - m_ties.push_back(std::move(tie)); + m_ties.emplace_back(std::move(tie)); setParameterStatus(iPar, Tied); } } @@ -368,7 +368,7 @@ void IFunction::addConstraint(std::unique_ptr<IConstraint> ic) { } } if (!found) { - m_constraints.push_back(std::move(ic)); + m_constraints.emplace_back(std::move(ic)); } } @@ -478,7 +478,7 @@ IFunction::writeToString(const std::string &parentLocalAttributesStr) const { ostr << ',' << paramOut.str(); // Output non-default ties only. if (getParameterStatus(i) == Fixed) { - ties.push_back(paramOut.str()); + ties.emplace_back(paramOut.str()); } } @@ -492,7 +492,7 @@ IFunction::writeToString(const std::string &parentLocalAttributesStr) const { // collect the non-default ties auto tiesString = writeTies(); if (!tiesString.empty()) { - ties.push_back(tiesString); + ties.emplace_back(tiesString); } // print the ties if (!ties.empty()) { @@ -549,7 +549,7 @@ void IFunction::addConstraints(const std::string &str, bool isDefault) { std::vector<std::string> IFunction::getParameterNames() const { std::vector<std::string> out; for (size_t i = 0; i < nParams(); ++i) { - out.push_back(parameterName(i)); + out.emplace_back(parameterName(i)); } return out; } @@ -1583,7 +1583,7 @@ void IFunction::sortTies() { } orderedTieNodes.push_front(newNode); } else { - orderedTieNodes.push_back(newNode); + orderedTieNodes.emplace_back(newNode); } } for (auto &&node : orderedTieNodes) { diff --git a/Framework/API/src/IMDWorkspace.cpp b/Framework/API/src/IMDWorkspace.cpp index 70e3ef57ae612d59a98a4850161ba395f4cdd38b..248fd5c8d146a679d3a461add5e28f3342ef6d39 100644 --- a/Framework/API/src/IMDWorkspace.cpp +++ b/Framework/API/src/IMDWorkspace.cpp @@ -135,9 +135,9 @@ const std::string IMDWorkspace::toString() const { void IMDWorkspace::makeSinglePointWithNaN(std::vector<coord_t> &x, std::vector<signal_t> &y, std::vector<signal_t> &e) const { - x.push_back(0); - y.push_back(std::numeric_limits<signal_t>::quiet_NaN()); - e.push_back(std::numeric_limits<signal_t>::quiet_NaN()); + x.emplace_back(0); + y.emplace_back(std::numeric_limits<signal_t>::quiet_NaN()); + e.emplace_back(std::numeric_limits<signal_t>::quiet_NaN()); } //----------------------------------------------------------------------------------------------- @@ -170,14 +170,14 @@ IMDWorkspace::getLinePlot(const Mantid::Kernel::VMD &start, // Coordinate along the line VMD coord = start + step * double(i); // Record the position along the line - line.x.push_back(static_cast<coord_t>(stepLength * double(i))); + line.x.emplace_back(static_cast<coord_t>(stepLength * double(i))); signal_t yVal = this->getSignalAtCoord(coord.getBareArray(), normalize); - line.y.push_back(yVal); - line.e.push_back(0.0); + line.y.emplace_back(yVal); + line.e.emplace_back(0.0); } // And the last point - line.x.push_back((end - start).norm()); + line.x.emplace_back((end - start).norm()); return line; } diff --git a/Framework/API/src/IndexTypeProperty.cpp b/Framework/API/src/IndexTypeProperty.cpp index b87109b384cd2ea24b0817aa7f8d07a68e1d0022..e7ea66cae7f1b170a239fcfe0518ead82fd67271 100644 --- a/Framework/API/src/IndexTypeProperty.cpp +++ b/Framework/API/src/IndexTypeProperty.cpp @@ -12,9 +12,9 @@ IndexTypeProperty::IndexTypeProperty(const std::string &name, const int indexType) : PropertyWithValue<std::string>(name, "", Kernel::Direction::Input) { if (indexType & IndexType::WorkspaceIndex) - m_allowedValues.push_back("WorkspaceIndex"); + m_allowedValues.emplace_back("WorkspaceIndex"); if (indexType & IndexType::SpectrumNum) - m_allowedValues.push_back("SpectrumNumber"); + m_allowedValues.emplace_back("SpectrumNumber"); if (m_allowedValues.empty()) throw std::invalid_argument("Argument indexType incorrectly specified"); diff --git a/Framework/API/src/JointDomain.cpp b/Framework/API/src/JointDomain.cpp index a25320618946d3e4792ee8c4b916e51f704042cf..aabebc4433e19de8f141defca6fe9a915b1e80e9 100644 --- a/Framework/API/src/JointDomain.cpp +++ b/Framework/API/src/JointDomain.cpp @@ -34,7 +34,7 @@ const FunctionDomain &JointDomain::getDomain(size_t i) const { * @param domain :: A shared pointer to a domain. */ void JointDomain::addDomain(FunctionDomain_sptr domain) { - m_domains.push_back(domain); + m_domains.emplace_back(domain); } } // namespace API diff --git a/Framework/API/src/MDGeometry.cpp b/Framework/API/src/MDGeometry.cpp index 65f5a5aa920c1a0c7a7811862565439be37b244d..1e4a2b33e3e148319d92853d7ad92804ec506010 100644 --- a/Framework/API/src/MDGeometry.cpp +++ b/Framework/API/src/MDGeometry.cpp @@ -86,7 +86,7 @@ MDGeometry::MDGeometry(const MDGeometry &other) // Copy the dimension auto dim = boost::make_shared<MDHistoDimension>(other.getDimension(d).get()); - dimensions.push_back(dim); + dimensions.emplace_back(dim); } this->initGeometry(dimensions); @@ -95,19 +95,19 @@ MDGeometry::MDGeometry(const MDGeometry &other) for (it = other.m_transforms_FromOriginal.begin(); it != other.m_transforms_FromOriginal.end(); ++it) { if (*it) - m_transforms_FromOriginal.push_back( + m_transforms_FromOriginal.emplace_back( CoordTransform_const_sptr((*it)->clone())); else - m_transforms_FromOriginal.push_back(CoordTransform_const_sptr()); + m_transforms_FromOriginal.emplace_back(CoordTransform_const_sptr()); } for (it = other.m_transforms_ToOriginal.begin(); it != other.m_transforms_ToOriginal.end(); ++it) { if (*it) - m_transforms_ToOriginal.push_back( + m_transforms_ToOriginal.emplace_back( CoordTransform_const_sptr((*it)->clone())); else - m_transforms_ToOriginal.push_back(CoordTransform_const_sptr()); + m_transforms_ToOriginal.emplace_back(CoordTransform_const_sptr()); } // Copy the references to the original workspaces @@ -206,7 +206,7 @@ MDGeometry::getNonIntegratedDimensions() const { std::vector<coord_t> MDGeometry::estimateResolution() const { std::vector<coord_t> out; for (size_t d = 0; d < this->getNumDims(); d++) - out.push_back(this->getDimension(d)->getBinWidth()); + out.emplace_back(this->getDimension(d)->getBinWidth()); return out; } @@ -245,14 +245,14 @@ size_t MDGeometry::getDimensionIndexById(const std::string &id) const { * @param dim :: shared pointer to the dimension object */ void MDGeometry::addDimension( boost::shared_ptr<Mantid::Geometry::IMDDimension> dim) { - m_dimensions.push_back(dim); + m_dimensions.emplace_back(dim); } // -------------------------------------------------------------------------------------------- /** Add a dimension * @param dim :: bare pointer to the dimension object */ void MDGeometry::addDimension(Mantid::Geometry::IMDDimension *dim) { - m_dimensions.push_back( + m_dimensions.emplace_back( boost::shared_ptr<Mantid::Geometry::IMDDimension>(dim)); } diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index a33e9499635bce7701db4c6dcf0860c485bf8df5..569dca09f2286c7b87f074eda1cf9382f71eebc8 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -143,7 +143,7 @@ const Indexing::IndexInfo &MatrixWorkspace::indexInfo() const { if (m_indexInfoNeedsUpdate) { std::vector<Indexing::SpectrumNumber> spectrumNumbers; for (size_t i = 0; i < getNumberHistograms(); ++i) - spectrumNumbers.push_back(getSpectrum(i).getSpectrumNo()); + spectrumNumbers.emplace_back(getSpectrum(i).getSpectrumNo()); m_indexInfo->setSpectrumNumbers(std::move(spectrumNumbers)); m_indexInfoNeedsUpdate = false; } @@ -594,7 +594,7 @@ std::vector<size_t> MatrixWorkspace::getIndicesFromSpectra( while (iter != spectraList.cend()) { for (size_t i = 0; i < this->getNumberHistograms(); ++i) { if (this->getSpectrum(i).getSpectrumNo() == *iter) { - indexList.push_back(i); + indexList.emplace_back(i); break; } } @@ -682,7 +682,7 @@ std::vector<specnum_t> MatrixWorkspace::getSpectraFromDetectorIDs( } if (foundDet) - spectraList.push_back(foundSpecNum); + spectraList.emplace_back(foundSpecNum); } // for each detector ID in the list return spectraList; } @@ -1675,8 +1675,8 @@ std::vector<std::unique_ptr<IMDIterator>> MatrixWorkspace::createIterators( size_t end = ((i + 1) * numElements) / numCores; if (end > numElements) end = numElements; - out.push_back(std::make_unique<MatrixWorkspaceMDIterator>(this, function, - begin, end)); + out.emplace_back(std::make_unique<MatrixWorkspaceMDIterator>(this, function, + begin, end)); } return out; } diff --git a/Framework/API/src/MatrixWorkspaceMDIterator.cpp b/Framework/API/src/MatrixWorkspaceMDIterator.cpp index e46df4d91ce0f326dea4946e2787147bacff08bb..e3a7c3a1e16df23e95798c3b45870575fd18718d 100644 --- a/Framework/API/src/MatrixWorkspaceMDIterator.cpp +++ b/Framework/API/src/MatrixWorkspaceMDIterator.cpp @@ -57,7 +57,7 @@ MatrixWorkspaceMDIterator::MatrixWorkspaceMDIterator( m_max = 0; m_startIndices.reserve(m_endWI - m_beginWI); for (size_t i = m_beginWI; i < m_endWI; ++i) { - m_startIndices.push_back(m_max); + m_startIndices.emplace_back(m_max); m_max += m_ws->readY(i).size(); } diff --git a/Framework/API/src/MultiDomainFunction.cpp b/Framework/API/src/MultiDomainFunction.cpp index 551e96c0c3ee50433632d0bcd4861456943561f5..94d3275930404cc4df4ebaba4f932367280a70b5 100644 --- a/Framework/API/src/MultiDomainFunction.cpp +++ b/Framework/API/src/MultiDomainFunction.cpp @@ -69,10 +69,10 @@ void MultiDomainFunction::countNumberOfDomains() { void MultiDomainFunction::countValueOffsets( const CompositeDomain &domain) const { m_valueOffsets.clear(); - m_valueOffsets.push_back(0); + m_valueOffsets.emplace_back(0); for (size_t i = 0; i < domain.getNParts(); ++i) { const FunctionDomain &d = domain.getDomain(i); - m_valueOffsets.push_back(m_valueOffsets.back() + d.size()); + m_valueOffsets.emplace_back(m_valueOffsets.back() + d.size()); } } diff --git a/Framework/API/src/MultiPeriodGroupWorker.cpp b/Framework/API/src/MultiPeriodGroupWorker.cpp index 71d140757ad59fb340a60db4f0960b4c4d665558..367f58ae4d763790967ba092e3229e0e36095026 100644 --- a/Framework/API/src/MultiPeriodGroupWorker.cpp +++ b/Framework/API/src/MultiPeriodGroupWorker.cpp @@ -43,9 +43,9 @@ void MultiPeriodGroupWorker::tryAddInputWorkspaceToInputGroups( boost::dynamic_pointer_cast<WorkspaceGroup>(ws); if (inputGroup) { if (inputGroup->isMultiperiod()) { - vecMultiPeriodWorkspaceGroups.push_back(inputGroup); + vecMultiPeriodWorkspaceGroups.emplace_back(inputGroup); } else { - vecWorkspaceGroups.push_back(inputGroup); + vecWorkspaceGroups.emplace_back(inputGroup); } } } diff --git a/Framework/API/src/MultipleExperimentInfos.cpp b/Framework/API/src/MultipleExperimentInfos.cpp index 370e9eb70e8b295524e6145c97ab413bc9352d78..d9f5ba25593db5da1f90d6f903208a3ad58b9c6f 100644 --- a/Framework/API/src/MultipleExperimentInfos.cpp +++ b/Framework/API/src/MultipleExperimentInfos.cpp @@ -63,7 +63,7 @@ MultipleExperimentInfos::getExperimentInfo(const uint16_t runIndex) const { * @throw std::runtime_error if you reach the limit of 65536 entries. */ uint16_t MultipleExperimentInfos::addExperimentInfo(ExperimentInfo_sptr ei) { - m_expInfos.push_back(ei); + m_expInfos.emplace_back(ei); if (m_expInfos.size() >= static_cast<size_t>(std::numeric_limits<uint16_t>::max())) throw std::runtime_error("MDWorkspace: Reached the capacity for the number " @@ -101,7 +101,7 @@ void MultipleExperimentInfos::copyExperimentInfos( // Do a deep copy of ExperimentInfo's for (const auto &expInfo : other.m_expInfos) { auto copy(boost::make_shared<ExperimentInfo>(*expInfo)); - m_expInfos.push_back(copy); + m_expInfos.emplace_back(copy); } } diff --git a/Framework/API/src/MultipleFileProperty.cpp b/Framework/API/src/MultipleFileProperty.cpp index 7306ecf7177c0840c306052d33dae5d2b41507df..753bd7f8c1f2fc348bb7a65c059825af95f77afb 100644 --- a/Framework/API/src/MultipleFileProperty.cpp +++ b/Framework/API/src/MultipleFileProperty.cpp @@ -95,7 +95,7 @@ MultipleFileProperty::MultipleFileProperty(const std::string &name, for (const auto &ext : exts) if (doesNotContainWildCard(ext)) - m_exts.push_back(ext); + m_exts.emplace_back(ext); } /** @@ -289,7 +289,7 @@ MultipleFileProperty::setValueAsMultipleFiles(const std::string &propValue) { // so we can see how many we have. std::vector<std::string> plusTokenStrings; for (; plusToken != end; ++plusToken) - plusTokenStrings.push_back(plusToken->str()); + plusTokenStrings.emplace_back(plusToken->str()); for (auto &plusTokenString : plusTokenStrings) { try { @@ -310,7 +310,7 @@ MultipleFileProperty::setValueAsMultipleFiles(const std::string &propValue) { // existing) file within a token, but which has unexpected zero padding, // or some other anomaly. if (VectorHelper::flattenVector(f).empty()) - f.push_back(std::vector<std::string>(1, plusTokenString)); + f.emplace_back(std::vector<std::string>(1, plusTokenString)); if (plusTokenStrings.size() > 1) { // See [3] in header documentation. Basically, for reasons of @@ -322,10 +322,10 @@ MultipleFileProperty::setValueAsMultipleFiles(const std::string &propValue) { "supported."; if (temp.empty()) - temp.push_back(f[0]); + temp.emplace_back(f[0]); else { for (auto &parsedFile : f[0]) - temp[0].push_back(parsedFile); + temp[0].emplace_back(parsedFile); } } else { temp.insert(temp.end(), f.begin(), f.end()); @@ -435,9 +435,9 @@ MultipleFileProperty::setValueAsMultipleFiles(const std::string &propValue) { } // Append the file name to result. - fullFileNames.push_back(std::move(fullyResolvedFile)); + fullFileNames.emplace_back(std::move(fullyResolvedFile)); } - allFullFileNames.push_back(std::move(fullFileNames)); + allFullFileNames.emplace_back(std::move(fullFileNames)); } // Now re-set the value using the full paths found. diff --git a/Framework/API/src/ParamFunction.cpp b/Framework/API/src/ParamFunction.cpp index 69e333d8809d2b7164a366a693e1b3ca6460bec6..3939fb7d05ecf87c37e3628bc01a016574d7e52d 100644 --- a/Framework/API/src/ParamFunction.cpp +++ b/Framework/API/src/ParamFunction.cpp @@ -222,12 +222,12 @@ void ParamFunction::declareParameter(const std::string &name, double initValue, throw std::invalid_argument(msg.str()); } - m_parameterStatus.push_back(Active); - m_parameterNames.push_back(name); - m_parameterDescriptions.push_back(description); - m_parameters.push_back(initValue); - m_errors.push_back(0.0); - m_explicitlySet.push_back(false); + m_parameterStatus.emplace_back(Active); + m_parameterNames.emplace_back(name); + m_parameterDescriptions.emplace_back(description); + m_parameters.emplace_back(initValue); + m_errors.emplace_back(0.0); + m_explicitlySet.emplace_back(false); } /// Nonvirtual member which removes all declared parameters diff --git a/Framework/API/src/SpectrumInfo.cpp b/Framework/API/src/SpectrumInfo.cpp index d7d466f5033b3fd57fa70e3e59f51156673bfdfb..6a7ae3b34b337099fbea6a3420c87e5e5226b0ac 100644 --- a/Framework/API/src/SpectrumInfo.cpp +++ b/Framework/API/src/SpectrumInfo.cpp @@ -184,7 +184,7 @@ const Geometry::IDetector &SpectrumInfo::getDetector(const size_t index) const { std::vector<boost::shared_ptr<const Geometry::IDetector>> det_ptrs; for (const auto &index : specDef) { const auto detIndex = index.first; - det_ptrs.push_back(m_detectorInfo.getDetectorPtr(detIndex)); + det_ptrs.emplace_back(m_detectorInfo.getDetectorPtr(detIndex)); } m_lastDetector[thread] = boost::make_shared<Geometry::DetectorGroup>(det_ptrs); diff --git a/Framework/API/src/TableRow.cpp b/Framework/API/src/TableRow.cpp index 71b094cc70808ebaeec64c8a32cca9357961aa9d..72d5b7afb07c1202b2b57b18e03e999d6829b209 100644 --- a/Framework/API/src/TableRow.cpp +++ b/Framework/API/src/TableRow.cpp @@ -16,7 +16,7 @@ namespace API { TableRow::TableRow(const TableRowHelper &trh) : m_row(trh.m_row), m_col(0), m_sep(",") { for (size_t i = 0; i < trh.m_workspace->columnCount(); i++) - m_columns.push_back(trh.m_workspace->getColumn(i)); + m_columns.emplace_back(trh.m_workspace->getColumn(i)); if (!m_columns.empty()) m_nrows = int(m_columns[0]->size()); else diff --git a/Framework/API/src/WorkspaceGroup.cpp b/Framework/API/src/WorkspaceGroup.cpp index 04206f10cc46c28ec3dc4bbb047da462c23ce869..00a5985ab1bc2c779fbb537c17c06399511cad82 100644 --- a/Framework/API/src/WorkspaceGroup.cpp +++ b/Framework/API/src/WorkspaceGroup.cpp @@ -121,7 +121,7 @@ void WorkspaceGroup::addWorkspace(const Workspace_sptr &workspace) { const auto it = std::find(m_workspaces.begin(), m_workspaces.end(), workspace); if (it == m_workspaces.end()) { - m_workspaces.push_back(workspace); + m_workspaces.emplace_back(workspace); } else { g_log.warning() << "Workspace already exists in a WorkspaceGroup\n"; } diff --git a/Framework/API/test/ADSValidatorTest.h b/Framework/API/test/ADSValidatorTest.h index 578727dcb8becded538f28717a3062e604e10f81..2300185625af8ae2c4341cd3d9a237593056469a 100644 --- a/Framework/API/test/ADSValidatorTest.h +++ b/Framework/API/test/ADSValidatorTest.h @@ -63,9 +63,9 @@ public: ADSValidator adsValidator(false); StringVector sv; - sv.push_back(wsName); + sv.emplace_back(wsName); TS_ASSERT_EQUALS(adsValidator.isValid(sv), ""); - sv.push_back(wsName); + sv.emplace_back(wsName); TS_ASSERT_DIFFERS(adsValidator.isValid(sv), ""); ads.remove(wsName); @@ -85,15 +85,15 @@ public: // all valid options StringVector sv; - sv.push_back(ws1Name); + sv.emplace_back(ws1Name); TS_ASSERT_EQUALS(adsValidator.isValid(sv), ""); - sv.push_back(ws2Name); + sv.emplace_back(ws2Name); TS_ASSERT_EQUALS(adsValidator.isValid(sv), ""); - sv.push_back(ws3Name); + sv.emplace_back(ws3Name); TS_ASSERT_EQUALS(adsValidator.isValid(sv), ""); // invalid ws in string - sv.push_back(wsInvalidName); + sv.emplace_back(wsInvalidName); TS_ASSERT_DIFFERS(adsValidator.isValid(sv), ""); ads.remove(ws1Name); diff --git a/Framework/API/test/AnalysisDataServiceTest.h b/Framework/API/test/AnalysisDataServiceTest.h index 3826e2c8532c16564919642ee18baa9f9e1634e7..c906d5b1b80e80100edec09abbdc208efebedac6 100644 --- a/Framework/API/test/AnalysisDataServiceTest.h +++ b/Framework/API/test/AnalysisDataServiceTest.h @@ -107,7 +107,7 @@ public: "test_all_items_present_2"}; std::vector<Workspace_sptr> expected; for (const auto &name : names) { - expected.push_back(addToADS(name)); + expected.emplace_back(addToADS(name)); } std::vector<Workspace_sptr> items; TS_ASSERT_THROWS_NOTHING(items = ads.retrieveWorkspaces(names)); @@ -122,11 +122,11 @@ public: const std::vector<std::string> names{"test_all_items_present_unroll_1", "test_all_items_present_unroll_2"}; std::vector<Workspace_sptr> expected; - expected.push_back(addToADS(names[0])); + expected.emplace_back(addToADS(names[0])); const size_t nitems{4u}; WorkspaceGroup_sptr groupWS{addGroupToADS(names[1], nitems)}; for (auto i = 0u; i < nitems; ++i) { - expected.push_back(groupWS->getItem(i)); + expected.emplace_back(groupWS->getItem(i)); } std::vector<Workspace_sptr> items; TS_ASSERT_THROWS_NOTHING(items = ads.retrieveWorkspaces(names, true)); diff --git a/Framework/API/test/CompositeFunctionTest.h b/Framework/API/test/CompositeFunctionTest.h index 06224b8c2e98a0a85cada5ca007313580843885e..d325cb2a67ebc9ed2fb4bdf22618b5417672c450 100644 --- a/Framework/API/test/CompositeFunctionTest.h +++ b/Framework/API/test/CompositeFunctionTest.h @@ -38,7 +38,7 @@ public: : m_blocksize(ny) { for (size_t i = 0; i < nspec; ++i) { CompositeFunctionTest_MocSpectrum sp(nx, ny); - m_spectra.push_back(sp); + m_spectra.emplace_back(sp); } } diff --git a/Framework/API/test/ExperimentInfoTest.h b/Framework/API/test/ExperimentInfoTest.h index 3c6126e07efe4ded07609570534fb5d11e787c17..6f2e66911e23a77e5b11d8a97c75f1ae31191462 100644 --- a/Framework/API/test/ExperimentInfoTest.h +++ b/Framework/API/test/ExperimentInfoTest.h @@ -461,7 +461,7 @@ public: std::vector<std::string> formats = {"xml"}; std::vector<std::string> dirs; - dirs.push_back(testDir); + dirs.emplace_back(testDir); std::vector<std::string> fnames = helper.getResourceFilenames( "ARGUS", formats, dirs, "1909-01-31 22:59:59"); TS_ASSERT_DIFFERS(fnames[0].find("TEST1_ValidDateOverlap"), diff --git a/Framework/API/test/FunctionTest.h b/Framework/API/test/FunctionTest.h index fdb172aeb83ed77df24f9c0279c7924c8e69ac52..4383397c8a24314c5b7c3484001f27a2ff8e747c 100644 --- a/Framework/API/test/FunctionTest.h +++ b/Framework/API/test/FunctionTest.h @@ -38,7 +38,7 @@ public: MocMatrixWorkspace(size_t nspec, size_t nx, size_t ny) : m_blocksize(ny) { for (size_t i = 0; i < nspec; ++i) { MocSpectrum sp(nx, ny); - m_spectra.push_back(sp); + m_spectra.emplace_back(sp); } } diff --git a/Framework/API/test/IFunction1DSpectrumTest.h b/Framework/API/test/IFunction1DSpectrumTest.h index ea9b1c5ed5cf7fe7b51d5819c67696f6d80e1ff4..bf71a3cf61ed27b17ca584fb576ff84ddf184dba 100644 --- a/Framework/API/test/IFunction1DSpectrumTest.h +++ b/Framework/API/test/IFunction1DSpectrumTest.h @@ -29,11 +29,11 @@ public: void testFunctionCorrectDomain() { std::vector<double> xValues; - xValues.push_back(1.0); - xValues.push_back(2.0); - xValues.push_back(3.0); - xValues.push_back(4.0); - xValues.push_back(5.0); + xValues.emplace_back(1.0); + xValues.emplace_back(2.0); + xValues.emplace_back(3.0); + xValues.emplace_back(4.0); + xValues.emplace_back(5.0); FunctionDomain1DSpectrum domain(0, xValues); FunctionValues values(domain); @@ -48,11 +48,11 @@ public: void testFunctionIncorrectDomain() { std::vector<double> xValues; - xValues.push_back(1.0); - xValues.push_back(2.0); - xValues.push_back(3.0); - xValues.push_back(4.0); - xValues.push_back(5.0); + xValues.emplace_back(1.0); + xValues.emplace_back(2.0); + xValues.emplace_back(3.0); + xValues.emplace_back(4.0); + xValues.emplace_back(5.0); FunctionDomain1DVector domain(xValues); FunctionValues values(domain); diff --git a/Framework/API/test/InstrumentDataServiceTest.h b/Framework/API/test/InstrumentDataServiceTest.h index 8ea7156d885ac436308e7df4165b6ab11d43076a..5c9a41fb78edbbf208479cc4237568822bdc740b 100644 --- a/Framework/API/test/InstrumentDataServiceTest.h +++ b/Framework/API/test/InstrumentDataServiceTest.h @@ -106,8 +106,8 @@ public: void testGetObjectNames() { InstrumentDataService::Instance().add("inst2", inst2); std::vector<std::string> names; - names.push_back("inst1"); - names.push_back("inst2"); + names.emplace_back("inst1"); + names.emplace_back("inst2"); auto result = InstrumentDataService::Instance().getObjectNames(); TS_ASSERT_EQUALS(result, names); // Check with an empty store diff --git a/Framework/API/test/LogFilterGeneratorTest.h b/Framework/API/test/LogFilterGeneratorTest.h index 71f79987b9464c4976580e4358ba06ed10a8ede8..0cd05a564802f2c1b289a2588144cdb9931f772b 100644 --- a/Framework/API/test/LogFilterGeneratorTest.h +++ b/Framework/API/test/LogFilterGeneratorTest.h @@ -155,8 +155,8 @@ private: constexpr double incrementSecs(10.0); for (size_t i = 0; i < logSize; ++i) { const double val = static_cast<double>(i); - times.push_back(initialTime + val * incrementSecs); - values.push_back(val); + times.emplace_back(initialTime + val * incrementSecs); + values.emplace_back(val); } log->addValues(times, values); ws->mutableRun().addLogData(std::move(log)); diff --git a/Framework/API/test/MDGeometryTest.h b/Framework/API/test/MDGeometryTest.h index 02ff1ca72ac04bf755f74c1dae36560778b61e9d..c8cc963c9b3bbae9a4ac1a7355b122e75b1ef3f3 100644 --- a/Framework/API/test/MDGeometryTest.h +++ b/Framework/API/test/MDGeometryTest.h @@ -37,8 +37,8 @@ public: const Mantid::Geometry::QSample frame; IMDDimension_sptr dim1(new MDHistoDimension("Qx", "Qx", frame, -1, +1, 10)); IMDDimension_sptr dim2(new MDHistoDimension("Qy", "Qy", frame, -1, +1, 20)); - dims.push_back(dim1); - dims.push_back(dim2); + dims.emplace_back(dim1); + dims.emplace_back(dim2); g.initGeometry(dims); TS_ASSERT_EQUALS(g.getNumDims(), 2); @@ -98,8 +98,8 @@ public: const Mantid::Geometry::QSample frame; IMDDimension_sptr dim0(new MDHistoDimension("Qx", "Qx", frame, -1, +1, 0)); IMDDimension_sptr dim1(new MDHistoDimension("Qy", "Qy", frame, -1, +1, 0)); - dims.push_back(dim0); - dims.push_back(dim1); + dims.emplace_back(dim0); + dims.emplace_back(dim1); g.initGeometry(dims); g.setBasisVector(0, VMD(1.2, 3.4)); g.setBasisVector(1, VMD(1.2, 3.4)); @@ -197,7 +197,7 @@ public: TS_ASSERT_DELTA(g.getDimension(1)->getMaximum(), +5., 1e-4); // Bad size throws - scaling.push_back(123); + scaling.emplace_back(123); TS_ASSERT_THROWS_ANYTHING(g.transformDimensions(scaling, offset)); } @@ -285,8 +285,8 @@ public: const Mantid::Geometry::QSample frame; IMDDimension_sptr dim1(new MDHistoDimension("Qx", "Qx", frame, -1, +1, 10)); IMDDimension_sptr dim2(new MDHistoDimension("Qy", "Qy", frame, -1, +1, 20)); - dims.push_back(dim1); - dims.push_back(dim2); + dims.emplace_back(dim1); + dims.emplace_back(dim2); geometry.initGeometry(dims); // Both basis vectors are not normalized diff --git a/Framework/API/test/MatrixWorkspaceTest.h b/Framework/API/test/MatrixWorkspaceTest.h index 2bc0ca9fa06977efffe9cdd1b061889acd456f6d..7997ea3f25a09f45a5f59dc16762199ff772ce3d 100644 --- a/Framework/API/test/MatrixWorkspaceTest.h +++ b/Framework/API/test/MatrixWorkspaceTest.h @@ -447,9 +447,9 @@ public: for (size_t i = 0; i < 10; i++) ws.getSpectrum(i).setDetectorID(detid_t(i * 10)); std::vector<detid_t> dets; - dets.push_back(60); - dets.push_back(20); - dets.push_back(90); + dets.emplace_back(60); + dets.emplace_back(20); + dets.emplace_back(90); std::vector<size_t> indices = ws.getIndicesFromDetectorIDs(dets); TS_ASSERT_EQUALS(indices.size(), 3); TS_ASSERT_EQUALS(indices[0], 6); diff --git a/Framework/API/test/MultiDomainFunctionTest.h b/Framework/API/test/MultiDomainFunctionTest.h index f45dd819125051ce73af17a3ef3610bf1f3ca775..239b97ddac605b6f327251798668478dda920a24 100644 --- a/Framework/API/test/MultiDomainFunctionTest.h +++ b/Framework/API/test/MultiDomainFunctionTest.h @@ -127,12 +127,12 @@ public: // multi.setDomainIndex(2,2); // std::vector<size_t> ii; - // ii.push_back(0); - // ii.push_back(1); + // ii.emplace_back(0); + // ii.emplace_back(1); // multi.setDomainIndices(1,ii); // ii.clear(); - // ii.push_back(0); - // ii.push_back(2); + // ii.emplace_back(0); + // ii.emplace_back(2); // multi.setDomainIndices(2,ii); FunctionValues values(domain); @@ -244,12 +244,12 @@ public: void test_calc() { multi.setDomainIndex(0, 0); std::vector<size_t> ii; - ii.push_back(0); - ii.push_back(1); + ii.emplace_back(0); + ii.emplace_back(1); multi.setDomainIndices(1, ii); ii.clear(); - ii.push_back(0); - ii.push_back(2); + ii.emplace_back(0); + ii.emplace_back(2); multi.setDomainIndices(2, ii); FunctionValues values(domain); diff --git a/Framework/API/test/NotebookBuilderTest.h b/Framework/API/test/NotebookBuilderTest.h index c4d93f7e9c73ef089b098696638efbbd5d07ba83..eadac1881d657083f6d4d13892e63732176cff16 100644 --- a/Framework/API/test/NotebookBuilderTest.h +++ b/Framework/API/test/NotebookBuilderTest.h @@ -205,7 +205,7 @@ public: std::string line; std::istringstream buffer(notebookText); while (std::getline(buffer, line)) - notebookLines.push_back(line); + notebookLines.emplace_back(line); // Check that the expected line does appear in the output TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(), result) != @@ -246,7 +246,7 @@ public: std::string line; std::istringstream buffer(notebookText); while (std::getline(buffer, line)) - notebookLines.push_back(line); + notebookLines.emplace_back(line); // Check that the expected lines do appear in the output TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(), @@ -298,7 +298,7 @@ public: std::string line; std::istringstream buffer(notebookText); while (std::getline(buffer, line)) - notebookLines.push_back(line); + notebookLines.emplace_back(line); // Check that the expected lines do appear in the output TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(), @@ -341,7 +341,7 @@ public: std::string line; std::istringstream buffer(notebookText); while (std::getline(buffer, line)) - notebookLines.push_back(line); + notebookLines.emplace_back(line); // Check that the expected line does appear in the output TS_ASSERT(std::find(notebookLines.cbegin(), notebookLines.cend(), result) != diff --git a/Framework/API/test/RunTest.h b/Framework/API/test/RunTest.h index 5032d5a00698a42bab54808bd96eeafa957f68e3..8522c39a36d7411d0245875fd0f1cc1afa2d67ec 100644 --- a/Framework/API/test/RunTest.h +++ b/Framework/API/test/RunTest.h @@ -283,10 +283,10 @@ public: std::vector<double> bins; TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), const std::invalid_argument &); - bins.push_back(0.5); + bins.emplace_back(0.5); TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), const std::invalid_argument &); - bins.push_back(1.5); + bins.emplace_back(1.5); TS_ASSERT_THROWS_NOTHING(runInfo.storeHistogramBinBoundaries(bins)); } diff --git a/Framework/API/test/SpectrumDetectorMappingTest.h b/Framework/API/test/SpectrumDetectorMappingTest.h index 161212ac9ec9f1fb8fcfb34b7ec3a5ceded52fff..18a918d1605ffb97ce9203bb8503c9d05948c0c2 100644 --- a/Framework/API/test/SpectrumDetectorMappingTest.h +++ b/Framework/API/test/SpectrumDetectorMappingTest.h @@ -80,12 +80,12 @@ public: // Now fill the vectors and test again for (int i = 1; i < 4; ++i) { - specs.push_back(i); - detids.push_back(i * 10); + specs.emplace_back(i); + detids.emplace_back(i * 10); } // Add a second entry to one - specs.push_back(2); - detids.push_back(99); + specs.emplace_back(2); + detids.emplace_back(99); SpectrumDetectorMapping map2(specs, detids); check_the_map(map2); diff --git a/Framework/API/test/WorkspaceFactoryTest.h b/Framework/API/test/WorkspaceFactoryTest.h index 5bf6bb37c2fa990f75489200796db39fcf5df626..e6401e2bd6f8ed2caf46f1a62291a578bc4f3af6 100644 --- a/Framework/API/test/WorkspaceFactoryTest.h +++ b/Framework/API/test/WorkspaceFactoryTest.h @@ -36,9 +36,9 @@ class WorkspaceFactoryTest : public CxxTest::TestSuite { void init(const size_t &NVectors, const size_t &XLength, const size_t &YLength) override { - size.push_back(NVectors); - size.push_back(XLength); - size.push_back(YLength); + size.emplace_back(NVectors); + size.emplace_back(XLength); + size.emplace_back(YLength); WorkspaceTester::init(NVectors, XLength, YLength); } using WorkspaceTester::init; diff --git a/Framework/API/test/WorkspaceNearestNeighboursTest.h b/Framework/API/test/WorkspaceNearestNeighboursTest.h index d25f9f54995d1c910e233c90a02d286397b0a3a1..c8447ad66ef256414bbf44948fd931b2bf2d4352 100644 --- a/Framework/API/test/WorkspaceNearestNeighboursTest.h +++ b/Framework/API/test/WorkspaceNearestNeighboursTest.h @@ -44,7 +44,7 @@ boost::shared_ptr<MatrixWorkspace> makeWorkspace(const specnum_t start, std::vector<specnum_t> getSpectrumNumbers(const MatrixWorkspace &workspace) { std::vector<specnum_t> spectrumNumbers; for (size_t i = 0; i < workspace.getNumberHistograms(); ++i) - spectrumNumbers.push_back(workspace.getSpectrum(i).getSpectrumNo()); + spectrumNumbers.emplace_back(workspace.getSpectrum(i).getSpectrumNo()); return spectrumNumbers; } } // namespace diff --git a/Framework/Algorithms/src/AddLogDerivative.cpp b/Framework/Algorithms/src/AddLogDerivative.cpp index eb6b27424746cd7687706763e89fba3a73e60c9c..5e03eebe96e4819433fdca7fa294098ba7687bbd 100644 --- a/Framework/Algorithms/src/AddLogDerivative.cpp +++ b/Framework/Algorithms/src/AddLogDerivative.cpp @@ -81,8 +81,8 @@ Mantid::Kernel::TimeSeriesProperty<double> *AddLogDerivative::makeDerivative( // Avoid repeated time values giving infinite derivatives double dy = (y1 - y0) / (t1 - t0); double t = (t0 + t1) / 2.0; - dVal.push_back(dy); - dTime.push_back(t); + dVal.emplace_back(dy); + dTime.emplace_back(t); // For the next time interval t0 = t1; y0 = y1; diff --git a/Framework/Algorithms/src/AddSampleLog.cpp b/Framework/Algorithms/src/AddSampleLog.cpp index 507ddf8f984d0a2297965a1170961d605abd9236..727e6216251b7ed974f310f9a5f0dcc71263c0cf 100644 --- a/Framework/Algorithms/src/AddSampleLog.cpp +++ b/Framework/Algorithms/src/AddSampleLog.cpp @@ -51,18 +51,18 @@ void AddSampleLog::init() { declareProperty("LogText", "", "The content of the log"); std::vector<std::string> propOptions; - propOptions.push_back(stringLogOption); - propOptions.push_back(numberLogOption); - propOptions.push_back(numberSeriesLogOption); + propOptions.emplace_back(stringLogOption); + propOptions.emplace_back(numberLogOption); + propOptions.emplace_back(numberSeriesLogOption); declareProperty("LogType", stringLogOption, boost::make_shared<StringListValidator>(propOptions), "The type that the log data will be."); declareProperty("LogUnit", "", "The units of the log"); std::vector<std::string> typeOptions; - typeOptions.push_back(intTypeOption); - typeOptions.push_back(doubleTypeOption); - typeOptions.push_back(autoTypeOption); + typeOptions.emplace_back(intTypeOption); + typeOptions.emplace_back(doubleTypeOption); + typeOptions.emplace_back(autoTypeOption); declareProperty("NumberType", autoTypeOption, boost::make_shared<StringListValidator>(typeOptions), "Force LogText to be interpreted as a number of type 'int' " @@ -389,7 +389,7 @@ AddSampleLog::getTimes(API::MatrixWorkspace_const_sptr dataws, timedbl *= 1.E9; auto entry_i64 = static_cast<int64_t>(timedbl); Types::Core::DateAndTime entry(timeshift + entry_i64); - timevec.push_back(entry); + timevec.emplace_back(entry); } return timevec; @@ -426,7 +426,7 @@ AddSampleLog::getDblValues(API::MatrixWorkspace_const_sptr dataws, std::vector<double> valuevec; size_t vecsize = dataws->readY(workspace_index).size(); for (size_t i = 0; i < vecsize; ++i) - valuevec.push_back(dataws->readY(workspace_index)[i]); + valuevec.emplace_back(dataws->readY(workspace_index)[i]); return valuevec; } @@ -444,7 +444,7 @@ AddSampleLog::getIntValues(API::MatrixWorkspace_const_sptr dataws, std::vector<int> valuevec; size_t vecsize = dataws->readY(workspace_index).size(); for (size_t i = 0; i < vecsize; ++i) - valuevec.push_back(static_cast<int>(dataws->readY(workspace_index)[i])); + valuevec.emplace_back(static_cast<int>(dataws->readY(workspace_index)[i])); return valuevec; } diff --git a/Framework/Algorithms/src/AverageLogData.cpp b/Framework/Algorithms/src/AverageLogData.cpp index 1b7fcccb12a80eb78eda1958aeab3ad9941b2232..f080ecaed12cfc610f8bcfcc0853a60efa65724e 100644 --- a/Framework/Algorithms/src/AverageLogData.cpp +++ b/Framework/Algorithms/src/AverageLogData.cpp @@ -96,10 +96,10 @@ void AverageLogData::exec() { std::vector<double> pctime = pclog->timesAsVectorSeconds(); std::vector<double> pcvalue = pclog->valuesAsVector(); - stime.push_back(EMPTY_DBL()); - svalue.push_back(0.0); - pctime.push_back(EMPTY_DBL() * 1.1); // larger than stime - pcvalue.push_back(0.0); + stime.emplace_back(EMPTY_DBL()); + svalue.emplace_back(0.0); + pctime.emplace_back(EMPTY_DBL() * 1.1); // larger than stime + pcvalue.emplace_back(0.0); auto isvalue = svalue.begin(), ipctime = pctime.begin(), ipcvalue = pcvalue.begin(); diff --git a/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp b/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp index 2dc486eb16ef673470f0eefb72c4216f3a63ad04..cd1db4c3ed8556a39714f8068621e55ceacae015 100644 --- a/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp +++ b/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp @@ -316,27 +316,27 @@ void Bin2DPowderDiffraction::ReadBinsFromFile( n = line.find("dp ="); if (n != std::string::npos) { if (!tmp.empty()) { - Xbins.push_back(tmp); + Xbins.emplace_back(tmp); tmp.clear(); } double dp1 = std::stod(line.substr(4), &sz); // 4 is needed to crop 'dp=' double dp2 = std::stod(line.substr(sz + 4)); if (dpno < 1) { - Ybins.push_back(dp1); - Ybins.push_back(dp2); + Ybins.emplace_back(dp1); + Ybins.emplace_back(dp2); } else { - Ybins.push_back(dp2); + Ybins.emplace_back(dp2); } dpno++; } else if (line.find("#") == std::string::npos) { std::stringstream ss(line); double d; while (ss >> d) { - tmp.push_back(d); + tmp.emplace_back(d); } } } - Xbins.push_back(tmp); + Xbins.emplace_back(tmp); g_log.information() << "Number of Ybins: " << Ybins.size() << std::endl; g_log.information() << "Number of Xbins sets: " << Xbins.size() << std::endl; } diff --git a/Framework/Algorithms/src/CalculateEfficiency.cpp b/Framework/Algorithms/src/CalculateEfficiency.cpp index 1fb6f95cc2335ec0b7df9f9b659c41fac43444ce..9a3797238060bc5273d2e9b939ce019b73f1fa3c 100644 --- a/Framework/Algorithms/src/CalculateEfficiency.cpp +++ b/Framework/Algorithms/src/CalculateEfficiency.cpp @@ -242,9 +242,9 @@ void CalculateEfficiency::normalizeDetectors(MatrixWorkspace_sptr rebinnedWS, // Mask this detector if the signal is outside the acceptable band if (!isEmpty(min_eff) && YOut[0] < min_eff) - dets_to_mask.push_back(i); + dets_to_mask.emplace_back(i); if (!isEmpty(max_eff) && YOut[0] > max_eff) - dets_to_mask.push_back(i); + dets_to_mask.emplace_back(i); } g_log.debug() << "normalizeDetectors: Masked pixels outside the acceptable " @@ -312,7 +312,7 @@ void CalculateEfficiency::maskComponent(MatrixWorkspace &ws, boost::dynamic_pointer_cast<Geometry::Detector>((*xColumn)[y]); if (detector) { auto detID = detector->getID(); - detectorList.push_back(detID); + detectorList.emplace_back(detID); } } } @@ -365,13 +365,13 @@ void CalculateEfficiency::maskEdges(MatrixWorkspace_sptr ws, int left, int i = 0; while (i < left * component->idstep()) { - IDs.push_back(component->idstart() + i); + IDs.emplace_back(component->idstart() + i); i += 1; } // right i = component->maxDetectorID() - right * component->idstep(); while (i < component->maxDetectorID()) { - IDs.push_back(i); + IDs.emplace_back(i); i += 1; } // low: 0,256,512,768,..,1,257,513 @@ -379,7 +379,7 @@ void CalculateEfficiency::maskEdges(MatrixWorkspace_sptr ws, int left, i = row + component->idstart(); while (i < component->nelements() * component->idstep() - component->idstep() + low + component->idstart()) { - IDs.push_back(i); + IDs.emplace_back(i); i += component->idstep(); } } @@ -388,7 +388,7 @@ void CalculateEfficiency::maskEdges(MatrixWorkspace_sptr ws, int left, i = component->idstep() + component->idstart() - row - 1; while (i < component->nelements() * component->idstep() + component->idstart()) { - IDs.push_back(i); + IDs.emplace_back(i); i += component->idstep(); } } diff --git a/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp b/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp index 5b2af2463782d120efb19be651fa6e9102ac1cce..90fca6e0e4147c29efbb062c95283fa2cee65a0a 100644 --- a/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp +++ b/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp @@ -111,14 +111,14 @@ void CalculatePlaczekSelfScattering::exec() { double dx = (xLambda[1] - xLambda[0]) / 2.0; std::vector<double> phi1; for (size_t i = 0; i < xLambda.size() - 1; i++) { - phi1.push_back((xLambda[i] + dx) * incidentPrime[i] / incident[i]); + phi1.emplace_back((xLambda[i] + dx) * incidentPrime[i] / incident[i]); } // set detector law term (eps1) std::vector<double> eps1; constexpr auto LambdaD = 1.44; for (size_t i = 0; i < xLambda.size() - 1; i++) { auto xTerm = -(xLambda[i] + dx) / LambdaD; - eps1.push_back(xTerm * exp(xTerm) / (1.0 - exp(xTerm))); + eps1.emplace_back(xTerm * exp(xTerm) / (1.0 - exp(xTerm))); } /* Placzek Original Placzek inelastic correction Ref (for constant wavelength, reactor diff --git a/Framework/Algorithms/src/CalculateTransmission.cpp b/Framework/Algorithms/src/CalculateTransmission.cpp index 09fb5e28d74e84a90a53298818a6abca1cc8d2a7..03ae985212d38f3a58aaf2e2f8f0c34fa4838b9e 100644 --- a/Framework/Algorithms/src/CalculateTransmission.cpp +++ b/Framework/Algorithms/src/CalculateTransmission.cpp @@ -166,7 +166,7 @@ void CalculateTransmission::exec() { if (usingMonitor) { const size_t transmissionMonitorIndex = getIndexFromDetectorID(*sampleWS, transMonitorID); - transmissionIndices.push_back(transmissionMonitorIndex); + transmissionIndices.emplace_back(transmissionMonitorIndex); logIfNotMonitor(sampleWS, directWS, transmissionMonitorIndex); } else if (usingROI) { transmissionIndices = sampleWS->getIndicesFromDetectorIDs(transDetList); diff --git a/Framework/Algorithms/src/ChopData.cpp b/Framework/Algorithms/src/ChopData.cpp index be410c25a1cd347b98aa522b0219861698ed17e1..bea4e4232290f58d3fc9fc85046fde2fc0efe2f7 100644 --- a/Framework/Algorithms/src/ChopData.cpp +++ b/Framework/Algorithms/src/ChopData.cpp @@ -169,7 +169,7 @@ void ChopData::exec() { setProperty(wsname, workspace); ++wsCounter; - workspaces.push_back(workspace); + workspaces.emplace_back(workspace); progress->report(); } diff --git a/Framework/Algorithms/src/CompareWorkspaces.cpp b/Framework/Algorithms/src/CompareWorkspaces.cpp index 76a6a21ecba0be4cc823ef33a8f573db40c95a9d..e8a4d192daa18b83cffa0d7ec4cba5c963a55044 100644 --- a/Framework/Algorithms/src/CompareWorkspaces.cpp +++ b/Framework/Algorithms/src/CompareWorkspaces.cpp @@ -281,7 +281,7 @@ void CompareWorkspaces::processGroups( // Skip those not set and the input workspaces if (p->isDefault() || propName == "Workspace1" || propName == "Workspace2") continue; - nonDefaultProps.push_back(p); + nonDefaultProps.emplace_back(p); } const size_t numNonDefault = nonDefaultProps.size(); @@ -558,7 +558,7 @@ bool CompareWorkspaces::compareEventWorkspaces( numUnequalWeights += tempNumWeight; } - vec_mismatchedwsindex.push_back(i); + vec_mismatchedwsindex.emplace_back(i); } // Parallel critical region } // If elist 1 is not equal to elist 2 diff --git a/Framework/Algorithms/src/ConjoinXRuns.cpp b/Framework/Algorithms/src/ConjoinXRuns.cpp index edd1cc4c50559eb73898f3535f45a197504c409d..feeacc4f71c10526000b0e3e48a36b1081871b3b 100644 --- a/Framework/Algorithms/src/ConjoinXRuns.cpp +++ b/Framework/Algorithms/src/ConjoinXRuns.cpp @@ -272,7 +272,7 @@ std::vector<double> ConjoinXRuns::getXAxis(MatrixWorkspace_sptr ws) const { axis = std::vector<double>(intAxis.begin(), intAxis.end()); } else { // then scalar - axis.push_back(run.getPropertyAsSingleValue(m_logEntry)); + axis.emplace_back(run.getPropertyAsSingleValue(m_logEntry)); } } @@ -364,7 +364,7 @@ void ConjoinXRuns::exec() { for (const auto &input : RunCombinationHelper::unWrapGroups(inputs_given)) { MatrixWorkspace_sptr ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(input); - m_inputWS.push_back(ws); + m_inputWS.emplace_back(ws); } auto first = m_inputWS.front(); diff --git a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp index cdefd9ac074455772fca784d9c52c0e67e6cf248..620f196abee40410a68b68fea39273df70f63271 100644 --- a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp +++ b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp @@ -306,7 +306,7 @@ void ConvertAxesToRealSpace::fillUnitMap( std::map<std::string, std::string> &unitMap, const std::string &caption, const std::string &unit) { unitMap.emplace(caption, unit); - orderedVector.push_back(caption); + orderedVector.emplace_back(caption); } } // namespace Algorithms diff --git a/Framework/Algorithms/src/ConvertAxisByFormula.cpp b/Framework/Algorithms/src/ConvertAxisByFormula.cpp index 7969d10683cc42ccff8a19af2c0e36ea4d524c07..47357e3d7ee2f700a2636ada59598f3f7bbd6609 100644 --- a/Framework/Algorithms/src/ConvertAxisByFormula.cpp +++ b/Framework/Algorithms/src/ConvertAxisByFormula.cpp @@ -120,15 +120,15 @@ void ConvertAxisByFormula::exec() { std::vector<Variable_ptr> variables; variables.reserve(8); // axis value lookups - variables.push_back(boost::make_shared<Variable>("x", false)); - variables.push_back(boost::make_shared<Variable>("X", false)); - variables.push_back(boost::make_shared<Variable>("y", false)); - variables.push_back(boost::make_shared<Variable>("Y", false)); + variables.emplace_back(boost::make_shared<Variable>("x", false)); + variables.emplace_back(boost::make_shared<Variable>("X", false)); + variables.emplace_back(boost::make_shared<Variable>("y", false)); + variables.emplace_back(boost::make_shared<Variable>("Y", false)); // geometry lookups - variables.push_back(boost::make_shared<Variable>("twotheta", true)); - variables.push_back(boost::make_shared<Variable>("signedtwotheta", true)); - variables.push_back(boost::make_shared<Variable>("l1", true)); - variables.push_back(boost::make_shared<Variable>("l2", true)); + variables.emplace_back(boost::make_shared<Variable>("twotheta", true)); + variables.emplace_back(boost::make_shared<Variable>("signedtwotheta", true)); + variables.emplace_back(boost::make_shared<Variable>("l1", true)); + variables.emplace_back(boost::make_shared<Variable>("l2", true)); bool isGeometryRequired = false; for (auto variablesIter = variables.begin(); diff --git a/Framework/Algorithms/src/ConvertEmptyToTof.cpp b/Framework/Algorithms/src/ConvertEmptyToTof.cpp index f179bb74a71dacdb15a10deb8b64a63c76132b10..ea219764331718fb452442e22f8185ac5a6914f5 100644 --- a/Framework/Algorithms/src/ConvertEmptyToTof.cpp +++ b/Framework/Algorithms/src/ConvertEmptyToTof.cpp @@ -434,10 +434,10 @@ ConvertEmptyToTof::findAverageEppAndEpTof(const std::map<int, int> &eppMap) { firstL2 = l2; } - epTofList.push_back( + epTofList.emplace_back( (calculateTOF(l1, wavelength) + calculateTOF(l2, wavelength)) * 1e6); // microsecs - eppList.push_back(epp.first); + eppList.emplace_back(epp.first); g_log.debug() << "WS index = " << epp.first << ", l1 = " << l1 << ", l2 = " << l2 diff --git a/Framework/Algorithms/src/CreateDetectorTable.cpp b/Framework/Algorithms/src/CreateDetectorTable.cpp index dc246418cf2922a36056264194c90725aa512614..d0321409ab96455f3d456d325812e833dd332a88 100644 --- a/Framework/Algorithms/src/CreateDetectorTable.cpp +++ b/Framework/Algorithms/src/CreateDetectorTable.cpp @@ -184,23 +184,23 @@ createDetectorTableWorkspace(const MatrixWorkspace_sptr &ws, std::vector<std::pair<std::string, std::string>> createColumns(const bool isScanning, const bool includeData, const bool calcQ) { std::vector<std::pair<std::string, std::string>> colNames; - colNames.push_back(std::make_pair("double", "Index")); - colNames.push_back(std::make_pair("int", "Spectrum No")); - colNames.push_back(std::make_pair("str", "Detector ID(s)")); + colNames.emplace_back(std::make_pair("double", "Index")); + colNames.emplace_back(std::make_pair("int", "Spectrum No")); + colNames.emplace_back(std::make_pair("str", "Detector ID(s)")); if (isScanning) - colNames.push_back(std::make_pair("str", "Time Indexes")); + colNames.emplace_back(std::make_pair("str", "Time Indexes")); if (includeData) { - colNames.push_back(std::make_pair("double", "Data Value")); - colNames.push_back(std::make_pair("double", "Data Error")); + colNames.emplace_back(std::make_pair("double", "Data Value")); + colNames.emplace_back(std::make_pair("double", "Data Error")); } - colNames.push_back(std::make_pair("double", "R")); - colNames.push_back(std::make_pair("double", "Theta")); + colNames.emplace_back(std::make_pair("double", "R")); + colNames.emplace_back(std::make_pair("double", "Theta")); if (calcQ) { - colNames.push_back(std::make_pair("double", "Q")); + colNames.emplace_back(std::make_pair("double", "Q")); } - colNames.push_back(std::make_pair("double", "Phi")); - colNames.push_back(std::make_pair("str", "Monitor")); + colNames.emplace_back(std::make_pair("double", "Phi")); + colNames.emplace_back(std::make_pair("str", "Monitor")); return colNames; } diff --git a/Framework/Algorithms/src/CreateFloodWorkspace.cpp b/Framework/Algorithms/src/CreateFloodWorkspace.cpp index 5e6041a4335977ec93853b2c20a4f8e50a03305e..5f48e1a79aad0b359f14b230f98ea870f6f6403d 100644 --- a/Framework/Algorithms/src/CreateFloodWorkspace.cpp +++ b/Framework/Algorithms/src/CreateFloodWorkspace.cpp @@ -180,20 +180,20 @@ CreateFloodWorkspace::removeBackground(API::MatrixWorkspace_sptr ws) { if (isDefault(Prop::START_X)) { startX = x.front(); } else { - excludeFromFit.push_back(x.front()); - excludeFromFit.push_back(startX); + excludeFromFit.emplace_back(x.front()); + excludeFromFit.emplace_back(startX); } if (isDefault(Prop::END_X)) { endX = x.back(); } else { - excludeFromFit.push_back(endX); - excludeFromFit.push_back(x.back()); + excludeFromFit.emplace_back(endX); + excludeFromFit.emplace_back(x.back()); } // Exclude any bad detectors. for (auto i : m_excludedSpectra) { - excludeFromFit.push_back(i); - excludeFromFit.push_back(i); + excludeFromFit.emplace_back(i); + excludeFromFit.emplace_back(i); } std::string const function = getBackgroundFunction(); diff --git a/Framework/Algorithms/src/CreatePSDBleedMask.cpp b/Framework/Algorithms/src/CreatePSDBleedMask.cpp index ae5a93ab0cc6be7dac0cfa4b3ce9b8ca3845697e..8ec154c6d932feba18f56e7f05990cdbeb7adef6 100644 --- a/Framework/Algorithms/src/CreatePSDBleedMask.cpp +++ b/Framework/Algorithms/src/CreatePSDBleedMask.cpp @@ -137,7 +137,7 @@ void CreatePSDBleedMask::exec() { Geometry::ComponentID parentID = parent->getComponentID(); // Already have this component if (tubeMap.find(parentID) != tubeMap.end()) { - tubeMap[parentID].push_back(i); + tubeMap[parentID].emplace_back(i); } // New tube else { diff --git a/Framework/Algorithms/src/CreateSampleWorkspace.cpp b/Framework/Algorithms/src/CreateSampleWorkspace.cpp index 13689d82fde47e40ca88d32ba64d35a80ba8ea91..ea473d62aa0ca2e8a1b9abf184479ae18f5bc1d8 100644 --- a/Framework/Algorithms/src/CreateSampleWorkspace.cpp +++ b/Framework/Algorithms/src/CreateSampleWorkspace.cpp @@ -337,8 +337,8 @@ MatrixWorkspace_sptr CreateSampleWorkspace::createScanningWorkspace( auto angles = std::vector<double>(); auto timeRanges = std::vector<double>(); for (int i = 0; i < numScanPoints; ++i) { - angles.push_back(double(i)); - timeRanges.push_back(double(i + 1)); + angles.emplace_back(double(i)); + timeRanges.emplace_back(double(i + 1)); } builder.setTimeRanges(Types::Core::DateAndTime(0), timeRanges); diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp index 5a733b633a937c30b374f8a6539c67b078b29dc0..f1a74ee83f2418258d141cf684952fcc9de82c4c 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp @@ -43,8 +43,8 @@ const std::string CreateTransmissionWorkspaceAuto::summary() const { void CreateTransmissionWorkspaceAuto::init() { std::vector<std::string> analysis_modes; - analysis_modes.push_back("PointDetectorAnalysis"); - analysis_modes.push_back("MultiDetectorAnalysis"); + analysis_modes.emplace_back("PointDetectorAnalysis"); + analysis_modes.emplace_back("MultiDetectorAnalysis"); declareProperty("AnalysisMode", analysis_modes.at(0), boost::make_shared<StringListValidator>(analysis_modes), "Analysis Mode to Choose", Direction::Input); diff --git a/Framework/Algorithms/src/CreateUserDefinedBackground.cpp b/Framework/Algorithms/src/CreateUserDefinedBackground.cpp index 481bdf4c6bac52b7b1caf5ea5c5403bbfc14f751..b558847050d0153abf5e9fe9466795c542d85e4f 100644 --- a/Framework/Algorithms/src/CreateUserDefinedBackground.cpp +++ b/Framework/Algorithms/src/CreateUserDefinedBackground.cpp @@ -107,7 +107,7 @@ void CreateUserDefinedBackground::cleanUpTable( if (!isZero(x)) { break; } else if (isZero(y)) { - blankRows.push_back(i); + blankRows.emplace_back(i); } } for (const auto &row : blankRows) { @@ -168,7 +168,7 @@ CreateUserDefinedBackground::createBackgroundWorkspace( const auto &lerp = getInterpolator(background, data); for (const auto &x : xPoints) { const double y = lerp.value(x); - yBackground.push_back(y); + yBackground.emplace_back(y); } auto histogram = outputWS->histogram(0); diff --git a/Framework/Algorithms/src/DetectorDiagnostic.cpp b/Framework/Algorithms/src/DetectorDiagnostic.cpp index bbfbc29dffc0907545e3a93866dd4d9fa40b6817..19e0a0932ece80ebe0095458488cfff811bc21eb 100644 --- a/Framework/Algorithms/src/DetectorDiagnostic.cpp +++ b/Framework/Algorithms/src/DetectorDiagnostic.cpp @@ -587,9 +587,9 @@ DetectorDiagnostic::makeMap(API::MatrixWorkspace_sptr countsWS) { // Iterate over all map elements with key == theKey std::vector<size_t> speclistsingle; for (s_it = keyRange.first; s_it != keyRange.second; ++s_it) { - speclistsingle.push_back(s_it->second); + speclistsingle.emplace_back(s_it->second); } - speclist.push_back(std::move(speclistsingle)); + speclist.emplace_back(std::move(speclistsingle)); } return speclist; @@ -649,7 +649,7 @@ std::vector<double> DetectorDiagnostic::calculateMedian( } // Now we have a good value PARALLEL_CRITICAL(DetectorDiagnostic_median_d) { - medianInput.push_back(yValue); + medianInput.emplace_back(yValue); } PARALLEL_END_INTERUPT_REGION @@ -659,7 +659,7 @@ std::vector<double> DetectorDiagnostic::calculateMedian( if (medianInput.empty()) { g_log.information( "some group has no valid histograms. Will use 0 for median."); - medianInput.push_back(0.); + medianInput.emplace_back(0.); } Kernel::Statistics stats = @@ -670,7 +670,7 @@ std::vector<double> DetectorDiagnostic::calculateMedian( throw std::out_of_range("The calculated value for the median was either " "negative or unreliably large"); } - medianvec.push_back(median); + medianvec.emplace_back(median); } return medianvec; } diff --git a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp index f0c71d9bfa10527144ff275d3b7a4b15cd660fa8..42e2121ad4e4ae67dd100c250dad87d8ad43d75e 100644 --- a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp +++ b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp @@ -218,7 +218,7 @@ double DiffractionEventCalibrateDetectors::intensity( std::vector<double> params; // = fit_alg->getProperty("Parameters"); Mantid::API::IFunction_sptr fun_res = fit_alg->getProperty("Function"); for (size_t i = 0; i < fun_res->nParams(); ++i) { - params.push_back(fun_res->getParameter(i)); + params.emplace_back(fun_res->getParameter(i)); } peakHeight = params[0]; peakLoc = params[1]; @@ -308,9 +308,9 @@ void DiffractionEventCalibrateDetectors::exec() { det = boost::dynamic_pointer_cast<RectangularDetector>((*inst)[i]); if (det) { if (det->getName() == onebank) - detList.push_back(det); + detList.emplace_back(det); if (!doOneBank) - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the first sub-level for RectangularDetectors (e.g. PG3). // We are not doing a full recursive search since that will be very long @@ -321,9 +321,9 @@ void DiffractionEventCalibrateDetectors::exec() { det = boost::dynamic_pointer_cast<RectangularDetector>((*assem)[j]); if (det) { if (det->getName() == onebank) - detList.push_back(det); + detList.emplace_back(det); if (!doOneBank) - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the second sub-level for RectangularDetectors (e.g. @@ -337,9 +337,9 @@ void DiffractionEventCalibrateDetectors::exec() { (*assem2)[k]); if (det) { if (det->getName() == onebank) - detList.push_back(det); + detList.emplace_back(det); if (!doOneBank) - detList.push_back(det); + detList.emplace_back(det); } } } diff --git a/Framework/Algorithms/src/DiffractionFocussing.cpp b/Framework/Algorithms/src/DiffractionFocussing.cpp index 82628f9e94a91a7c0bdeba2a7ad64514606bcdb8..5e522dc13e1c7cddbae5891f07296b2f54737889 100644 --- a/Framework/Algorithms/src/DiffractionFocussing.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing.cpp @@ -100,7 +100,7 @@ void DiffractionFocussing::exec() { auto to = detectorGroups.upper_bound(groupNumber); std::vector<detid_t> detectorList; for (auto d = from; d != to; ++d) - detectorList.push_back(static_cast<detid_t>(d->second)); + detectorList.emplace_back(static_cast<detid_t>(d->second)); // Want version 1 of GroupDetectors here API::IAlgorithm_sptr childAlg = createChildAlgorithm("GroupDetectors", -1.0, -1.0, true, 1); @@ -111,7 +111,7 @@ void DiffractionFocussing::exec() { // get the index of the combined spectrum int ri = childAlg->getProperty("ResultIndex"); if (ri >= 0) { - resultIndeces.push_back(ri); + resultIndeces.emplace_back(ri); } } catch (...) { throw std::runtime_error( @@ -146,7 +146,7 @@ void DiffractionFocussing::exec() { hist++) { int64_t i = resultIndeces[hist]; outputW->setHistogram(hist, tmpW->histogram(i)); - specNums.push_back(tmpIndices.spectrumNumber(i)); + specNums.emplace_back(tmpIndices.spectrumNumber(i)); } auto outputIndices = outputW->indexInfo(); outputIndices.setSpectrumNumbers(std::move(specNums)); diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp index 75a04d9cf82795b7d26ca678da6698b1fcbd55b4..f433942af3208ef08dc4f9ebae55c87c9fe98a68 100644 --- a/Framework/Algorithms/src/DiffractionFocussing2.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp @@ -236,7 +236,7 @@ void DiffractionFocussing2::exec() { // Check for masked bins in this spectrum if (m_matrixInputW->hasMaskedBins(i)) { MantidVec weight_bins, weights; - weight_bins.push_back(Xin.front()); + weight_bins.emplace_back(Xin.front()); // If there are masked bins, get a reference to the list of them const API::MatrixWorkspace::MaskList &mask = m_matrixInputW->maskedBins(i); @@ -247,19 +247,19 @@ void DiffractionFocussing2::exec() { // Add an intermediate bin with full weight if masked bins aren't // consecutive if (weight_bins.back() != currentX) { - weights.push_back(1.0); - weight_bins.push_back(currentX); + weights.emplace_back(1.0); + weight_bins.emplace_back(currentX); } // The weight for this masked bin is 1 - the degree to which this bin // is masked - weights.push_back(1.0 - bin.second); - weight_bins.push_back(Xin[bin.first + 1]); + weights.emplace_back(1.0 - bin.second); + weight_bins.emplace_back(Xin[bin.first + 1]); } // Add on a final bin with full weight if masking doesn't go up to the // end if (weight_bins.back() != Xin.back()) { - weights.push_back(1.0); - weight_bins.push_back(Xin.back()); + weights.emplace_back(1.0); + weight_bins.emplace_back(Xin.back()); } // Create a zero vector for the errors because we don't care about them @@ -653,19 +653,19 @@ size_t DiffractionFocussing2::setupGroupToWSIndices() { } // Also record a list of workspace indices - wsIndices[group].push_back(wi); + wsIndices[group].emplace_back(wi); } // initialize a vector of the valid group numbers size_t totalHistProcess = 0; for (const auto &item : group2xvector) { const auto group = item.first; - m_validGroups.push_back(group); + m_validGroups.emplace_back(group); totalHistProcess += wsIndices[group].size(); } for (const auto &group : m_validGroups) - m_wsIndices.push_back(std::move(wsIndices[static_cast<int>(group)])); + m_wsIndices.emplace_back(std::move(wsIndices[static_cast<int>(group)])); return totalHistProcess; } diff --git a/Framework/Algorithms/src/EQSANSTofStructure.cpp b/Framework/Algorithms/src/EQSANSTofStructure.cpp index 43190850a124c47fd6d980f6374820c8a5333630..4e88f7fe61af2bce3ec11eea634ce0f6b5ce9358 100644 --- a/Framework/Algorithms/src/EQSANSTofStructure.cpp +++ b/Framework/Algorithms/src/EQSANSTofStructure.cpp @@ -181,7 +181,7 @@ void EQSANSTofStructure::execEvent( events.clear(); events.reserve(clean_events.size()); for (it = clean_events.begin(); it < clean_events.end(); ++it) { - events.push_back(*it); + events.emplace_back(*it); } progress.report("TOF structure"); diff --git a/Framework/Algorithms/src/EditInstrumentGeometry.cpp b/Framework/Algorithms/src/EditInstrumentGeometry.cpp index f81914ee70e9a5419ebd542f5e29f51defb6f8ab..576988751432e9c6772ddf54da85b6a9c3fd94c7 100644 --- a/Framework/Algorithms/src/EditInstrumentGeometry.cpp +++ b/Framework/Algorithms/src/EditInstrumentGeometry.cpp @@ -187,7 +187,7 @@ void EditInstrumentGeometry::exec() { { size_t numHist = workspace->getNumberHistograms(); for (size_t i = 0; i < numHist; ++i) { - specids.push_back(workspace->getSpectrum(i).getSpectrumNo()); + specids.emplace_back(workspace->getSpectrum(i).getSpectrumNo()); g_log.information() << "Add spectrum " << workspace->getSpectrum(i).getSpectrumNo() << ".\n"; } diff --git a/Framework/Algorithms/src/ExtractMask.cpp b/Framework/Algorithms/src/ExtractMask.cpp index deeadbfd64e7120a279af7e8887e85ef3da098b2..97a7b5361944f3c3b27bb67b30f5f552b07b58da 100644 --- a/Framework/Algorithms/src/ExtractMask.cpp +++ b/Framework/Algorithms/src/ExtractMask.cpp @@ -63,7 +63,7 @@ void ExtractMask::exec() { for (size_t i = 0; i < detInfo.size(); ++i) { if ((inputWSIsSpecial && inputMaskWS->isMasked(detIds[i])) || detInfo.isMasked(i)) { - detectorList.push_back(detIds[i]); + detectorList.emplace_back(detIds[i]); } } diff --git a/Framework/Algorithms/src/ExtractMaskToTable.cpp b/Framework/Algorithms/src/ExtractMaskToTable.cpp index 27dca8e639d8bd39343255c5f1adc7adc4a9c17e..5537f5ef7a646de8aff8be3785f6de5e3d742235 100644 --- a/Framework/Algorithms/src/ExtractMaskToTable.cpp +++ b/Framework/Algorithms/src/ExtractMaskToTable.cpp @@ -193,7 +193,7 @@ ExtractMaskToTable::parseStringToVector(std::string liststr) { detidvec.reserve(numdetids); for (size_t i = 0; i < numdetids; ++i) { int tmpid = detlist.operator()()[i]; - detidvec.push_back(tmpid); + detidvec.emplace_back(tmpid); g_log.debug() << "[DB] Add detector ID: " << tmpid << ".\n"; } @@ -219,7 +219,7 @@ std::vector<detid_t> ExtractMaskToTable::extractMaskFromMatrixWorkspace() { for (size_t i = 0; i < detectorInfo.size(); ++i) { bool masked = detectorInfo.isMasked(i); if (masked) { - maskeddetids.push_back(detids[i]); + maskeddetids.emplace_back(detids[i]); } g_log.debug() << "[DB] Detector No. " << i << ": ID = " << detids[i] << ", Masked = " << masked << ".\n"; @@ -405,7 +405,7 @@ ExtractMaskToTable::subtractVector(std::vector<detid_t> minuend, if (fiter != subtrahend.end()) exist = *fiter == tmpid; if (!exist) { - diff.push_back(tmpid); + diff.emplace_back(tmpid); } firstsubiter = fiter; } diff --git a/Framework/Algorithms/src/ExtractSpectra.cpp b/Framework/Algorithms/src/ExtractSpectra.cpp index 458369ef424628ebbb4e6863d1090560fa8da6f0..f8642d4b730c7d7b0f485303e36697171f906166 100644 --- a/Framework/Algorithms/src/ExtractSpectra.cpp +++ b/Framework/Algorithms/src/ExtractSpectra.cpp @@ -312,7 +312,7 @@ void ExtractSpectra::checkProperties() { if (maxSpec - minSpec + 1 != numberOfSpectra) { m_workspaceIndexList.reserve(maxSpec - minSpec + 1); for (size_t i = minSpec; i <= maxSpec; ++i) - m_workspaceIndexList.push_back(i); + m_workspaceIndexList.emplace_back(i); } } } diff --git a/Framework/Algorithms/src/ExtractUnmaskedSpectra.cpp b/Framework/Algorithms/src/ExtractUnmaskedSpectra.cpp index 06c74666b93dff1c915c78df885b6e9d768205b0..1c7766c5235517c9a86e8f98cf3c45147bb1fa29 100644 --- a/Framework/Algorithms/src/ExtractUnmaskedSpectra.cpp +++ b/Framework/Algorithms/src/ExtractUnmaskedSpectra.cpp @@ -88,7 +88,7 @@ void ExtractUnmaskedSpectra::exec() { // Find the unmasked spectra for (size_t index = 0; index < nSpectra; ++index) { if (mask->readY(index)[0] < 1.0) { - indicesToExtract.push_back(index); + indicesToExtract.emplace_back(index); } } diff --git a/Framework/Algorithms/src/FilterByLogValue.cpp b/Framework/Algorithms/src/FilterByLogValue.cpp index 908e5de230647a0b656d777ef9b57e7760c23738..ecff00b41d4d0f21d654f8744fc842b4b36a581c 100644 --- a/Framework/Algorithms/src/FilterByLogValue.cpp +++ b/Framework/Algorithms/src/FilterByLogValue.cpp @@ -153,7 +153,7 @@ void FilterByLogValue::exec() { SplittingInterval interval(lastTime, *it - tolerance, 0); // Leave a gap +- tolerance lastTime = (*it + tolerance); - splitter.push_back(interval); + splitter.emplace_back(interval); } // And the last one splitter.emplace_back(lastTime, run_stop, 0); @@ -203,7 +203,7 @@ void FilterByLogValue::exec() { // output run std::vector<LogManager *> output_runs; LogManager *output_run = new Run(inputWS->mutableRun()); - output_runs.push_back(output_run); + output_runs.emplace_back(output_run); inputWS->run().splitByTime(splitter, output_runs); // Set the output back in the input inputWS->mutableRun() = *(static_cast<Run *>(output_runs[0])); @@ -238,7 +238,7 @@ void FilterByLogValue::exec() { // To split/filter the runs, first you make a vector with just the one // output run std::vector<LogManager *> output_runs; - output_runs.push_back(&outputWS->mutableRun()); + output_runs.emplace_back(&outputWS->mutableRun()); inputWS->run().splitByTime(splitter, output_runs); // Cast the outputWS to the matrixOutputWS and save it diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index c6e156a9e156659a015252795c5328c22dd8cc63..e1e0120ecc0c20b7165c6f636d1558bb01803a86 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -328,7 +328,7 @@ void FilterEvents::exec() { } catch (std::runtime_error &) { g_log.warning("Cannot set goniometer."); } - outputwsnames.push_back(miter.second->getName()); + outputwsnames.emplace_back(miter.second->getName()); } setProperty("OutputWorkspaceNames", outputwsnames); @@ -627,17 +627,17 @@ void FilterEvents::copyNoneSplitLogs( // insert the time series property to proper target vector if (dbl_prop) { // is double time series property - dbl_tsp_name_vector.push_back(dbl_prop); + dbl_tsp_name_vector.emplace_back(dbl_prop); } else if (int_prop) { // is integer time series property - int_tsp_name_vector.push_back(int_prop); + int_tsp_name_vector.emplace_back(int_prop); } else if (bool_prop) { // is integer time series property - bool_tsp_name_vector.push_back(bool_prop); + bool_tsp_name_vector.emplace_back(bool_prop); continue; } else if (string_prop) { // is string time series property - string_tsp_vector.push_back(string_prop); + string_tsp_vector.emplace_back(string_prop); } } else { @@ -763,7 +763,7 @@ void FilterEvents::splitTimeSeriesProperty( for (int tindex = 0; tindex <= max_target_index; ++tindex) { auto *new_property = new TimeSeriesProperty<TYPE>(property_name); new_property->setUnits(tsp->units()); - output_vector.push_back(new_property); + output_vector.emplace_back(new_property); } // duplicate the time series property if the size is just one @@ -817,7 +817,7 @@ void FilterEvents::processSplittersWorkspace() { bool inorder = true; for (size_t i = 0; i < numsplitters; i++) { // push back the splitter in SplittersWorkspace to list of splitters - m_splitters.push_back(m_splittersWorkspace->getSplitter(i)); + m_splitters.emplace_back(m_splittersWorkspace->getSplitter(i)); // add the target workspace index to target workspace indexes set m_targetWorkspaceIndexSet.insert(m_splitters.back().index()); // register for the maximum target index @@ -880,19 +880,19 @@ void FilterEvents::convertSplittersWorkspaceToVectors() { int64_t stop_time_i64 = splitter.stop().totalNanoseconds(); if (m_vecSplitterTime.empty()) { // first entry: add - m_vecSplitterTime.push_back(start_time_i64); - m_vecSplitterTime.push_back(stop_time_i64); - m_vecSplitterGroup.push_back(splitter.index()); + m_vecSplitterTime.emplace_back(start_time_i64); + m_vecSplitterTime.emplace_back(stop_time_i64); + m_vecSplitterGroup.emplace_back(splitter.index()); } else if (abs(last_entry_time - start_time_i64) < TOLERANCE) { // start time is SAME as last entry - m_vecSplitterTime.push_back(stop_time_i64); - m_vecSplitterGroup.push_back(splitter.index()); + m_vecSplitterTime.emplace_back(stop_time_i64); + m_vecSplitterGroup.emplace_back(splitter.index()); } else if (start_time_i64 > last_entry_time + TOLERANCE) { // start time is way behind. then add an empty one - m_vecSplitterTime.push_back(start_time_i64); - m_vecSplitterTime.push_back(stop_time_i64); - m_vecSplitterGroup.push_back(no_filter_index); - m_vecSplitterGroup.push_back(splitter.index()); + m_vecSplitterTime.emplace_back(start_time_i64); + m_vecSplitterTime.emplace_back(stop_time_i64); + m_vecSplitterGroup.emplace_back(no_filter_index); + m_vecSplitterGroup.emplace_back(splitter.index()); } else { // some impossible situation std::stringstream errorss; @@ -1043,14 +1043,14 @@ void FilterEvents::processTableSplittersWorkspace() { if (m_vecSplitterTime.empty()) { // first splitter: push the start time to vector - m_vecSplitterTime.push_back(start_time); + m_vecSplitterTime.emplace_back(start_time); } else if (start_time - m_vecSplitterTime.back() > TOLERANCE) { // the start time is way behind previous splitter's stop time // create a new splitter and set the time interval in the middle to target // -1 - m_vecSplitterTime.push_back(start_time); + m_vecSplitterTime.emplace_back(start_time); // NOTE: use index = 0 for un-defined slot - m_vecSplitterGroup.push_back(UNDEFINED_SPLITTING_TARGET); + m_vecSplitterGroup.emplace_back(UNDEFINED_SPLITTING_TARGET); found_undefined_splitter = true; } else if (abs(start_time - m_vecSplitterTime.back()) < TOLERANCE) { // new splitter's start time is same (within tolerance) as the stop time @@ -1078,8 +1078,8 @@ void FilterEvents::processTableSplittersWorkspace() { } // add start time, stop time and 'target - m_vecSplitterTime.push_back(stop_time); - m_vecSplitterGroup.push_back(int_target); + m_vecSplitterTime.emplace_back(stop_time); + m_vecSplitterGroup.emplace_back(int_target); } // END-FOR (irow) // record max target index @@ -1211,7 +1211,7 @@ void FilterEvents::createOutputWorkspacesSplitters() { } // Inserted this pair to map - m_wsNames.push_back(wsname.str()); + m_wsNames.emplace_back(wsname.str()); // Set (property) to output workspace and set to ADS AnalysisDataService::Instance().addOrReplace(wsname.str(), optws); @@ -1310,7 +1310,7 @@ void FilterEvents::createOutputWorkspacesMatrixCase() { } // Inserted this pair to map - m_wsNames.push_back(wsname.str()); + m_wsNames.emplace_back(wsname.str()); AnalysisDataService::Instance().addOrReplace(wsname.str(), optws); g_log.debug() << "Created output Workspace of group = " << wsgroup @@ -1413,7 +1413,7 @@ void FilterEvents::createOutputWorkspacesTableSplitterCase() { // add to output workspace property // Inserted this pair to map - m_wsNames.push_back(wsname.str()); + m_wsNames.emplace_back(wsname.str()); // Set (property) to output workspace and set to ADS AnalysisDataService::Instance().addOrReplace(wsname.str(), optws); @@ -1845,7 +1845,7 @@ void FilterEvents::generateSplitterTSP( for (int itarget = 0; itarget <= m_maxTargetIndex; ++itarget) { Kernel::TimeSeriesProperty<int> *split_tsp = new Kernel::TimeSeriesProperty<int>("splitter"); - split_tsp_vec.push_back(split_tsp); + split_tsp_vec.emplace_back(split_tsp); // add initial value if the first splitter time is after the run start // time split_tsp->addValue(Types::Core::DateAndTime(m_runStartTime), 0); @@ -1923,7 +1923,7 @@ void FilterEvents::generateSplitterTSPalpha( Kernel::TimeSeriesProperty<int> *split_tsp = new Kernel::TimeSeriesProperty<int>("splitter"); split_tsp->addValue(m_runStartTime, 0); - split_tsp_vec.push_back(split_tsp); + split_tsp_vec.emplace_back(split_tsp); } for (SplittingInterval splitter : m_splitters) { @@ -2007,7 +2007,7 @@ std::vector<std::string> FilterEvents::getTimeSeriesLogNames() { // append to vector if it is either double TimeSeries or int TimeSeries if (dbltimeprop || inttimeprop || booltimeprop) { const std::string &pname = ip->name(); - lognames.push_back(pname); + lognames.emplace_back(pname); } } diff --git a/Framework/Algorithms/src/FindCenterOfMassPosition.cpp b/Framework/Algorithms/src/FindCenterOfMassPosition.cpp index fa4c5160e8c66cbf700a870f34170dcfcf903c94..42edf1c31f1fbccf9f6c23ddd7d0c9e62bac7316 100644 --- a/Framework/Algorithms/src/FindCenterOfMassPosition.cpp +++ b/Framework/Algorithms/src/FindCenterOfMassPosition.cpp @@ -232,8 +232,8 @@ void FindCenterOfMassPosition::exec() { "CenterOfMass", boost::make_shared<NullValidator>(), Direction::Output)); std::vector<double> center_of_mass; - center_of_mass.push_back(center_x); - center_of_mass.push_back(center_y); + center_of_mass.emplace_back(center_x); + center_of_mass.emplace_back(center_y); setProperty("CenterOfMass", center_of_mass); } diff --git a/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp b/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp index 7e2c2dfc80e4637e12fe2dd11af68529b3b8ebc1..f4f5ecc8c36816455fb079cfb7e8562275617415 100644 --- a/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp +++ b/Framework/Algorithms/src/FindCenterOfMassPosition2.cpp @@ -280,8 +280,8 @@ void FindCenterOfMassPosition2::exec() { "CenterOfMass", boost::make_shared<NullValidator>(), Direction::Output)); std::vector<double> center_of_mass; - center_of_mass.push_back(center_x); - center_of_mass.push_back(center_y); + center_of_mass.emplace_back(center_x); + center_of_mass.emplace_back(center_y); setProperty("CenterOfMass", center_of_mass); } diff --git a/Framework/Algorithms/src/FindDeadDetectors.cpp b/Framework/Algorithms/src/FindDeadDetectors.cpp index 09521299a93f91361414a78c9cffe9a76f6695f5..25bb1c4a40695999a798b6c8c75f5a44929e5ae2 100644 --- a/Framework/Algorithms/src/FindDeadDetectors.cpp +++ b/Framework/Algorithms/src/FindDeadDetectors.cpp @@ -108,7 +108,7 @@ void FindDeadDetectors::exec() { file << " " << id; // we could write dead detectors to the log but if they are viewing the // log in the MantidPlot viewer it will crash MantidPlot - deadDets.push_back(id); + deadDets.emplace_back(id); ++countDets; } file << '\n'; diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp index 9b1355bf90e0a2d790446ba34c8493e11a071bc6..998477b52c5d4235acdb5090a88f2c3905953d1d 100644 --- a/Framework/Algorithms/src/FindPeakBackground.cpp +++ b/Framework/Algorithms/src/FindPeakBackground.cpp @@ -152,7 +152,7 @@ int FindPeakBackground::findBackground( auto in = std::min_element(inpY.cbegin(), inpY.cend()); double bkg0 = inpY[in - inpY.begin()]; for (size_t l = l0; l < n; ++l) { - maskedY.push_back(inpY[l] - bkg0); + maskedY.emplace_back(inpY[l] - bkg0); } MantidVec mask(n - l0, 0.0); auto xn = static_cast<double>(n - l0); diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp index dd5154fc8ce5e64e703eee0bef6b8f85501d3da9..1283de64ae96442955f1b4ccb7ad2d3a409cf6c8 100644 --- a/Framework/Algorithms/src/FindPeaks.cpp +++ b/Framework/Algorithms/src/FindPeaks.cpp @@ -630,7 +630,7 @@ std::vector<Histogram> FindPeaks::calculateSecondDifference( // Loop over spectra for (const auto i : m_indexSet) { - diffed.push_back(input->histogram(i)); + diffed.emplace_back(input->histogram(i)); diffed.back().mutableY() = 0.0; diffed.back().mutableE() = 0.0; @@ -1040,8 +1040,8 @@ int FindPeaks::findPeakBackground(const MatrixWorkspace_sptr &input, estimate->setProperty("WorkspaceIndex", spectrum); // estimate->setProperty("SigmaConstant", 1.0); std::vector<double> fwvec; - fwvec.push_back(vecX[i_min]); - fwvec.push_back(vecX[i_max]); + fwvec.emplace_back(vecX[i_min]); + fwvec.emplace_back(vecX[i_max]); estimate->setProperty("BackgroundType", m_backgroundType); estimate->setProperty("FitWindow", fwvec); estimate->executeAsChildAlg(); diff --git a/Framework/Algorithms/src/FitPeak.cpp b/Framework/Algorithms/src/FitPeak.cpp index 6c2a8273c2aa3b6ba5e7fb71a6e3da4017f6e26e..4cdf8cd74f6b51c0f1ddf6035e0812d461dce436 100644 --- a/Framework/Algorithms/src/FitPeak.cpp +++ b/Framework/Algorithms/src/FitPeak.cpp @@ -182,7 +182,7 @@ void FitOneSinglePeak::setupGuessedFWHM(double usrwidth, int minfwhm, maxfwhm = 4; } } else { - m_vecFWHM.push_back(usrwidth); + m_vecFWHM.emplace_back(usrwidth); m_sstream << "Add user defined FWHM = " << usrwidth << "\n"; } @@ -232,7 +232,7 @@ void FitOneSinglePeak::setupGuessedFWHM(double usrwidth, int minfwhm, << ", i_centre = " << i_centre << ".\n"; } - m_vecFWHM.push_back(in_fwhm); + m_vecFWHM.emplace_back(in_fwhm); } } @@ -1239,7 +1239,7 @@ FitPeak::addFunctionParameterNames(std::vector<std::string> funcnames) { for (auto &funcname : funcnames) { // Add original name in - vec_funcparnames.push_back(funcname); + vec_funcparnames.emplace_back(funcname); // Add a full function name and parameter names in IFunction_sptr tempfunc = @@ -1255,7 +1255,7 @@ FitPeak::addFunctionParameterNames(std::vector<std::string> funcnames) { } parnamess << ")"; - vec_funcparnames.push_back(parnamess.str()); + vec_funcparnames.emplace_back(parnamess.str()); } return vec_funcparnames; diff --git a/Framework/Algorithms/src/FitPeaks.cpp b/Framework/Algorithms/src/FitPeaks.cpp index 47140601fbc37b294f0e262c334038fc3a9bfbfb..f12acc80c1d32dd837b039fc9572610823196897 100644 --- a/Framework/Algorithms/src/FitPeaks.cpp +++ b/Framework/Algorithms/src/FitPeaks.cpp @@ -441,7 +441,7 @@ std::map<std::string, std::string> FitPeaks::validateInputs() { // put the names in a vector std::vector<string> functionParameterNames; for (size_t i = 0; i < m_peakFunction->nParams(); ++i) - functionParameterNames.push_back(m_peakFunction->parameterName(i)); + functionParameterNames.emplace_back(m_peakFunction->parameterName(i)); // check that the supplied names are in the function // it is acceptable to be missing parameters bool failed = false; @@ -880,7 +880,7 @@ void FitPeaks::convertParametersNameToIndex() { for (const auto ¶mName : m_peakParamNames) { auto locator = parname_index_map.find(paramName); if (locator != parname_index_map.end()) - m_initParamIndexes.push_back(locator->second); + m_initParamIndexes.emplace_back(locator->second); else { // a parameter name that is not defined in the peak profile function. An // out-of-range index is thus set to this @@ -888,7 +888,7 @@ void FitPeaks::convertParametersNameToIndex() { << " is not an allowed parameter of peak " "function " << m_peakFunction->name() << "\n"; - m_initParamIndexes.push_back(m_peakFunction->nParams() * 10); + m_initParamIndexes.emplace_back(m_peakFunction->nParams() * 10); } } @@ -1965,7 +1965,7 @@ void FitPeaks::generateFittedParametersValueWorkspaces() { if (m_rawPeaksTable) { std::vector<std::string> peak_params = m_peakFunction->getParameterNames(); for (const auto &peak_param : peak_params) - param_vec.push_back(peak_param); + param_vec.emplace_back(peak_param); } else { param_vec.emplace_back("centre"); param_vec.emplace_back("width"); diff --git a/Framework/Algorithms/src/FixGSASInstrumentFile.cpp b/Framework/Algorithms/src/FixGSASInstrumentFile.cpp index 52b17216aff43b67bce2e11901d14d36b926bf56..396897e4c8498bd9839618aaa7c8b3e7dac49173 100644 --- a/Framework/Algorithms/src/FixGSASInstrumentFile.cpp +++ b/Framework/Algorithms/src/FixGSASInstrumentFile.cpp @@ -79,7 +79,7 @@ void FixGSASInstrumentFile::exec() { boost::algorithm::split(fields, line, boost::algorithm::is_any_of("\n")); if (fields.empty()) throw runtime_error("Impossible to have an empty line. "); - vec_line.push_back(fields[0]); + vec_line.emplace_back(fields[0]); } } infile.close(); diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index f4c7fe1c179b185864242953a52010281fa9c5dc..6c23db87a42d3f9ab22dd7679765bcefbca0ffac 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -719,8 +719,8 @@ void GenerateEventsFilter::processMultipleValueFilters(double minvalue, // Log interval/value boundary double lowbound = curvalue - valuetolerance; double upbound = curvalue + valueinterval - valuetolerance; - logvalueranges.push_back(lowbound); - logvalueranges.push_back(upbound); + logvalueranges.emplace_back(lowbound); + logvalueranges.emplace_back(upbound); // Workgroup information std::stringstream ss; @@ -988,8 +988,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValues( // tempvectimes.reserve(m_dblLog->size()); vector<int> tempvecgroup; // tempvecgroup.reserve(m_dblLog->size()); - m_vecSplitterTimeSet.push_back(tempvectimes); - m_vecGroupIndexSet.push_back(tempvecgroup); + m_vecSplitterTimeSet.emplace_back(tempvectimes); + m_vecGroupIndexSet.emplace_back(tempvecgroup); int istart = 0; auto iend = static_cast<int>(logsize - 1); @@ -1061,8 +1061,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesParallel( if (i < extra) ++iend; - vecStart.push_back(istart); - vecEnd.push_back(iend); + vecStart.emplace_back(istart); + vecEnd.emplace_back(iend); } { @@ -1085,8 +1085,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesParallel( tempvectimes.reserve(m_dblLog->size()); vector<int> tempvecgroup; tempvecgroup.reserve(m_dblLog->size()); - m_vecSplitterTimeSet.push_back(tempvectimes); - m_vecGroupIndexSet.push_back(tempvecgroup); + m_vecSplitterTimeSet.emplace_back(tempvectimes); + m_vecGroupIndexSet.emplace_back(tempvecgroup); } // Create event filters/splitters in parallel @@ -1148,8 +1148,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesParallel( if (lastindex != -1 && firstindex != -1) { // T_stop < T_start, I_stop != -1, I_start != 1. : Insert a minus-one // entry to make it complete - m_vecGroupIndexSet[i - 1].push_back(-1); - m_vecSplitterTimeSet[i - 1].push_back( + m_vecGroupIndexSet[i - 1].emplace_back(-1); + m_vecSplitterTimeSet[i - 1].emplace_back( m_vecSplitterTimeSet[i].front()); } else if (lastindex == -1 && m_vecGroupIndexSet[i - 1].size() == 1) { // Empty splitter of the thread. Extend this to next @@ -1668,11 +1668,11 @@ void GenerateEventsFilter::addNewTimeFilterSplitter( // Start of splitter if (m_vecSplitterTime.empty()) { // First splitter - m_vecSplitterTime.push_back(starttime); + m_vecSplitterTime.emplace_back(starttime); } else if (m_vecSplitterTime.back() < starttime) { // Splitter to insert has a gap to previous splitter - m_vecSplitterTime.push_back(starttime); - m_vecSplitterGroup.push_back(-1); + m_vecSplitterTime.emplace_back(starttime); + m_vecSplitterGroup.emplace_back(-1); } else if (m_vecSplitterTime.back() == starttime) { // Splitter to insert is just behind previous one (no gap): nothing @@ -1682,9 +1682,9 @@ void GenerateEventsFilter::addNewTimeFilterSplitter( "start time is earlier than last splitter."); } // Stop of splitter - m_vecSplitterTime.push_back(stoptime); + m_vecSplitterTime.emplace_back(stoptime); // Group - m_vecSplitterGroup.push_back(wsindex); + m_vecSplitterGroup.emplace_back(wsindex); } else { // For regular Splitter Kernel::SplittingInterval spiv(starttime, stoptime, wsindex); @@ -1719,12 +1719,12 @@ DateAndTime GenerateEventsFilter::makeSplitterInVector( // Start time of splitter if (timevecsize == 0) { // First value - vecSplitTime.push_back(starttime); + vecSplitTime.emplace_back(starttime); } else if (lasttime < starttime) { // Stop time of previous splitter is earlier than start time of this // splitter (gap) - vecSplitTime.push_back(starttime); - vecGroupIndex.push_back(-1); + vecSplitTime.emplace_back(starttime); + vecGroupIndex.emplace_back(-1); } else if (lasttime > starttime) { // Impossible situation throw runtime_error("Impossible situation."); @@ -1736,9 +1736,9 @@ DateAndTime GenerateEventsFilter::makeSplitterInVector( // Complete this splitter, i.e., stoptime and group // Stop time of splitter - vecSplitTime.push_back(stoptime); + vecSplitTime.emplace_back(stoptime); // Group index - vecGroupIndex.push_back(group); + vecGroupIndex.emplace_back(group); return stoptime; } diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp index 3b64096cb5ec9371b1a4330d0aa6832f617506b8..547d9fd14790f9e62c7a2038c056d830a494444b 100644 --- a/Framework/Algorithms/src/GeneratePeaks.cpp +++ b/Framework/Algorithms/src/GeneratePeaks.cpp @@ -765,7 +765,7 @@ GeneratePeaks::createDataWorkspace(std::vector<double> binparameters) { while (xvalue <= xf) { // Push current value to vector - xarray.push_back(xvalue); + xarray.emplace_back(xvalue); // Calculate next value, linear or logarithmic if (dx > 0) @@ -779,7 +779,7 @@ GeneratePeaks::createDataWorkspace(std::vector<double> binparameters) { specnum_t specid = item.first; g_log.debug() << "Build WorkspaceIndex-Spectrum " << specNums.size() << " , " << specid << "\n"; - specNums.push_back(specid); + specNums.emplace_back(specid); } Indexing::IndexInfo indices(specNums.size()); @@ -799,7 +799,7 @@ GeneratePeaks::addFunctionParameterNames(std::vector<std::string> funcnames) { for (auto &funcname : funcnames) { // Add original name in - vec_funcparnames.push_back(funcname); + vec_funcparnames.emplace_back(funcname); // Add a full function name and parameter names in IFunction_sptr tempfunc = @@ -815,7 +815,7 @@ GeneratePeaks::addFunctionParameterNames(std::vector<std::string> funcnames) { } parnamess << ")"; - vec_funcparnames.push_back(parnamess.str()); + vec_funcparnames.emplace_back(parnamess.str()); } return vec_funcparnames; diff --git a/Framework/Algorithms/src/GetAllEi.cpp b/Framework/Algorithms/src/GetAllEi.cpp index 4af48ec59ad09086b797f56194437a4998430c7e..cb236e26c1790d527ca31513b3d257f73d7887d3 100644 --- a/Framework/Algorithms/src/GetAllEi.cpp +++ b/Framework/Algorithms/src/GetAllEi.cpp @@ -160,7 +160,7 @@ void removeInvalidValues(const std::vector<bool> &guessValid, for (size_t i = 0; i < guessValid.size(); i++) { if (guessValid[i]) { - new_guess.push_back(guess[i]); + new_guess.emplace_back(guess[i]); } } new_guess.swap(guess); @@ -292,7 +292,7 @@ void GetAllEi::exec() { for (double time : guess_opening) { double eGuess = destUnit->singleFromTOF(time); if (eGuess > eMin && eGuess < eMax) { - guess_ei.push_back(eGuess); + guess_ei.emplace_back(eGuess); } } g_log.debug() << "*From all chopper opening only: " + @@ -738,12 +738,12 @@ size_t GetAllEi::calcDerivativeAndCountZeros(const std::vector<double> &bins, if (signChanged(deriv[i], prevSign)) { nZeros++; - zeros.push_back(0.5 * (bins[i - 1] + bins[i])); + zeros.emplace_back(0.5 * (bins[i - 1] + bins[i])); } } deriv[nPoints - 1] = 2 * (f1 - f0) / (bin1 + bin0); if (signChanged(deriv[nPoints - 1], prevSign)) { - zeros.push_back(bins[nPoints - 1]); + zeros.emplace_back(bins[nPoints - 1]); nZeros++; } @@ -857,8 +857,8 @@ void GetAllEi::findBinRanges(const HistogramX &eBins, const HistogramY &signal, std::max(guess_peak[nGuess].right_rng, eGuess * (1 + 3 * eResolution)), ind_min, ind_max); - irangeMin.push_back(ind_min); - irangeMax.push_back(ind_max); + irangeMin.emplace_back(ind_min); + irangeMax.emplace_back(ind_max); guessValid[nGuess] = true; } else { guessValid[nGuess] = false; @@ -1106,7 +1106,7 @@ void GetAllEi::findChopSpeedAndDelay(const API::MatrixWorkspace_sptr &inputWS, startTime = inputWS->run().startTime(); endTime = inputWS->run().endTime(); Kernel::SplittingInterval interval(startTime, endTime, 0); - splitter.push_back(interval); + splitter.emplace_back(interval); } else { throw std::runtime_error("filtered all data points. Nothing to do"); } @@ -1122,14 +1122,14 @@ void GetAllEi::findChopSpeedAndDelay(const API::MatrixWorkspace_sptr &inputWS, if (SelectInterval(it->first, next->first, itder->second, inSelection, startTime, endTime)) { Kernel::SplittingInterval interval(startTime, endTime, 0); - splitter.push_back(interval); + splitter.emplace_back(interval); } it = next; } // final interval if (inSelection && (endTime > startTime)) { Kernel::SplittingInterval interval(startTime, endTime, 0); - splitter.push_back(interval); + splitter.emplace_back(interval); } } // End of USE filter log. diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index f64fa5083f242a8e8d1533c220991b4ac65e3666..0cac10f6c2d9e38ef62d0f1d59e08c8560d44d74 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -878,14 +878,14 @@ int GetDetOffsetsMultiPeaks::fitSpectra( for (int i = 0; i < static_cast<int>(peakPositions.size()); ++i) { if ((peakPositions[i] > minD) && (peakPositions[i] < maxD)) { if (m_useFitWindowTable) { - fitWindowsToUse.push_back(std::max(m_vecFitWindow[wi][2 * i], minD)); - fitWindowsToUse.push_back( + fitWindowsToUse.emplace_back(std::max(m_vecFitWindow[wi][2 * i], minD)); + fitWindowsToUse.emplace_back( std::min(m_vecFitWindow[wi][2 * i + 1], maxD)); } else if (useFitWindows) { - fitWindowsToUse.push_back(std::max(fitWindows[2 * i], minD)); - fitWindowsToUse.push_back(std::min(fitWindows[2 * i + 1], maxD)); + fitWindowsToUse.emplace_back(std::max(fitWindows[2 * i], minD)); + fitWindowsToUse.emplace_back(std::min(fitWindows[2 * i + 1], maxD)); } - peakPosToFit.push_back(peakPositions[i]); + peakPosToFit.emplace_back(peakPositions[i]); } } auto numPeaksInRange = static_cast<int>(peakPosToFit.size()); @@ -1078,12 +1078,12 @@ void GetDetOffsetsMultiPeaks::generatePeaksList( g_log.debug(dbss.str()); continue; } else - vec_offsets.push_back(offset); + vec_offsets.emplace_back(offset); // (g) calculate width/pos as to determine the (z-value) for constant // "width" - (delta d)/d // double widthdevpos = width/centre; - vec_widthDivPos.push_back(widthdevpos); + vec_widthDivPos.emplace_back(widthdevpos); // g_log.debug() << " h:" << height << " c:" << centre << " w:" << // (width/(2.*std::sqrt(2.*M_LN2))) @@ -1091,10 +1091,10 @@ void GetDetOffsetsMultiPeaks::generatePeaksList( // Add peak to vectors double refcentre = peakPositionRef[i]; - peakPosFitted.push_back(centre); - peakPosToFit.push_back(refcentre); - peakHeightFitted.push_back(height); - chisq.push_back(chi2); + peakPosFitted.emplace_back(centre); + peakPosToFit.emplace_back(refcentre); + peakHeightFitted.emplace_back(height); + chisq.emplace_back(chi2); } // Remove by Z-score on delta d/d @@ -1106,7 +1106,7 @@ void GetDetOffsetsMultiPeaks::generatePeaksList( g_log.debug() << "Banning peak at " << peakPosFitted[i] << " in wkspindex = (no show)" // << wi << " sigma/d = " << vec_widthDivPos[i] << "\n"; - banned.push_back(i); + banned.emplace_back(i); continue; } } diff --git a/Framework/Algorithms/src/GetEi.cpp b/Framework/Algorithms/src/GetEi.cpp index 682de9dc00eb831052d47629b014677174cdd77b..1fae783221e08ce4b121316b01d850b269dd0f5d 100644 --- a/Framework/Algorithms/src/GetEi.cpp +++ b/Framework/Algorithms/src/GetEi.cpp @@ -250,7 +250,7 @@ std::vector<size_t> GetEi::getMonitorWsIndexs( throw Exception::NotFoundError("GetEi::getMonitorWsIndexs()", specNum2); } - wsInds.push_back(wsIndexTemp[0]); + wsInds.emplace_back(wsIndexTemp[0]); return wsInds; } /** Uses E_KE = mv^2/2 and s = vt to calculate the time required for a neutron diff --git a/Framework/Algorithms/src/He3TubeEfficiency.cpp b/Framework/Algorithms/src/He3TubeEfficiency.cpp index f9dc3b9383c69077814df1199929e5b264c9914a..430d38dbe4085093a182e9183fb0f4680f783edb 100644 --- a/Framework/Algorithms/src/He3TubeEfficiency.cpp +++ b/Framework/Algorithms/src/He3TubeEfficiency.cpp @@ -136,7 +136,7 @@ void He3TubeEfficiency::exec() { // avoid leaving the workspace part corrected m_outputWS->mutableY(i) = 0; PARALLEL_CRITICAL(deteff_invalid) { - m_spectraSkipped.push_back(m_inputWS->getAxis(1)->spectraNo(i)); + m_spectraSkipped.emplace_back(m_inputWS->getAxis(1)->spectraNo(i)); } } @@ -435,7 +435,7 @@ void He3TubeEfficiency::execEvent() { } catch (std::out_of_range &) { // Parameters are bad so skip correction PARALLEL_CRITICAL(deteff_invalid) { - m_spectraSkipped.push_back(m_outputWS->getAxis(1)->spectraNo(i)); + m_spectraSkipped.emplace_back(m_outputWS->getAxis(1)->spectraNo(i)); m_outputWS->getSpectrum(i).clearData(); spectrumInfo.setMasked(i, true); } diff --git a/Framework/Algorithms/src/IntegrateByComponent.cpp b/Framework/Algorithms/src/IntegrateByComponent.cpp index 13e9ec5cbdf3527a902d95f9e5e7c50d8b1db31c..15d021253e77075de6878271bc1a4f478a32f3f2 100644 --- a/Framework/Algorithms/src/IntegrateByComponent.cpp +++ b/Framework/Algorithms/src/IntegrateByComponent.cpp @@ -103,8 +103,8 @@ void IntegrateByComponent::exec() { // Now we have a good value PARALLEL_CRITICAL(IntegrateByComponent_good) { - averageYInput.push_back(yValue); - averageEInput.push_back(eValue * eValue); + averageYInput.emplace_back(yValue); + averageEInput.emplace_back(eValue * eValue); } PARALLEL_END_INTERUPT_REGION @@ -164,9 +164,9 @@ IntegrateByComponent::makeInstrumentMap(API::MatrixWorkspace_sptr countsWS) { std::vector<size_t> single; for (size_t i = 0; i < countsWS->getNumberHistograms(); i++) { - single.push_back(i); + single.emplace_back(i); } - mymap.push_back(single); + mymap.emplace_back(single); return mymap; } @@ -219,9 +219,9 @@ IntegrateByComponent::makeMap(API::MatrixWorkspace_sptr countsWS, int parents) { // Iterate over all map elements with key == theKey speclistsingle.clear(); for (s_it = keyRange.first; s_it != keyRange.second; ++s_it) { - speclistsingle.push_back((*s_it).second); + speclistsingle.emplace_back((*s_it).second); } - speclist.push_back(speclistsingle); + speclist.emplace_back(speclistsingle); } return speclist; diff --git a/Framework/Algorithms/src/MagFormFactorCorrection.cpp b/Framework/Algorithms/src/MagFormFactorCorrection.cpp index 41f9ac87d54c0d0a72ab0df215b16f4597b8a82f..40f5f512ad9f8fc18f747cacd3f383c301620dc5 100644 --- a/Framework/Algorithms/src/MagFormFactorCorrection.cpp +++ b/Framework/Algorithms/src/MagFormFactorCorrection.cpp @@ -72,13 +72,14 @@ void MagFormFactorCorrection::exec() { if (isHist || iax > 0) { int64_t nQ = QAxis->length() - 1; for (int64_t iQ = 0; iQ < nQ; iQ++) { - Qvals.push_back(0.5 * (QAxis->getValue(static_cast<size_t>(iQ)) + - QAxis->getValue(static_cast<size_t>(iQ + 1)))); + Qvals.emplace_back(0.5 * + (QAxis->getValue(static_cast<size_t>(iQ)) + + QAxis->getValue(static_cast<size_t>(iQ + 1)))); } } else { int64_t nQ = QAxis->length(); for (int64_t iQ = 0; iQ < nQ; iQ++) { - Qvals.push_back(QAxis->getValue(static_cast<size_t>(iQ))); + Qvals.emplace_back(QAxis->getValue(static_cast<size_t>(iQ))); } } break; diff --git a/Framework/Algorithms/src/MaskBinsFromTable.cpp b/Framework/Algorithms/src/MaskBinsFromTable.cpp index f528d671bfdace53e9f9ef43870d3c87a9f401a3..06c2cc6d611a437fb8b9f0fbc430c4bee2c2663e 100644 --- a/Framework/Algorithms/src/MaskBinsFromTable.cpp +++ b/Framework/Algorithms/src/MaskBinsFromTable.cpp @@ -199,9 +199,9 @@ void MaskBinsFromTable::processMaskBinWorkspace( << " SpectraList = " << spectralist << ".\n"; // Store to class variables - m_xminVec.push_back(xmin); - m_xmaxVec.push_back(xmax); - m_spectraVec.push_back(spectralist); + m_xminVec.emplace_back(xmin); + m_xmaxVec.emplace_back(xmax); + m_spectraVec.emplace_back(spectralist); } } @@ -221,7 +221,7 @@ MaskBinsFromTable::convertToSpectraList(API::MatrixWorkspace_sptr dataws, size_t numitems = parser.size(); for (size_t i = 0; i < numitems; ++i) { - detidvec.push_back(parser.operator()()[i]); + detidvec.emplace_back(parser.operator()()[i]); g_log.debug() << "[DB] DetetorID = " << detidvec.back() << " to mask."; } @@ -234,7 +234,7 @@ MaskBinsFromTable::convertToSpectraList(API::MatrixWorkspace_sptr dataws, detid2index_map::const_iterator fiter = refermap.find(detid); if (fiter != refermap.end()) { size_t wsindex = fiter->second; - wsindexvec.push_back(wsindex); + wsindexvec.emplace_back(wsindex); } else { g_log.warning() << "Detector ID " << detid << " cannot be mapped to any workspace index/spectrum." diff --git a/Framework/Algorithms/src/MaxEnt.cpp b/Framework/Algorithms/src/MaxEnt.cpp index 1b5f89f4607a8f8c44022b4f719f747e1c374541..8c3c42d81c8cf4d33e62e12b3c386b81a72cef67 100644 --- a/Framework/Algorithms/src/MaxEnt.cpp +++ b/Framework/Algorithms/src/MaxEnt.cpp @@ -522,7 +522,7 @@ void MaxEnt::exec() { // it + 1 iterations have been done because we count from zero g_log.information() << "Converged after " << it + 1 << " iterations" << std::endl; - iterationCounts.push_back(it + 1); + iterationCounts.emplace_back(it + 1); converged = true; break; } @@ -538,7 +538,7 @@ void MaxEnt::exec() { // If we didn't converge, we still need to record the number of iterations if (!converged) { - iterationCounts.push_back(nIter); + iterationCounts.emplace_back(nIter); } // Get calculated data diff --git a/Framework/Algorithms/src/MergeRuns.cpp b/Framework/Algorithms/src/MergeRuns.cpp index 814378d722dc4aa8430dc302735e9f83ddf74a6f..bc652381e516da2813ab285541803bb181e1dcd5 100644 --- a/Framework/Algorithms/src/MergeRuns.cpp +++ b/Framework/Algorithms/src/MergeRuns.cpp @@ -284,7 +284,7 @@ void MergeRuns::buildAdditionTables() { } // Add this table to the list - m_tables.push_back(table); + m_tables.emplace_back(table); } // each of the workspaces being added @@ -452,7 +452,7 @@ bool MergeRuns::validateInputsForEventWorkspaces( if (!ws) { // Either it is not found, or it is not an EventWorkspace return false; } - m_inEventWS.push_back(ws); + m_inEventWS.emplace_back(ws); // Check a few things are the same for all input workspaces if (i == 0) { diff --git a/Framework/Algorithms/src/PDCalibration.cpp b/Framework/Algorithms/src/PDCalibration.cpp index 6fc039a128a882e20433d72b8821f3f718a9684e..d5e0e616a648cad66c6aaf90a94092c1d5203be1 100644 --- a/Framework/Algorithms/src/PDCalibration.cpp +++ b/Framework/Algorithms/src/PDCalibration.cpp @@ -581,9 +581,9 @@ void PDCalibration::exec() { if (height < 0.5 * std::sqrt(height + background)) { continue; } - d_vec.push_back(m_peaksInDspacing[peakIndex]); - tof_vec.push_back(centre); - height2.push_back(height * height); + d_vec.emplace_back(m_peaksInDspacing[peakIndex]); + tof_vec.emplace_back(centre); + height2.emplace_back(height * height); tof_vec_full[peakIndex] = centre; width_vec_full[peakIndex] = width; height_vec_full[peakIndex] = height; @@ -1145,8 +1145,8 @@ API::MatrixWorkspace_sptr PDCalibration::calculateResolutionTable() { for (size_t peakIndex = 1; peakIndex < numPeaks + 1; ++peakIndex) { const double pos = m_peakPositionTable->Double(rowIndex, peakIndex); if (std::isnormal(pos)) { - resolution.push_back(m_peakWidthTable->Double(rowIndex, peakIndex) / - pos); + resolution.emplace_back(m_peakWidthTable->Double(rowIndex, peakIndex) / + pos); } } diff --git a/Framework/Algorithms/src/PDDetermineCharacterizations.cpp b/Framework/Algorithms/src/PDDetermineCharacterizations.cpp index eaf170f22dcafc2dc2f07c8358808106cc0c3526..beaab3c7a6857d3ef31c0878450f00c45dace952 100644 --- a/Framework/Algorithms/src/PDDetermineCharacterizations.cpp +++ b/Framework/Algorithms/src/PDDetermineCharacterizations.cpp @@ -397,7 +397,7 @@ void PDDetermineCharacterizations::overrideRunNumProperty( if ((!runnumbers.empty()) && (runnumbers[0] != 0)) { if (runnumbers[0] < 0) { runnumbers.erase(runnumbers.begin(), runnumbers.end()); - runnumbers.push_back(0); + runnumbers.emplace_back(0); } m_propertyManager->setProperty(propName, runnumbers); } diff --git a/Framework/Algorithms/src/PDFFourierTransform.cpp b/Framework/Algorithms/src/PDFFourierTransform.cpp index 37613177823715857e7b6db7f3c838e02abe921c..32528b96b6247fad49e37edba016b0eb0b4a0156 100644 --- a/Framework/Algorithms/src/PDFFourierTransform.cpp +++ b/Framework/Algorithms/src/PDFFourierTransform.cpp @@ -79,9 +79,9 @@ void PDFFourierTransform::init() { // Set up input data type std::vector<std::string> inputTypes; - inputTypes.push_back(S_OF_Q); - inputTypes.push_back(S_OF_Q_MINUS_ONE); - inputTypes.push_back(Q_S_OF_Q_MINUS_ONE); + inputTypes.emplace_back(S_OF_Q); + inputTypes.emplace_back(S_OF_Q_MINUS_ONE); + inputTypes.emplace_back(Q_S_OF_Q_MINUS_ONE); declareProperty("InputSofQType", S_OF_Q, boost::make_shared<StringListValidator>(inputTypes), "To identify whether input function"); @@ -100,9 +100,9 @@ void PDFFourierTransform::init() { // Set up output data type std::vector<std::string> outputTypes; - outputTypes.push_back(BIG_G_OF_R); - outputTypes.push_back(LITTLE_G_OF_R); - outputTypes.push_back(RDF_OF_R); + outputTypes.emplace_back(BIG_G_OF_R); + outputTypes.emplace_back(LITTLE_G_OF_R); + outputTypes.emplace_back(RDF_OF_R); declareProperty("PDFType", BIG_G_OF_R, boost::make_shared<StringListValidator>(outputTypes), "Type of output PDF including G(r)"); @@ -285,8 +285,8 @@ void PDFFourierTransform::exec() { inputQ[i] += -.5*deltaQ; inputDQ[i] += .5*(inputDQ[i] + inputDQ[i+1]); // TODO running average } - inputQ.push_back(inputQ.back()+deltaQ); - inputDQ.push_back(inputDQ.back()); // copy last value + inputQ.emplace_back(inputQ.back()+deltaQ); + inputDQ.emplace_back(inputDQ.back()); // copy last value */ } diff --git a/Framework/Algorithms/src/PerformIndexOperations.cpp b/Framework/Algorithms/src/PerformIndexOperations.cpp index 6164ce0093df2877aeb8d7719f8849953e138dec..c46a1c4f8aabf669c86cc38cdc0a38328e3f0138 100644 --- a/Framework/Algorithms/src/PerformIndexOperations.cpp +++ b/Framework/Algorithms/src/PerformIndexOperations.cpp @@ -199,8 +199,8 @@ public: Mantid::Kernel::Strings::convert<int>(arguments.front(), minIndex); Mantid::Kernel::Strings::convert<int>(arguments.back(), maxIndex); std::vector<int> indexes; - indexes.push_back(minIndex); - indexes.push_back(maxIndex); + indexes.emplace_back(minIndex); + indexes.emplace_back(maxIndex); command = new AdditionCommand(indexes); } else { command = new NullCommand; @@ -307,7 +307,7 @@ VecCommands interpret(const std::string &processingInstructions) { if (commandSptr->isValid()) // Do not record invalid commands. { parserFound = true; - commands.push_back(commandSptr); + commands.emplace_back(commandSptr); } } if (!parserFound) { diff --git a/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp b/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp index 85ae983f53fac70c45f0bbdef91eb00a3228977d..6970ce79c38db6ed611116e766b57c5428d02235 100644 --- a/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp +++ b/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp @@ -40,8 +40,8 @@ const std::string efficienciesLabel("Efficiencies"); std::vector<std::string> modes() { std::vector<std::string> modes; - modes.push_back(pALabel); - modes.push_back(pNRLabel); + modes.emplace_back(pALabel); + modes.emplace_back(pNRLabel); return modes; } diff --git a/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp b/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp index 4ad1cbdb4264b5b5345183203ee8d43ce6e70079..0e0afda8706fa3f2bd574a3a050f38dee80f8016 100644 --- a/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp +++ b/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp @@ -251,7 +251,7 @@ PolarizationEfficiencyCor::getWorkspaceNameList() const { "Workspace from the input workspace group is not stored in the " "Analysis Data Service which is required by the Wildes method."); } - names.push_back(name); + names.emplace_back(name); } } return names; diff --git a/Framework/Algorithms/src/Qxy.cpp b/Framework/Algorithms/src/Qxy.cpp index 6281ec8bbcd266f5e7378be45422222564cb32d5..fc8058f446d50ea7fa0987bdfafb262e4d4b6073 100644 --- a/Framework/Algorithms/src/Qxy.cpp +++ b/Framework/Algorithms/src/Qxy.cpp @@ -420,7 +420,7 @@ Qxy::setUpOutputWorkspace(API::MatrixWorkspace_const_sptr inputWorkspace) { std::vector<double> totalBinning = positiveBinning; std::for_each(std::begin(totalBinning), std::end(totalBinning), [](double &n) { n = -1 * n; }); - totalBinning.push_back(0.0); + totalBinning.emplace_back(0.0); std::reverse(std::begin(positiveBinning), std::end(positiveBinning)); totalBinning.insert(std::end(totalBinning), std::begin(positiveBinning), std::end(positiveBinning)); diff --git a/Framework/Algorithms/src/Rebin.cpp b/Framework/Algorithms/src/Rebin.cpp index 7e6bfb44ff72328b8eb51aa533f77b7ecaf3aa2c..60d5770c9d6b64085a6d8caafa1255c68325e812 100644 --- a/Framework/Algorithms/src/Rebin.cpp +++ b/Framework/Algorithms/src/Rebin.cpp @@ -322,19 +322,19 @@ void Rebin::propagateMasks(API::MatrixWorkspace_const_sptr inputWS, // Now iterate over the list, building up a vector of the masked bins auto it = mask.cbegin(); auto &XValues = inputWS->x(hist); - masked_bins.push_back(XValues[(*it).first]); - weights.push_back((*it).second); - masked_bins.push_back(XValues[(*it).first + 1]); + masked_bins.emplace_back(XValues[(*it).first]); + weights.emplace_back((*it).second); + masked_bins.emplace_back(XValues[(*it).first + 1]); for (++it; it != mask.end(); ++it) { const double currentX = XValues[(*it).first]; // Add an intermediate bin with zero weight if masked bins aren't // consecutive if (masked_bins.back() != currentX) { - weights.push_back(0.0); - masked_bins.push_back(currentX); + weights.emplace_back(0.0); + masked_bins.emplace_back(currentX); } - weights.push_back((*it).second); - masked_bins.push_back(XValues[(*it).first + 1]); + weights.emplace_back((*it).second); + masked_bins.emplace_back(XValues[(*it).first + 1]); } //// Create a zero vector for the errors because we don't care about them here diff --git a/Framework/Algorithms/src/RebinByTimeBase.cpp b/Framework/Algorithms/src/RebinByTimeBase.cpp index 3d6c59bb7dd5b7d19f0691cf2559b46ecdaddef6..f66b21b474fc435da84d13f29922a455cf35b336 100644 --- a/Framework/Algorithms/src/RebinByTimeBase.cpp +++ b/Framework/Algorithms/src/RebinByTimeBase.cpp @@ -94,19 +94,20 @@ void RebinByTimeBase::exec() { const DateAndTime startTime = runStartTime + inParams[0]; const DateAndTime endTime = runStartTime + inParams[2]; // Rebinning params in nanoseconds. - rebinningParams.push_back( + rebinningParams.emplace_back( static_cast<double>(startTime.totalNanoseconds())); tStep = inParams[1] * nanoSecondsInASecond; - rebinningParams.push_back(tStep); - rebinningParams.push_back(static_cast<double>(endTime.totalNanoseconds())); + rebinningParams.emplace_back(tStep); + rebinningParams.emplace_back( + static_cast<double>(endTime.totalNanoseconds())); } else if (inParams.size() == 1) { const uint64_t xmin = getMinX(inWS); const uint64_t xmax = getMaxX(inWS); - rebinningParams.push_back(static_cast<double>(xmin)); + rebinningParams.emplace_back(static_cast<double>(xmin)); tStep = inParams[0] * nanoSecondsInASecond; - rebinningParams.push_back(tStep); - rebinningParams.push_back(static_cast<double>(xmax)); + rebinningParams.emplace_back(tStep); + rebinningParams.emplace_back(static_cast<double>(xmax)); } // Validate the timestep. diff --git a/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp b/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp index 5e832dfa0542a3ba3a1b14373280eddf21caabce..11857f0183c1d0b38555963235fe636ae875b3b1 100644 --- a/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp +++ b/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp @@ -79,19 +79,19 @@ std::vector<double> ReflectometryBackgroundSubtraction::findSpectrumRanges( const std::vector<specnum_t> &spectraList) { std::vector<double> spectrumRanges; - spectrumRanges.push_back(spectraList[0]); + spectrumRanges.emplace_back(spectraList[0]); auto prevSpec = spectrumRanges[0]; for (size_t index = 0; index < spectraList.size() - 1; ++index) { auto spec = spectraList[index + 1]; auto range = spec - prevSpec; // check if start of new range if (range > 1) { - spectrumRanges.push_back(prevSpec); - spectrumRanges.push_back(spec); + spectrumRanges.emplace_back(prevSpec); + spectrumRanges.emplace_back(spec); } prevSpec = spec; } - spectrumRanges.push_back(spectraList.back()); + spectrumRanges.emplace_back(spectraList.back()); return spectrumRanges; } @@ -289,8 +289,8 @@ void ReflectometryBackgroundSubtraction::exec() { std::vector<specnum_t> spectraList; for (auto index : indexSet) { auto &spec = inputWS->getSpectrum(index); - spectraList.push_back(spec.getSpectrumNo()); - indexList.push_back(static_cast<double>(index)); + spectraList.emplace_back(spec.getSpectrumNo()); + indexList.emplace_back(static_cast<double>(index)); } if (backgroundType == "PerDetectorAverage") { diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp index fefe4df12f87968533c8a0f7d287b8988f7c04ae..293713d47dd61df33288d66851117119fd8ea682 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp @@ -516,7 +516,7 @@ ReflectometryReductionOneAuto2::getDetectorNames(MatrixWorkspace_sptr inputWS) { auto parentType = parent->type(); auto detectorName = (parentType == "Instrument") ? detector->getName() : parent->getName(); - detectors.push_back(detectorName); + detectors.emplace_back(detectorName); } } } catch (boost::bad_lexical_cast &) { @@ -919,10 +919,10 @@ bool ReflectometryReductionOneAuto2::processGroups() { } alg->execute(); - IvsQGroup.push_back(IvsQName); - IvsQBinnedGroup.push_back(IvsQBinnedName); + IvsQGroup.emplace_back(IvsQName); + IvsQBinnedGroup.emplace_back(IvsQBinnedName); if (AnalysisDataService::Instance().doesExist(IvsLamName)) { - IvsLamGroup.push_back(IvsLamName); + IvsLamGroup.emplace_back(IvsLamName); } } @@ -992,10 +992,10 @@ bool ReflectometryReductionOneAuto2::processGroups() { alg->setProperty("OutputWorkspaceBinned", IvsQBinnedName); alg->setProperty("OutputWorkspaceWavelength", IvsLamName); alg->execute(); - IvsQBinnedGroup.push_back(IvsQBinnedName); - IvsQGroup.push_back(IvsQName); + IvsQBinnedGroup.emplace_back(IvsQBinnedName); + IvsQGroup.emplace_back(IvsQName); if (AnalysisDataService::Instance().doesExist(IvsLamName)) { - IvsLamGroup.push_back(IvsLamName); + IvsLamGroup.emplace_back(IvsLamName); } } diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp index 606baa751893bfb168ec8d2a557ec8840a9f00c5..c953350b588eef7e06738d21925a30127a854e81 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp @@ -477,7 +477,7 @@ ReflectometryReductionOneAuto3::getDetectorNames(MatrixWorkspace_sptr inputWS) { auto parentType = parent->type(); auto detectorName = (parentType == "Instrument") ? detector->getName() : parent->getName(); - detectors.push_back(detectorName); + detectors.emplace_back(detectorName); } } } catch (const boost::bad_lexical_cast &) { @@ -885,10 +885,10 @@ bool ReflectometryReductionOneAuto3::processGroups() { } alg->execute(); - IvsQGroup.push_back(IvsQName); - IvsQBinnedGroup.push_back(IvsQBinnedName); + IvsQGroup.emplace_back(IvsQName); + IvsQBinnedGroup.emplace_back(IvsQBinnedName); if (AnalysisDataService::Instance().doesExist(IvsLamName)) { - IvsLamGroup.push_back(IvsLamName); + IvsLamGroup.emplace_back(IvsLamName); } } @@ -958,10 +958,10 @@ bool ReflectometryReductionOneAuto3::processGroups() { alg->setProperty("OutputWorkspaceBinned", IvsQBinnedName); alg->setProperty("OutputWorkspaceWavelength", IvsLamName); alg->execute(); - IvsQBinnedGroup.push_back(IvsQBinnedName); - IvsQGroup.push_back(IvsQName); + IvsQBinnedGroup.emplace_back(IvsQBinnedName); + IvsQGroup.emplace_back(IvsQName); if (AnalysisDataService::Instance().doesExist(IvsLamName)) { - IvsLamGroup.push_back(IvsLamName); + IvsLamGroup.emplace_back(IvsLamName); } } diff --git a/Framework/Algorithms/src/Regroup.cpp b/Framework/Algorithms/src/Regroup.cpp index f103098e5d121079d3faf5489732d88fe24ee7d4..37512c8e43e5f641e287d207b9dff42447fd1608 100644 --- a/Framework/Algorithms/src/Regroup.cpp +++ b/Framework/Algorithms/src/Regroup.cpp @@ -195,8 +195,8 @@ int Regroup::newAxis(const std::vector<double> ¶ms, std::bind(std::greater_equal<double>(), _1, xcurr)); if (iup != xold.end()) { xcurr = *iup; - xnew.push_back(xcurr); - xoldIndex.push_back(inew); + xnew.emplace_back(xcurr); + xoldIndex.emplace_back(inew); inew++; } else return 0; @@ -216,8 +216,8 @@ int Regroup::newAxis(const std::vector<double> ¶ms, if (iup != xold.end()) { if (*iup <= params[ibound]) { xcurr = *iup; - xnew.push_back(xcurr); - xoldIndex.push_back(inew); + xnew.emplace_back(xcurr); + xoldIndex.emplace_back(inew); inew++; } else { ibound += 2; diff --git a/Framework/Algorithms/src/RemoveBins.cpp b/Framework/Algorithms/src/RemoveBins.cpp index e697e054d2fa78ea73ab37118f9f969627c19369..e39d4cc5a23ca2214c36c6ff8a57bb44b1c88ae9 100644 --- a/Framework/Algorithms/src/RemoveBins.cpp +++ b/Framework/Algorithms/src/RemoveBins.cpp @@ -271,8 +271,8 @@ void RemoveBins::transformRangeUnit(const int index, double &startX, double l1, l2, theta; this->calculateDetectorPosition(index, l1, l2, theta); std::vector<double> endPoints; - endPoints.push_back(startX); - endPoints.push_back(endX); + endPoints.emplace_back(startX); + endPoints.emplace_back(endX); std::vector<double> emptyVec; m_rangeUnit->toTOF(endPoints, emptyVec, l1, l2, theta, 0, 0.0, 0.0); inputUnit->fromTOF(endPoints, emptyVec, l1, l2, theta, 0, 0.0, 0.0); diff --git a/Framework/Algorithms/src/RemoveMaskedSpectra.cpp b/Framework/Algorithms/src/RemoveMaskedSpectra.cpp index 5df82f90db19f6de234fdfbdd83d501c9917082a..19fcff368285c179a1b48cb54c3d062ca613ea74 100644 --- a/Framework/Algorithms/src/RemoveMaskedSpectra.cpp +++ b/Framework/Algorithms/src/RemoveMaskedSpectra.cpp @@ -97,7 +97,7 @@ void RemoveMaskedSpectra::makeIndexList( if (mask) { for (size_t i = 0; i < mask->getNumberHistograms(); ++i) { if (mask->y(i)[0] == 0.0) { - indices.push_back(i); + indices.emplace_back(i); } } } else { @@ -106,7 +106,7 @@ void RemoveMaskedSpectra::makeIndexList( if (!spectrumInfo.hasDetectors(i)) continue; if (!spectrumInfo.isMasked(i)) - indices.push_back(i); + indices.emplace_back(i); } } } diff --git a/Framework/Algorithms/src/RemovePromptPulse.cpp b/Framework/Algorithms/src/RemovePromptPulse.cpp index b0a4c7649815c0f608778814b7614d2bb32ccdab..3e692b2a12813520347348052997af520127ba62 100644 --- a/Framework/Algorithms/src/RemovePromptPulse.cpp +++ b/Framework/Algorithms/src/RemovePromptPulse.cpp @@ -197,7 +197,7 @@ RemovePromptPulse::calculatePulseTimes(const double tmin, const double tmax, // calculate all times possible while (time < tmax) { - times.push_back(time); + times.emplace_back(time); time += period; } diff --git a/Framework/Algorithms/src/RenameWorkspaces.cpp b/Framework/Algorithms/src/RenameWorkspaces.cpp index ae902b85af761cdd42c361a8214b3fedd321f0e0..71a29b5483de0cbe3f8934c0234261eb64544c14 100644 --- a/Framework/Algorithms/src/RenameWorkspaces.cpp +++ b/Framework/Algorithms/src/RenameWorkspaces.cpp @@ -126,7 +126,7 @@ void RenameWorkspaces::exec() { } else { // We are using prefix and/or suffix // Build new names. for (size_t i = 0; i < nWs; ++i) { - newWsName.push_back(prefix + inputWsName[i] + suffix); + newWsName.emplace_back(prefix + inputWsName[i] + suffix); } } diff --git a/Framework/Algorithms/src/ResampleX.cpp b/Framework/Algorithms/src/ResampleX.cpp index 49ecf85ef10e2c21153417e1e5ec6fadcb87267e..3e1049fce3822f87e4281c54298df08b553efe97 100644 --- a/Framework/Algorithms/src/ResampleX.cpp +++ b/Framework/Algorithms/src/ResampleX.cpp @@ -154,17 +154,17 @@ string determineXMinMax(MatrixWorkspace_sptr inputWS, vector<double> &xmins, if (updateXMins) { const auto minimum = xvalues.front(); if (std::isnan(minimum) || minimum >= xmax_wksp) { - xmins.push_back(xmin_wksp); + xmins.emplace_back(xmin_wksp); } else { - xmins.push_back(minimum); + xmins.emplace_back(minimum); } } if (updateXMaxs) { const auto maximum = xvalues.back(); if (std::isnan(maximum) || maximum <= xmin_wksp) { - xmaxs.push_back(xmax_wksp); + xmaxs.emplace_back(xmax_wksp); } else { - xmaxs.push_back(maximum); + xmaxs.emplace_back(maximum); } } } @@ -218,9 +218,9 @@ double ResampleX::determineBinning(MantidVec &xValues, const double xmin, expNumBoundaries += 1; // should be one more bin boundary for histograms vector<double> params; // xmin, delta, xmax - params.push_back(xmin); - params.push_back(0.); // dummy delta value - params.push_back(xmax); + params.emplace_back(xmin); + params.emplace_back(0.); // dummy delta value + params.emplace_back(xmax); // constant binning is easy if (m_useLogBinning) { diff --git a/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp b/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp index e423a185beba68377260607706b1f4f10fca8b4c..574223de791286fdbe24606b4dcc18783fe2fa4c 100644 --- a/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp +++ b/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp @@ -44,7 +44,7 @@ RunCombinationHelper::unWrapGroups(const std::vector<std::string> &inputs) { MatrixWorkspace_sptr matrixws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(input); if (matrixws) - outputs.push_back(matrixws->getName()); + outputs.emplace_back(matrixws->getName()); else throw(std::runtime_error( "The input " + input + @@ -71,7 +71,7 @@ void RunCombinationHelper::setReferenceProperties(MatrixWorkspace_sptr ref) { if (m_numberSpectra) { m_hasDx.reserve(m_numberSpectra); for (unsigned int i = 0; i < m_numberSpectra; ++i) - m_hasDx.push_back(ref->hasDx(i)); + m_hasDx.emplace_back(ref->hasDx(i)); } } diff --git a/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp b/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp index ddb34d772aa22cdf165b6a95bdadb0927b8f37f5..5815bfb3541c9b73fdb8e6a797c243909dea7f4b 100644 --- a/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp +++ b/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp @@ -506,7 +506,7 @@ void SampleLogsBehaviour::updateTimeSeriesProperty(MatrixWorkspace &addeeWS, // Remove this to supress a warning, we will put it back after adding the // workspaces in MergeRuns const Property *addeeWSProperty = addeeWS.run().getProperty(name); - m_addeeLogMap.push_back( + m_addeeLogMap.emplace_back( std::shared_ptr<Property>(addeeWSProperty->clone())); } } diff --git a/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp b/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp index c44d60b8d86f016d55302499f5dafbe59cfb1fa3..fd926cfc9e60226399943aad7a4468060fe0a8db 100644 --- a/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp +++ b/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp @@ -141,7 +141,7 @@ double SANSCollimationLengthEstimator::getCollimationLengthWithGuides( auto guideName = "Guide" + std::to_string(i); if (inOutWS->run().hasProperty(guideName)) { auto guideValue = getGuideValue(inOutWS->run().getProperty(guideName)); - guideValues.push_back(guideValue); + guideValues.emplace_back(guideValue); } else { throw std::invalid_argument("TOFSANSResolutionByPixel: Mismatch between " "specified number of Guides and actual " diff --git a/Framework/Algorithms/src/SetInstrumentParameter.cpp b/Framework/Algorithms/src/SetInstrumentParameter.cpp index a6f6068cb038bd54387292bb348554f64bcbadd3..381aca5e2270169f61c85ec0f1307e495ebd8521 100644 --- a/Framework/Algorithms/src/SetInstrumentParameter.cpp +++ b/Framework/Algorithms/src/SetInstrumentParameter.cpp @@ -135,7 +135,7 @@ void SetInstrumentParameter::exec() { std::vector<IDetector_const_sptr> dets; std::vector<IComponent_const_sptr> cmptList; // set default to whole instrument - cmptList.push_back(inst); + cmptList.emplace_back(inst); if (!detectorList.empty()) { dets = inst->getDetectors(detectorList); diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp index f1499c3a697aeb1d10d083c6ea6b3159df36659d..ab85429e7602564db75617fb2c52a4d0750e3020 100644 --- a/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -201,7 +201,7 @@ void SmoothNeighbours::findNeighboursRectangular() { det = boost::dynamic_pointer_cast<RectangularDetector>((*inst)[i]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the first sub-level for RectangularDetectors (e.g. PG3). // We are not doing a full recursive search since that will be very long @@ -211,7 +211,7 @@ void SmoothNeighbours::findNeighboursRectangular() { for (int j = 0; j < assem->nelements(); j++) { det = boost::dynamic_pointer_cast<RectangularDetector>((*assem)[j]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the second sub-level for RectangularDetectors (e.g. @@ -224,7 +224,7 @@ void SmoothNeighbours::findNeighboursRectangular() { det = boost::dynamic_pointer_cast<RectangularDetector>( (*assem2)[k]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } } } diff --git a/Framework/Algorithms/src/SofQWCentre.cpp b/Framework/Algorithms/src/SofQWCentre.cpp index 4f6569accd317cf2aaaceae3bc19ae86c43c54fb..25ef87b08a8adb953bc9f4463f0849e1c00b297a 100644 --- a/Framework/Algorithms/src/SofQWCentre.cpp +++ b/Framework/Algorithms/src/SofQWCentre.cpp @@ -143,9 +143,9 @@ void SofQWCentre::exec() { xAxis.begin() - 1; // Add this spectra-detector pair to the mapping - specNumberMapping.push_back( + specNumberMapping.emplace_back( outputWorkspace->getSpectrum(qIndex).getSpectrumNo()); - detIDMapping.push_back(detID); + detIDMapping.emplace_back(detID); // And add the data and it's error to that bin, taking into account // the number of detectors contributing to this bin diff --git a/Framework/Algorithms/src/SpatialGrouping.cpp b/Framework/Algorithms/src/SpatialGrouping.cpp index 1b7d36730ac8aadefcece0046fa38d9f2a37fb5d..30f68db37d7ccd394bd48a831f9fa5e4d37af0d1 100644 --- a/Framework/Algorithms/src/SpatialGrouping.cpp +++ b/Framework/Algorithms/src/SpatialGrouping.cpp @@ -131,15 +131,15 @@ void SpatialGrouping::exec() { std::vector<int> group; m_included.insert(specNo); // Add the central spectrum - group.push_back(specNo); + group.emplace_back(specNo); // Add all the nearest neighbors std::map<specnum_t, Mantid::Kernel::V3D>::iterator nrsIt; for (nrsIt = nearest.begin(); nrsIt != nearest.end(); ++nrsIt) { m_included.insert(nrsIt->first); - group.push_back(nrsIt->first); + group.emplace_back(nrsIt->first); } - m_groups.push_back(group); + m_groups.emplace_back(group); } if (m_groups.empty()) { diff --git a/Framework/Algorithms/src/SpectrumAlgorithm.cpp b/Framework/Algorithms/src/SpectrumAlgorithm.cpp index 0413f71239a131bc1e663b07ef3893cb9f67f481..fba1949a27a63dbb39a98fc21e9815a34d8550a6 100644 --- a/Framework/Algorithms/src/SpectrumAlgorithm.cpp +++ b/Framework/Algorithms/src/SpectrumAlgorithm.cpp @@ -73,7 +73,7 @@ Kernel::IndexSet SpectrumAlgorithm::getWorkspaceIndexSet( // Add range to index list if given. if (!isEmpty(max)) { for (int i = min; i <= max; i++) - indices_list.push_back(i); + indices_list.emplace_back(i); } return {indices_list, numberOfSpectra}; } diff --git a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp index 225653ac23c9d83a64c96fc431993c701dabeaa4..65e1fa66e5df99007c1685c2d5d925c9d640d9dd 100644 --- a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp +++ b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp @@ -74,9 +74,9 @@ void SpecularReflectionAlgorithm::initCommonProperties() { "to move"; std::vector<std::string> propOptions; - propOptions.push_back(pointDetectorAnalysis); - propOptions.push_back(lineDetectorAnalysis); - propOptions.push_back(multiDetectorAnalysis); + propOptions.emplace_back(pointDetectorAnalysis); + propOptions.emplace_back(lineDetectorAnalysis); + propOptions.emplace_back(multiDetectorAnalysis); declareProperty("AnalysisMode", pointDetectorAnalysis, boost::make_shared<StringListValidator>(propOptions), diff --git a/Framework/Algorithms/src/Stitch1D.cpp b/Framework/Algorithms/src/Stitch1D.cpp index 51c391e11109ea86969be8c2a0be4c75c9dc7da3..476b215d5d1e29fde0e847190c7d270f464d50e9 100644 --- a/Framework/Algorithms/src/Stitch1D.cpp +++ b/Framework/Algorithms/src/Stitch1D.cpp @@ -289,16 +289,17 @@ std::vector<double> Stitch1D::getRebinParams(MatrixWorkspace_const_sptr &lhsWS, calculatedStep = rhsX[1] - rhsX[0]; } - calculatedParams.push_back(minLHSX); - calculatedParams.push_back(calculatedStep); - calculatedParams.push_back(maxRHSX); + calculatedParams.emplace_back(minLHSX); + calculatedParams.emplace_back(calculatedStep); + calculatedParams.emplace_back(maxRHSX); result = calculatedParams; } else { if (inputParams.size() == 1) { std::vector<double> calculatedParams; - calculatedParams.push_back(minLHSX); - calculatedParams.push_back(inputParams.front()); // Use the step supplied. - calculatedParams.push_back(maxRHSX); + calculatedParams.emplace_back(minLHSX); + calculatedParams.emplace_back( + inputParams.front()); // Use the step supplied. + calculatedParams.emplace_back(maxRHSX); result = calculatedParams; } else { result = inputParams; // user has provided params. Use those. @@ -341,19 +342,19 @@ MatrixWorkspace_sptr Stitch1D::rebin(MatrixWorkspace_sptr &input, for (size_t j = 0; j < sourceY.size(); ++j) { const double value = sourceY[j]; if (std::isnan(value)) { - nanYIndexes.push_back(j); + nanYIndexes.emplace_back(j); sourceY[j] = 0; } else if (std::isinf(value)) { - infYIndexes.push_back(j); + infYIndexes.emplace_back(j); sourceY[j] = 0; } const double eValue = sourceE[j]; if (std::isnan(eValue)) { - nanEIndexes.push_back(j); + nanEIndexes.emplace_back(j); sourceE[j] = 0; } else if (std::isinf(eValue)) { - infEIndexes.push_back(j); + infEIndexes.emplace_back(j); sourceE[j] = 0; } } diff --git a/Framework/Algorithms/src/SumEventsByLogValue.cpp b/Framework/Algorithms/src/SumEventsByLogValue.cpp index 6b234ca07f08fafb0c2484d04dec1767c324895b..b02adf54763e7e67c59e1c0319b201b77682c000 100644 --- a/Framework/Algorithms/src/SumEventsByLogValue.cpp +++ b/Framework/Algorithms/src/SumEventsByLogValue.cpp @@ -403,7 +403,7 @@ void SumEventsByLogValue::createBinnedOutput( // If only the number of bins was given, add the min & max values of the log if (m_binningParams.size() == 1) { m_binningParams.insert(m_binningParams.begin(), log->minValue()); - m_binningParams.push_back( + m_binningParams.emplace_back( log->maxValue() * 1.000001); // Make it a tiny bit larger to cover full range } diff --git a/Framework/Algorithms/src/SumOverlappingTubes.cpp b/Framework/Algorithms/src/SumOverlappingTubes.cpp index 5b9861386a64366543acb18ee9a2b7efc513aa92..8c423dda3144dfad9cf0dbf252c744f14612b13a 100644 --- a/Framework/Algorithms/src/SumOverlappingTubes.cpp +++ b/Framework/Algorithms/src/SumOverlappingTubes.cpp @@ -246,23 +246,23 @@ void SumOverlappingTubes::getHeightAxis(const std::string &componentName) { if (heightBinning.size() == 2 && (posY < heightBinning[0] || posY > heightBinning[1])) continue; - m_heightAxis.push_back(posY); + m_heightAxis.emplace_back(posY); } } else { if (heightBinning.size() != 3) { if (heightBinning.size() == 2 && m_outputType == "1D") { - m_heightAxis.push_back(heightBinning[0]); - m_heightAxis.push_back(heightBinning[1]); + m_heightAxis.emplace_back(heightBinning[0]); + m_heightAxis.emplace_back(heightBinning[1]); } else throw std::runtime_error("Height binning must have start, step and end " "values (except for 1D option)."); } else if (m_outputType == "1D") { - m_heightAxis.push_back(heightBinning[0]); - m_heightAxis.push_back(heightBinning[2]); + m_heightAxis.emplace_back(heightBinning[0]); + m_heightAxis.emplace_back(heightBinning[2]); } else { double height = heightBinning[0]; while (height < heightBinning[2]) { - m_heightAxis.push_back(height); + m_heightAxis.emplace_back(height); height += heightBinning[1]; } } diff --git a/Framework/Algorithms/src/UnwrapMonitor.cpp b/Framework/Algorithms/src/UnwrapMonitor.cpp index f6d8eac47818af9924ebaf4a62a120f2e738f2e9..77019c9fa977910b23011048c1695cf1b5ae1b7e 100644 --- a/Framework/Algorithms/src/UnwrapMonitor.cpp +++ b/Framework/Algorithms/src/UnwrapMonitor.cpp @@ -209,7 +209,7 @@ const std::vector<int> UnwrapMonitor::unwrapX(std::vector<double> &newX, // First deal with bins where m_Tmin < tof < T2 if (tof < T2) { const double wavelength = (m_conversionConstant * tof) / Ld; - tempX_L.push_back(wavelength); + tempX_L.emplace_back(wavelength); // Record the bins that fall in this range for copying over the data & // errors if (binRange[0] == -1) @@ -220,7 +220,7 @@ const std::vector<int> UnwrapMonitor::unwrapX(std::vector<double> &newX, else if (tof > T1) { const double velocity = Ld / (tof - m_Tmax + m_Tmin); const double wavelength = m_conversionConstant / velocity; - newX.push_back(wavelength); + newX.emplace_back(wavelength); // Remove the duplicate boundary bin if (tof == m_Tmax && std::abs(wavelength - tempX_L.front()) < 1.0e-5) newX.pop_back(); diff --git a/Framework/Algorithms/src/UnwrapMonitorsInTOF.cpp b/Framework/Algorithms/src/UnwrapMonitorsInTOF.cpp index a5015fecb7694ec1caf277bd8ce7bd1479b8da92..29ed71f5ca8e742e6aa280a39508e619b5a9f1de 100644 --- a/Framework/Algorithms/src/UnwrapMonitorsInTOF.cpp +++ b/Framework/Algorithms/src/UnwrapMonitorsInTOF.cpp @@ -244,7 +244,7 @@ getWorkspaceIndicesForMonitors(Mantid::API::MatrixWorkspace *workspace) { auto spectrumNumber = spectrum.getSpectrumNo(); auto workspaceIndex = workspace->getIndexFromSpectrumNumber(spectrumNumber); - workspaceIndices.push_back(workspaceIndex); + workspaceIndices.emplace_back(workspaceIndex); } } else { auto numberOfHistograms = workspace->getNumberHistograms(); @@ -252,7 +252,7 @@ getWorkspaceIndicesForMonitors(Mantid::API::MatrixWorkspace *workspace) { for (size_t workspaceIndex = 0; workspaceIndex < numberOfHistograms; ++workspaceIndex) { if (spectrumInfo.isMonitor(workspaceIndex)) { - workspaceIndices.push_back(workspaceIndex); + workspaceIndices.emplace_back(workspaceIndex); } } } diff --git a/Framework/Algorithms/src/UnwrapSNS.cpp b/Framework/Algorithms/src/UnwrapSNS.cpp index c98ba915b1bb39669fc76751da0584a29c838aa1..ac39530d2ee549dd393e37f36b46a8f154d82b12 100644 --- a/Framework/Algorithms/src/UnwrapSNS.cpp +++ b/Framework/Algorithms/src/UnwrapSNS.cpp @@ -241,13 +241,13 @@ int UnwrapSNS::unwrapX(const Mantid::HistogramData::HistogramX &datain, // iteration of the loop const double tof = datain[bin]; if (tof < filterVal) { - tempX_L.push_back(tof + m_frameWidth); + tempX_L.emplace_back(tof + m_frameWidth); // Record the bins that fall in this range for copying over the data & // errors if (specialBin < bin) specialBin = bin; } else { - tempX_U.push_back(tof); + tempX_U.emplace_back(tof); } } // loop over X values diff --git a/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp b/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp index 9d83dfa86dc482e6d7d767369f6a990815d52759..e86e30e5fd7bf97c24694f820f6fe1540d6b5014 100644 --- a/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp +++ b/Framework/Algorithms/src/VesuvioL1ThetaResolution.cpp @@ -412,8 +412,8 @@ void VesuvioL1ThetaResolution::calculateDetector( // Convert angle to degrees angle *= 180.0 / M_PI; - l1Values.push_back(l1); - thetaValues.push_back(angle); + l1Values.emplace_back(l1); + thetaValues.emplace_back(angle); } interruption_point(); diff --git a/Framework/Algorithms/test/AppendSpectraTest.h b/Framework/Algorithms/test/AppendSpectraTest.h index 47932723c412963cf4e9b33a97c542b58a12d13b..21836107598ff792d10c276c6372eecbdfa210f5 100644 --- a/Framework/Algorithms/test/AppendSpectraTest.h +++ b/Framework/Algorithms/test/AppendSpectraTest.h @@ -442,12 +442,12 @@ private: std::vector<double> dataY; for (auto i = 0; i < nspec; ++i) { - YVals.push_back(axisValue); + YVals.emplace_back(axisValue); } for (int i = 0; i < 100; ++i) { - dataX.push_back(double(i)); - dataY.push_back(double(i)); + dataX.emplace_back(double(i)); + dataY.emplace_back(double(i)); } auto createWS = Mantid::API::FrameworkManager::Instance().createAlgorithm( diff --git a/Framework/Algorithms/test/BinaryOperationTest.h b/Framework/Algorithms/test/BinaryOperationTest.h index 293dabc3d6fe80e857ad315a36e5ae5179d0201c..a9736af95eb5dd0e53d87566bf9fe5422158be21 100644 --- a/Framework/Algorithms/test/BinaryOperationTest.h +++ b/Framework/Algorithms/test/BinaryOperationTest.h @@ -322,9 +322,9 @@ public: std::vector<std::vector<int>> lhs(6), rhs(2); for (int i = 0; i < 6; i++) { // one detector per pixel in lhs - lhs[i].push_back(i); + lhs[i].emplace_back(i); // 3 detectors in each on the rhs - rhs[i / 3].push_back(i); + rhs[i / 3].emplace_back(i); } auto table = do_test_buildBinaryOperationTable(lhs, rhs); for (int i = 0; i < 6; i++) { diff --git a/Framework/Algorithms/test/CalculatePlaczekSelfScatteringTest.h b/Framework/Algorithms/test/CalculatePlaczekSelfScatteringTest.h index df47490ac0670c90455586db6db45a1968e011a8..a5f075a41e3696d61e545ac7b63635913f2134b2 100644 --- a/Framework/Algorithms/test/CalculatePlaczekSelfScatteringTest.h +++ b/Framework/Algorithms/test/CalculatePlaczekSelfScatteringTest.h @@ -38,7 +38,7 @@ generateIncidentSpectrum(const Mantid::HistogramData::HistogramX &lambda, double term1 = phiMax * (pow(lambdaT, 4.0) / pow((x + dx), 5.0)) * exp(-pow((lambdaT / (x + dx)), 2.0)); double term2 = phiEpi * deltaTerm / (pow((x + dx), (1.0 + 2.0 * alpha))); - amplitude.push_back(term1 + term2); + amplitude.emplace_back(term1 + term2); } } return amplitude; @@ -61,7 +61,7 @@ generateIncidentSpectrumPrime(const Mantid::HistogramData::HistogramX &lambda, double term2 = -phiEpi / pow((x + dx), (1.0 + 2.0 * alpha)) * deltaTerm * ((1.0 + 2.0 * alpha) / (x + dx) + (1 / deltaTerm - 1) / lambda2 * deltaTerm); - amplitude.push_back(term1 + term2); + amplitude.emplace_back(term1 + term2); } } return amplitude; @@ -76,12 +76,12 @@ MatrixWorkspace_sptr generateIncidentSpectrum() { std::vector<double> y; std::vector<double> yPrime; for (int i = 0; i < (xEnd - xStart) / xInc; i++) { - x.push_back(xStart + i * xInc); + x.emplace_back(xStart + i * xInc); } y = generateIncidentSpectrum(x); yPrime = generateIncidentSpectrumPrime(x); for (double prime : yPrime) { - y.push_back(prime); + y.emplace_back(prime); } Algorithm_sptr alg = AlgorithmManager::Instance().createUnmanaged("CreateWorkspace"); diff --git a/Framework/Algorithms/test/ClearCacheTest.h b/Framework/Algorithms/test/ClearCacheTest.h index c1273a44b500f3c21551c2956f354cdb944e1bfa..b3f8c8121c987cba0e2347b4810daa9be7dd78a3 100644 --- a/Framework/Algorithms/test/ClearCacheTest.h +++ b/Framework/Algorithms/test/ClearCacheTest.h @@ -53,7 +53,7 @@ public: void createDirectory(Poco::Path path) { Poco::File file(path); if (file.createDirectory()) { - m_directoriesToRemove.push_back(file); + m_directoriesToRemove.emplace_back(file); } } diff --git a/Framework/Algorithms/test/ConjoinXRunsTest.h b/Framework/Algorithms/test/ConjoinXRunsTest.h index bbb091e64a786970fb50e6824c313a71e976f3fa..b495f861bab991946b2c72623776dd36846a57a2 100644 --- a/Framework/Algorithms/test/ConjoinXRunsTest.h +++ b/Framework/Algorithms/test/ConjoinXRunsTest.h @@ -395,7 +395,7 @@ public: create2DWorkspace123(2000, 100, false, std::set<int64_t>(), true); std::string name = "ws" + std::to_string(i); storeWS(name, ws); - m_ws.push_back(name); + m_ws.emplace_back(name); } m_alg.initialize(); m_alg.isChild(); diff --git a/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h b/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h index 8c8ec6844e44b6a4c948b9fabdf65745fcf33cd6..cc5f6f5bd2682643ee885f640d199e9b0176c58b 100644 --- a/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h +++ b/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h @@ -302,19 +302,19 @@ private: constexpr double binWidth = 0.1; for (size_t i = 0; i < 100; ++i) { const double x = binWidth * static_cast<double>(i); - xData.push_back(x); + xData.emplace_back(x); const double y = background(x); - yData.push_back(isHisto && plotsNormalised ? y * binWidth : y); - eData.push_back(0.0); + yData.emplace_back(isHisto && plotsNormalised ? y * binWidth : y); + eData.emplace_back(0.0); } if (isHisto) { // add last bin edge - xData.push_back(10.0); + xData.emplace_back(10.0); } else { // add extra point - xData.push_back(10.0); - yData.push_back(background(10.0)); - eData.push_back(0.0); + xData.emplace_back(10.0); + yData.emplace_back(background(10.0)); + eData.emplace_back(0.0); } auto alg = Mantid::API::AlgorithmFactory::Instance().create("CreateWorkspace", 1); diff --git a/Framework/Algorithms/test/DetectorEfficiencyCorTest.h b/Framework/Algorithms/test/DetectorEfficiencyCorTest.h index 8558531cd33e17212f7a28334eb7b99344987c86..aefbec59386e24a3edf128ad49f0739bf666aaf6 100644 --- a/Framework/Algorithms/test/DetectorEfficiencyCorTest.h +++ b/Framework/Algorithms/test/DetectorEfficiencyCorTest.h @@ -138,7 +138,7 @@ private: detector->setPos(i * 0.2, i * 0.2, 5); instrument->add(detector); instrument->markAsDetector(detector); - detectors.push_back(detector); + detectors.emplace_back(detector); } ObjComponent *sample = new ObjComponent("sample", shape, nullptr); sample->setPos(0, 0, 0); diff --git a/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h b/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h index 3d8bc438ef2dcee7275e024c3abfdb9c28117f4a..60fe10aeb29bd6ae2a25fedd461a8dbadc4b5d10 100644 --- a/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h +++ b/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h @@ -137,11 +137,11 @@ public: std::vector<double> forInputA, forInputB; // the spectravalues will be multiples of the random numbers above for (double y : yArray) { - forInputA.push_back(y); + forInputA.emplace_back(y); // there is going to be a small difference between the workspaces that // will vary with histogram number - forInputB.push_back(forInputA.back() * - (1 + m_ramp * (j - (Nhist / 2)))); + forInputB.emplace_back(forInputA.back() * + (1 + m_ramp * (j - (Nhist / 2)))); } // insert a particularly large value to pick up later m_LargeValue = 3.1; diff --git a/Framework/Algorithms/test/ExtractMaskToTableTest.h b/Framework/Algorithms/test/ExtractMaskToTableTest.h index 04842abfea8bfb4d9891850a7e1e5476bdcf792d..55e781fcb663f643d092500b5eb0df581d2f9b3e 100644 --- a/Framework/Algorithms/test/ExtractMaskToTableTest.h +++ b/Framework/Algorithms/test/ExtractMaskToTableTest.h @@ -50,7 +50,7 @@ public: // Case: A constains B vecA.reserve(20); for (size_t i = 0; i < 20; ++i) { - vecA.push_back(static_cast<int>(i) + 5); + vecA.emplace_back(static_cast<int>(i) + 5); } vector<int> vecB{6, 10, 14, 18}; @@ -65,10 +65,10 @@ public: vecB.clear(); for (int i = 0; i < 10; ++i) - vecA.push_back(i * 3); + vecA.emplace_back(i * 3); for (int i = 0; i < 10; ++i) - vecB.push_back(i + 10); + vecB.emplace_back(i + 10); vecC = alg.subtractVector(vecA, vecB); @@ -79,14 +79,14 @@ public: vecB.clear(); for (int i = 0; i < 10; ++i) - vecA.push_back(5 + i * 2); + vecA.emplace_back(5 + i * 2); for (int i = 0; i < 3; ++i) - vecB.push_back(i + 1); + vecB.emplace_back(i + 1); for (int i = 0; i < 10; ++i) - vecB.push_back(i + 10); - vecB.push_back(25); - vecB.push_back(30); + vecB.emplace_back(i + 10); + vecB.emplace_back(25); + vecB.emplace_back(30); vecC = alg.subtractVector(vecA, vecB); diff --git a/Framework/Algorithms/test/FFTTest.h b/Framework/Algorithms/test/FFTTest.h index 85872624394c891812d08634ce16b01bc7e639df..e84e44ab7c7e631e57a8a94b82f2e4dbedaf1987 100644 --- a/Framework/Algorithms/test/FFTTest.h +++ b/Framework/Algorithms/test/FFTTest.h @@ -825,17 +825,17 @@ private: // real spectrum for (size_t i = 0; i < n; i++) { double x = 2.0 * M_PI * double(i) / double(n); - X.push_back(x); - Y.push_back(cos(omega * x)); - E.push_back(0.1); + X.emplace_back(x); + Y.emplace_back(cos(omega * x)); + E.emplace_back(0.1); } // imaginary spectrum for (size_t i = n; i < 2 * n; i++) { double j = (double)(i - n); double x = 2.0 * M_PI * j / double(n); - X.push_back(x); - Y.push_back(sin(omega * x)); - E.push_back(0.1); + X.emplace_back(x); + Y.emplace_back(sin(omega * x)); + E.emplace_back(0.1); } auto create = FrameworkManager::Instance().createAlgorithm("CreateWorkspace"); @@ -860,21 +860,21 @@ private: // real spectrum for (size_t i = 0; i < n; i++) { double x = (2.0 * M_PI * double(i) / double(n)) + factor; - X.push_back(x); + X.emplace_back(x); double y = cos(omega * x); y *= exp(-1.0 * (pow((x - x0) * sigma, 2.0))); - Y.push_back(y); - E.push_back(0.1); + Y.emplace_back(y); + E.emplace_back(0.1); } // imaginary spectrum for (size_t i = n; i < 2 * n; i++) { double j = (double)(i - n); double x = (2.0 * M_PI * j / double(n)) + factor; - X.push_back(x); + X.emplace_back(x); double y = sin(omega * x); y *= exp(-1.0 * (pow((x - x0) * sigma, 2.0))); - Y.push_back(y); - E.push_back(0.1); + Y.emplace_back(y); + E.emplace_back(0.1); } auto create = FrameworkManager::Instance().createAlgorithm("CreateWorkspace"); @@ -902,7 +902,7 @@ private: for (size_t i = 0; i < 2; ++i) { // spectra for (size_t j = 0; j < n + 1; ++j) { const double x = ((10.0 * double(j)) / double(n)) - x0; - X.push_back(x); + X.emplace_back(x); } } HistogramData::Histogram histogram(HistogramData::BinEdges{X}); @@ -912,16 +912,16 @@ private: const double x = points[i]; const double yImag = sin(omega * x + ww * x * x) * exp(-pow(((x - xc) * sigma), 4)); - Y.push_back(yImag); - E.push_back(0.1); + Y.emplace_back(yImag); + E.emplace_back(0.1); } // real spectrum for (size_t i = 0; i < n; ++i) { const double x = points[i]; const double yReal = cos(omega * x + ww * x * x) * exp(-pow(((x - xc) * sigma), 4)); - Y.push_back(yReal); - E.push_back(0.1); + Y.emplace_back(yReal); + E.emplace_back(0.1); } // create workspace auto create = @@ -962,13 +962,13 @@ private: // Bin edges for (size_t i = 0; i < xSize; ++i) { const double x = ((10.0 * double(i)) / double(n)) - x0; - X.push_back(x); + X.emplace_back(x); } // Y values for (size_t i = 0; i < n; ++i) { const double xp = isHisto ? 0.5 * (X[i] + X[i + 1]) : X[i]; const double y = cos(omega * xp) * exp(-pow((xp * sigma), 4)); - Y.push_back(y); + Y.emplace_back(y); } // create workspace auto create = diff --git a/Framework/Algorithms/test/FilterEventsTest.h b/Framework/Algorithms/test/FilterEventsTest.h index 62e015e9c1dcb77e0da163ddd1998c459fa3f475..1298fe5bfc7cf057d1b06f818c927bb20ed26cff 100644 --- a/Framework/Algorithms/test/FilterEventsTest.h +++ b/Framework/Algorithms/test/FilterEventsTest.h @@ -1017,8 +1017,8 @@ public: filter.setProperty("OutputWorkspaceIndexedFrom1", true); std::vector<std::string> prop_vec; - prop_vec.push_back("LogB"); - prop_vec.push_back("slow_int_log"); + prop_vec.emplace_back("LogB"); + prop_vec.emplace_back("slow_int_log"); filter.setProperty("TimeSeriesPropertyLogs", prop_vec); filter.setProperty("ExcludeSpecifiedLogs", true); @@ -1543,23 +1543,23 @@ public: std::vector<int64_t> time_vec; std::vector<int> index_vec; - time_vec.push_back(runstart_i64); + time_vec.emplace_back(runstart_i64); // Splitter 0: 0 ~ 3+ (first pulse) int64_t t1 = runstart_i64 + tofdt * 3 + tofdt / 2; - time_vec.push_back(t1); - index_vec.push_back(0); + time_vec.emplace_back(t1); + index_vec.emplace_back(0); // Splitter 1: 3+ ~ 9+ (second pulse) int64_t t2 = runstart_i64 + pulsedt + tofdt * 9 + tofdt / 2; - time_vec.push_back(t2); - index_vec.push_back(1); + time_vec.emplace_back(t2); + index_vec.emplace_back(1); // Splitter 2 and so on: from 3rd pulse, 0 ~ 6+ for (size_t i = 2; i < 5; i++) { int64_t newT = runstart_i64 + i * pulsedt + 6 * tofdt + tofdt / 2; - time_vec.push_back(newT); - index_vec.push_back(2); + time_vec.emplace_back(newT); + index_vec.emplace_back(2); } // Create the workspace and set it diff --git a/Framework/Algorithms/test/FitPeakTest.h b/Framework/Algorithms/test/FitPeakTest.h index e4ddc7228bffbfa1ed26179df0f287de0430d4c0..043880072033e4aeeb614f5af881c75fd759454b 100644 --- a/Framework/Algorithms/test/FitPeakTest.h +++ b/Framework/Algorithms/test/FitPeakTest.h @@ -170,13 +170,13 @@ public: parvalues.clear(); parnames.emplace_back("Height"); - parvalues.push_back(1.0); + parvalues.emplace_back(1.0); parnames.emplace_back("PeakCentre"); - parvalues.push_back(0.5936); + parvalues.emplace_back(0.5936); parnames.emplace_back("Sigma"); - parvalues.push_back(0.01); + parvalues.emplace_back(0.01); return; } @@ -189,13 +189,13 @@ public: parvalues.clear(); parnames.emplace_back("A0"); - parvalues.push_back(1000.); + parvalues.emplace_back(1000.); parnames.emplace_back("A1"); - parvalues.push_back(-10.); + parvalues.emplace_back(-10.); parnames.emplace_back("A2"); - parvalues.push_back(0.01); + parvalues.emplace_back(0.01); return; } @@ -404,10 +404,10 @@ public: parvalues.clear(); parnames.emplace_back("A0"); - parvalues.push_back(48000.); + parvalues.emplace_back(48000.); parnames.emplace_back("A1"); - parvalues.push_back(-60010.); + parvalues.emplace_back(-60010.); return; } diff --git a/Framework/Algorithms/test/FitPeaksTest.h b/Framework/Algorithms/test/FitPeaksTest.h index ce83ef160c0710dad7ae335ca3bc92d4f245906d..74c92eb416d17a109c4b3c83ea8422f72cd99606 100644 --- a/Framework/Algorithms/test/FitPeaksTest.h +++ b/Framework/Algorithms/test/FitPeaksTest.h @@ -73,7 +73,7 @@ public: // create a 1-value peak index vector for peak (0) at X=5 std::vector<int> peak_index_vec; - peak_index_vec.push_back(0); + peak_index_vec.emplace_back(0); const std::string ws_name("peakcenter1"); const std::string peak_center_ws_name = genPeakCenterWorkspace(peak_index_vec, ws_name); @@ -846,19 +846,19 @@ public: parvalues.clear(); parnames.emplace_back("I"); - parvalues.push_back(2.5e+06); + parvalues.emplace_back(2.5e+06); parnames.emplace_back("A"); - parvalues.push_back(5400); + parvalues.emplace_back(5400); parnames.emplace_back("B"); - parvalues.push_back(1700); + parvalues.emplace_back(1700); parnames.emplace_back("X0"); - parvalues.push_back(1.07); + parvalues.emplace_back(1.07); parnames.emplace_back("S"); - parvalues.push_back(0.000355); + parvalues.emplace_back(0.000355); return; } @@ -1009,13 +1009,13 @@ public: parvalues.clear(); parnames.emplace_back("Height"); - parvalues.push_back(2.5e+06); + parvalues.emplace_back(2.5e+06); parnames.emplace_back("Sigma"); - parvalues.push_back(0.1); + parvalues.emplace_back(0.1); parnames.emplace_back("PeakCentre"); - parvalues.push_back(10.0); + parvalues.emplace_back(10.0); return; } diff --git a/Framework/Algorithms/test/GenerateEventsFilterTest.h b/Framework/Algorithms/test/GenerateEventsFilterTest.h index 590be04d14f1188db0e17f4678d0035b962cda9a..0b2d146857fb1e78be9d8e3b5faa2ee6a1abafd9 100644 --- a/Framework/Algorithms/test/GenerateEventsFilterTest.h +++ b/Framework/Algorithms/test/GenerateEventsFilterTest.h @@ -1041,9 +1041,9 @@ public: alg.initialize(); std::vector<double> vectimeintervals; - vectimeintervals.push_back(static_cast<double>(timeinterval_ns)); - vectimeintervals.push_back(static_cast<double>(timeinterval_ns) * 2.); - vectimeintervals.push_back(static_cast<double>(timeinterval_ns) * 3.); + vectimeintervals.emplace_back(static_cast<double>(timeinterval_ns)); + vectimeintervals.emplace_back(static_cast<double>(timeinterval_ns) * 2.); + vectimeintervals.emplace_back(static_cast<double>(timeinterval_ns) * 3.); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InputWorkspace", "TestEventWorkspace08v")); TS_ASSERT_THROWS_NOTHING( @@ -1162,7 +1162,7 @@ public: int wsindex = static_cast<int>(vecY[i]); Kernel::SplittingInterval ti(tstart, tstop, wsindex); - splitters.push_back(ti); + splitters.emplace_back(ti); ++numsplitters; } } diff --git a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h index 8c8cd7d32cbf388cac4fe2b140c4ad6d8d2cb819..b376ad68ccb9c22dce4b367f1a7ec7a2e12de4d2 100644 --- a/Framework/Algorithms/test/GenerateIPythonNotebookTest.h +++ b/Framework/Algorithms/test/GenerateIPythonNotebookTest.h @@ -96,7 +96,7 @@ public: int lineCount = 0; std::vector<std::string> notebookLines; while (std::getline(file, notebookLine)) { - notebookLines.push_back(notebookLine); + notebookLines.emplace_back(notebookLine); if (lineCount < 8) { TS_ASSERT_EQUALS(result[lineCount], notebookLine); lineCount++; diff --git a/Framework/Algorithms/test/GroupWorkspacesTest.h b/Framework/Algorithms/test/GroupWorkspacesTest.h index e1e1043594512f906c1897e29765856dd73c6694..c13e9309e75aec571913e3ef0f34bc6a9a30fc61 100644 --- a/Framework/Algorithms/test/GroupWorkspacesTest.h +++ b/Framework/Algorithms/test/GroupWorkspacesTest.h @@ -135,7 +135,7 @@ public: // Assert groupNames.reserve(4); - groupNames.push_back(singleWS); + groupNames.emplace_back(singleWS); checkGroupExistsWithMembers(finalGroupName, groupNames); TS_ASSERT_EQUALS( false, diff --git a/Framework/Algorithms/test/MagFormFactorCorrectionTest.h b/Framework/Algorithms/test/MagFormFactorCorrectionTest.h index 0bc701f3e7c3de9acc773c237da93cbb3ee163b8..4efd705612cbf626e739cd93b268874de9d0f666 100644 --- a/Framework/Algorithms/test/MagFormFactorCorrectionTest.h +++ b/Framework/Algorithms/test/MagFormFactorCorrectionTest.h @@ -99,11 +99,11 @@ private: std::vector<double> X, Y; for (int64_t i = 0; i < nbins; i++) { - X.push_back((double)i * 0.5); - Y.push_back(std::exp(-(double)i * invfourPiSqr)); + X.emplace_back((double)i * 0.5); + Y.emplace_back(std::exp(-(double)i * invfourPiSqr)); } if (isHistogram) { - X.push_back(nbins + 0.5); + X.emplace_back(nbins + 0.5); } MatrixWorkspace_sptr ws = WorkspaceFactory::Instance().create( "Workspace2D", nspecs, isHistogram ? (nbins + 1) : nbins, nbins); diff --git a/Framework/Algorithms/test/MaskBinsFromTableTest.h b/Framework/Algorithms/test/MaskBinsFromTableTest.h index a1d5d6bee1ab29ece5e3d724e1baaded79463572..45b671d41bed43591f10e902ce38110228705931 100644 --- a/Framework/Algorithms/test/MaskBinsFromTableTest.h +++ b/Framework/Algorithms/test/MaskBinsFromTableTest.h @@ -185,10 +185,10 @@ public: // b) Table Line 1 std::vector<int> speclist; - speclist.push_back(5); - speclist.push_back(6); - speclist.push_back(7); - speclist.push_back(8); + speclist.emplace_back(5); + speclist.emplace_back(6); + speclist.emplace_back(7); + speclist.emplace_back(8); for (int spectrum : speclist) { auto &yvec = WS->y(spectrum); for (size_t bin = 0; bin < yvec.size(); ++bin) { diff --git a/Framework/Algorithms/test/MergeRunsTest.h b/Framework/Algorithms/test/MergeRunsTest.h index 518d0d2908b3ff463f29e9ae3696297cbe4d5741..d5e044380b0f950f97d2aca85b0ac42a625c144a 100644 --- a/Framework/Algorithms/test/MergeRunsTest.h +++ b/Framework/Algorithms/test/MergeRunsTest.h @@ -373,7 +373,7 @@ public: va_list vl; va_start(vl, num); for (int i = 0; i < num; i++) - retVal.push_back(va_arg(vl, int)); + retVal.emplace_back(va_arg(vl, int)); return retVal; } @@ -418,8 +418,8 @@ public: std::vector<std::vector<int>> groups; groups.clear(); - groups.push_back(makeVector(3, 0, 1, 2)); - groups.push_back(makeVector(3, 3, 4, 5)); + groups.emplace_back(makeVector(3, 0, 1, 2)); + groups.emplace_back(makeVector(3, 3, 4, 5)); evg1 = WorkspaceCreationHelper::createGroupedEventWorkspace(groups, 100); AnalysisDataService::Instance().addOrReplace( "evg1", boost::dynamic_pointer_cast<MatrixWorkspace>(evg1)); @@ -433,9 +433,9 @@ public: TS_ASSERT(evg1->getSpectrum(1).hasDetectorID(3)); groups.clear(); - groups.push_back(makeVector(2, 3, 4)); - groups.push_back(makeVector(3, 0, 1, 2)); - groups.push_back(makeVector(1, 15)); + groups.emplace_back(makeVector(2, 3, 4)); + groups.emplace_back(makeVector(3, 0, 1, 2)); + groups.emplace_back(makeVector(1, 15)); evg2 = WorkspaceCreationHelper::createGroupedEventWorkspace(groups, 100); AnalysisDataService::Instance().addOrReplace( "evg2", boost::dynamic_pointer_cast<MatrixWorkspace>(evg2)); diff --git a/Framework/Algorithms/test/PaddingAndApodizationTest.h b/Framework/Algorithms/test/PaddingAndApodizationTest.h index 911bec7843c67e072e80d0b2110c086e2c933176..6d4c1192a2e080b4f1f0ff027a65cff570c09f53 100644 --- a/Framework/Algorithms/test/PaddingAndApodizationTest.h +++ b/Framework/Algorithms/test/PaddingAndApodizationTest.h @@ -104,7 +104,7 @@ public: void test_SpectrumList() { std::vector<MatrixWorkspace_sptr> workspaces; - workspaces.push_back(createWorkspace(2, 50)); + workspaces.emplace_back(createWorkspace(2, 50)); // First, run the algorithm without specifying any spectrum @@ -113,14 +113,14 @@ public: alg1->execute(); TS_ASSERT(alg1->isExecuted()); - workspaces.push_back(alg1->getProperty("OutputWorkspace")); + workspaces.emplace_back(alg1->getProperty("OutputWorkspace")); // Then run the algorithm on the second spectrum only IAlgorithm_sptr alg2 = setUpAlg(); alg2->setProperty("InputWorkspace", workspaces[0]); alg2->execute(); TS_ASSERT(alg2->isExecuted()); - workspaces.push_back(alg2->getProperty("OutputWorkspace")); + workspaces.emplace_back(alg2->getProperty("OutputWorkspace")); for (int j = 0; j < 3; j++) { if (j != 0) { // check we have 2 spectra @@ -278,8 +278,8 @@ public: std::vector<double> xData, yData; for (int j = 0; j < 50; j++) { - xData.push_back(double(j)); - yData.push_back(double(j)); + xData.emplace_back(double(j)); + yData.emplace_back(double(j)); } IAlgorithm_sptr makeWS = diff --git a/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h b/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h index 5ac0f6c71d2a6dad1fb28e9b268d479cc60bc84f..56e9b68b2df19d712c2e1d31599c8809fa57abc8 100644 --- a/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h +++ b/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h @@ -436,7 +436,7 @@ private: std::vector<MatrixWorkspace_sptr> workspaces; for (int i = 0; i < n; ++i) { auto ws = create1DWorkspaceConstant(5, 2.0, 1.0, true); - workspaces.push_back(ws); + workspaces.emplace_back(ws); } return workspaces; } @@ -457,7 +457,7 @@ private: auto workspaces = createWorkspaces(n); size_t i = 0; for (auto &ws : workspaces) { - names.push_back("ws_" + std::to_string(i)); + names.emplace_back("ws_" + std::to_string(i)); AnalysisDataService::Instance().addOrReplace(names.back(), ws); ++i; } diff --git a/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h b/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h index cbc4a6bc6030c8775adda0a52cd3101d2f758c66..2b05054243992ce4016e0c7d91a92f2c54320416 100644 --- a/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h +++ b/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h @@ -349,11 +349,11 @@ public: V3D samplePosition = V3D(0.0, 0.0, 0.0); std::vector<double> guideLogDetails; - guideLogDetails.push_back(guideCutoff + 10); - guideLogDetails.push_back(guideCutoff - 10); - guideLogDetails.push_back(guideCutoff + 10); - guideLogDetails.push_back(guideCutoff - 10); - guideLogDetails.push_back(guideCutoff + 10); + guideLogDetails.emplace_back(guideCutoff + 10); + guideLogDetails.emplace_back(guideCutoff - 10); + guideLogDetails.emplace_back(guideCutoff + 10); + guideLogDetails.emplace_back(guideCutoff - 10); + guideLogDetails.emplace_back(guideCutoff + 10); auto testWorkspace = createTestWorkspace( 10, 0, 10, 0.1, collimationMethod, collimationLengthCorrection, @@ -385,11 +385,13 @@ public: V3D samplePosition = V3D(0.0, 0.0, 0.0); std::vector<double> guideLogDetails; - guideLogDetails.push_back(guideCutoff - 10); // Guide 1 -- Is flipped here - guideLogDetails.push_back(guideCutoff + 10); // Guide 2 -- Is flipped here - guideLogDetails.push_back(guideCutoff + 10); // Guide 3 - guideLogDetails.push_back(guideCutoff - 10); // Guide 4 - guideLogDetails.push_back(guideCutoff + 10); // Guide 5 + guideLogDetails.emplace_back(guideCutoff - + 10); // Guide 1 -- Is flipped here + guideLogDetails.emplace_back(guideCutoff + + 10); // Guide 2 -- Is flipped here + guideLogDetails.emplace_back(guideCutoff + 10); // Guide 3 + guideLogDetails.emplace_back(guideCutoff - 10); // Guide 4 + guideLogDetails.emplace_back(guideCutoff + 10); // Guide 5 auto testWorkspace = createTestWorkspace( 10, 0, 10, 0.1, collimationMethod, collimationLengthCorrection, @@ -418,11 +420,15 @@ public: V3D samplePosition = V3D(0.0, 0.0, 0.0); std::vector<double> guideLogDetails; - guideLogDetails.push_back(guideCutoff - 10); // Guide 1 -- Is flipped here - guideLogDetails.push_back(guideCutoff + 10); // Guide 2 -- Is flipped here - guideLogDetails.push_back(guideCutoff - 10); // Guide 3 -- Is flipped here - guideLogDetails.push_back(guideCutoff + 10); // Guide 4 -- Is flipped here - guideLogDetails.push_back(guideCutoff + 10); // Guide 5 + guideLogDetails.emplace_back(guideCutoff - + 10); // Guide 1 -- Is flipped here + guideLogDetails.emplace_back(guideCutoff + + 10); // Guide 2 -- Is flipped here + guideLogDetails.emplace_back(guideCutoff - + 10); // Guide 3 -- Is flipped here + guideLogDetails.emplace_back(guideCutoff + + 10); // Guide 4 -- Is flipped here + guideLogDetails.emplace_back(guideCutoff + 10); // Guide 5 auto testWorkspace = createTestWorkspace( 10, 0, 10, 0.1, collimationMethod, collimationLengthCorrection, diff --git a/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h b/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h index fc8e14ff944953530aa760c0ea62a360cabee811..12dfd4c4a2b4127f2174ceb908b77514c4e3a345 100644 --- a/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h +++ b/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h @@ -268,12 +268,12 @@ public: void test_correct_line_detector_position_many_spec_numbers_equal_averaging() { std::vector<int> specNumbers; - specNumbers.push_back(74); + specNumbers.emplace_back(74); double offset1 = do_test_correct_line_detector_position(specNumbers, 1, "lineardetector"); - specNumbers.push_back(73); // Add spectra below - specNumbers.push_back(75); // Add spectra above + specNumbers.emplace_back(73); // Add spectra below + specNumbers.emplace_back(75); // Add spectra above double offset2 = do_test_correct_line_detector_position(specNumbers, 1, "lineardetector"); @@ -284,12 +284,12 @@ public: void test_correct_line_detector_position_average_offset_by_one_pixel() { std::vector<int> specNumbers; - specNumbers.push_back(100); + specNumbers.emplace_back(100); double offset1 = do_test_correct_line_detector_position( specNumbers, 0.1, "lineardetector"); // Average spectrum number at 100 - specNumbers.push_back(101); - specNumbers.push_back(102); + specNumbers.emplace_back(101); + specNumbers.emplace_back(102); double offset2 = do_test_correct_line_detector_position( specNumbers, 0.1, "lineardetector"); // Average spectrum number now at 101. @@ -301,11 +301,11 @@ public: void test_correct_line_detector_position_average_offset_by_many_pixels() { std::vector<int> specNumbers; - specNumbers.push_back(100); + specNumbers.emplace_back(100); double offset1 = do_test_correct_line_detector_position( specNumbers, 0.1, "lineardetector"); // Average spectrum number at 100 - specNumbers.push_back(104); + specNumbers.emplace_back(104); const bool strictSpectrumCheck = false; double offset2 = do_test_correct_line_detector_position( specNumbers, 0.1, "lineardetector", @@ -319,8 +319,8 @@ public: void test_correct_line_detector_position_throws_with_non_sequential_spec_numbers() { std::vector<int> specNumbers; - specNumbers.push_back(1); - specNumbers.push_back(3); // Missing 2 in sequence. + specNumbers.emplace_back(1); + specNumbers.emplace_back(3); // Missing 2 in sequence. TS_ASSERT_THROWS(do_test_correct_line_detector_position(specNumbers, 0.1, "lineardetector"), std::invalid_argument &); diff --git a/Framework/Algorithms/test/Stitch1DManyTest.h b/Framework/Algorithms/test/Stitch1DManyTest.h index 119a146f58795c5a255ea9c05edf346750e6182d..243cc8729ea68ac151c70063bbb4e6ebf5478aa3 100644 --- a/Framework/Algorithms/test/Stitch1DManyTest.h +++ b/Framework/Algorithms/test/Stitch1DManyTest.h @@ -128,7 +128,7 @@ private: std::vector<std::string> histNames; auto histories = inputWS->history().getAlgorithmHistories(); for (auto &hist : histories) { - histNames.push_back(hist->name()); + histNames.emplace_back(hist->name()); } return histNames; } diff --git a/Framework/Algorithms/test/Stitch1DTest.h b/Framework/Algorithms/test/Stitch1DTest.h index 3adee91c26c7f9ab85109c6d221bf3e41da15f9c..361cb454acb1c8f1e1ba819ec753a2982923f50b 100644 --- a/Framework/Algorithms/test/Stitch1DTest.h +++ b/Framework/Algorithms/test/Stitch1DTest.h @@ -481,7 +481,7 @@ public: std::vector<size_t> overlap_indexes = std::vector<size_t>(); for (size_t itr = 0; itr < stitched_y.size(); ++itr) { if (stitched_y[itr] >= 1.0009 && stitched_y[itr] <= 3.0001) { - overlap_indexes.push_back(itr); + overlap_indexes.emplace_back(itr); } } @@ -508,7 +508,7 @@ public: std::vector<size_t> overlap_indexes = std::vector<size_t>(); for (size_t itr = 0; itr < stitched_y.size(); ++itr) { if (stitched_y[itr] >= 1.0009 && stitched_y[itr] <= 3.0001) { - overlap_indexes.push_back(itr); + overlap_indexes.emplace_back(itr); } } @@ -535,7 +535,7 @@ public: std::vector<size_t> overlap_indexes = std::vector<size_t>(); for (size_t itr = 0; itr < stitched_y.size(); ++itr) { if (stitched_y[itr] >= 1.0009 && stitched_y[itr] <= 3.0001) { - overlap_indexes.push_back(itr); + overlap_indexes.emplace_back(itr); } } diff --git a/Framework/Algorithms/test/SumEventsByLogValueTest.h b/Framework/Algorithms/test/SumEventsByLogValueTest.h index afdec04c0d8fc5dc61bb0121ebe5d0dd9e8bb5ec..a816ea4cbb5ad01dc337b77278d5ec528e4a6be6 100644 --- a/Framework/Algorithms/test/SumEventsByLogValueTest.h +++ b/Framework/Algorithms/test/SumEventsByLogValueTest.h @@ -201,10 +201,10 @@ public: std::vector<double> dbl1, dbl2; DateAndTime startTime("2010-01-01T00:00:00"); for (int i = 0; i < 100; ++i) { - times.push_back(startTime + i * 10.0); - index.push_back(i); - dbl1.push_back(i * 0.1); - dbl2.push_back(6.0); + times.emplace_back(startTime + i * 10.0); + index.emplace_back(i); + dbl1.emplace_back(i * 0.1); + dbl2.emplace_back(6.0); } auto scan_index = new TimeSeriesProperty<int>("scan_index"); diff --git a/Framework/Algorithms/test/SumOverlappingTubesTest.h b/Framework/Algorithms/test/SumOverlappingTubesTest.h index 8eefd2d8d22ebe7b2fb5e68ea76e5a6f5375497e..0526ee502a18cf28dd6feb3736e934f24666819e 100644 --- a/Framework/Algorithms/test/SumOverlappingTubesTest.h +++ b/Framework/Algorithms/test/SumOverlappingTubesTest.h @@ -43,7 +43,7 @@ MatrixWorkspace_sptr createTestScanningWS(size_t nTubes, size_t nPixelsPerTube, std::vector<std::pair<DateAndTime, DateAndTime>> timeRanges; for (size_t i = 0; i < nTimeIndexes; ++i) - timeRanges.push_back(std::make_pair(DateAndTime(i), DateAndTime(i + 1))); + timeRanges.emplace_back(std::make_pair(DateAndTime(i), DateAndTime(i + 1))); ScanningWorkspaceBuilder builder(instrument, nTimeIndexes, nBins); builder.setTimeRanges(timeRanges); @@ -693,7 +693,7 @@ public: for (size_t i = 0; i < m_numberOfWorkspaces; ++i) { std::vector<double> rotations; for (size_t j = 0; j < 25; ++j) - rotations.push_back(double(j * m_numberOfWorkspaces + i) * 0.1); + rotations.emplace_back(double(j * m_numberOfWorkspaces + i) * 0.1); auto testWS = createTestScanningWS(100, 128, rotations, "a" + std::to_string(i)); diff --git a/Framework/Beamline/src/ComponentInfo.cpp b/Framework/Beamline/src/ComponentInfo.cpp index d643b88fabe5c8092f6b92d635d8831839335431..903c9f14f7dd4688220f6375a67dec19d2efaf4a 100644 --- a/Framework/Beamline/src/ComponentInfo.cpp +++ b/Framework/Beamline/src/ComponentInfo.cpp @@ -644,7 +644,7 @@ void ComponentInfo::merge(const ComponentInfo &other) { continue; auto &positions = m_positions.access(); auto &rotations = m_rotations.access(); - m_scanIntervals.push_back(other.m_scanIntervals[timeIndex]); + m_scanIntervals.emplace_back(other.m_scanIntervals[timeIndex]); const size_t indexStart = other.linearIndex({0, timeIndex}); size_t indexEnd = indexStart + nonDetectorSize(); positions.insert(positions.end(), other.m_positions->begin() + indexStart, diff --git a/Framework/Beamline/test/ComponentInfoTest.h b/Framework/Beamline/test/ComponentInfoTest.h index 8b1ce7c2ed4add3ee2a8b850d8c94c1e1baa6c0f..07f9573077f3a569a55bb0c9793db045c9a34acf 100644 --- a/Framework/Beamline/test/ComponentInfoTest.h +++ b/Framework/Beamline/test/ComponentInfoTest.h @@ -38,7 +38,7 @@ std::tuple<boost::shared_ptr<ComponentInfo>, boost::shared_ptr<DetectorInfo>> makeFlatTree(PosVec detPositions, RotVec detRotations) { std::vector<std::pair<size_t, size_t>> componentRanges; auto rootIndex = detPositions.size(); - componentRanges.push_back( + componentRanges.emplace_back( std::make_pair(0, 1)); // sub-assembly (contains root only) auto bankSortedDetectorIndices = boost::make_shared<std::vector<size_t>>(detPositions.size()); @@ -134,15 +134,15 @@ makeTreeExampleAndReturnGeometricArguments() { std::vector<size_t>{3, 3, 4, 4, 4}); std::vector<std::pair<size_t, size_t>> detectorRanges; - detectorRanges.push_back( + detectorRanges.emplace_back( std::make_pair(0, 2)); // sub-assembly (registered first) - detectorRanges.push_back( + detectorRanges.emplace_back( std::make_pair(0, 3)); // instrument-assembly (with 3 detectors) std::vector<std::pair<size_t, size_t>> componentRanges; - componentRanges.push_back( + componentRanges.emplace_back( std::make_pair(0, 1)); // sub-assembly (contains self) - componentRanges.push_back(std::make_pair( + componentRanges.emplace_back(std::make_pair( 0, 2)); // instrument assembly (with 1 sub-component and self) // Set non-detectors at different positions @@ -206,13 +206,13 @@ makeTreeExample() { auto parentIndices = boost::make_shared<const std::vector<size_t>>( std::vector<size_t>{3, 3, 4, 4, 4}); std::vector<std::pair<size_t, size_t>> detectorRanges; - detectorRanges.push_back(std::make_pair(0, 2)); - detectorRanges.push_back(std::make_pair(0, 3)); + detectorRanges.emplace_back(std::make_pair(0, 2)); + detectorRanges.emplace_back(std::make_pair(0, 3)); std::vector<std::pair<size_t, size_t>> componentRanges; - componentRanges.push_back( + componentRanges.emplace_back( std::make_pair(0, 1)); // sub-assembly (contains self) - componentRanges.push_back(std::make_pair( + componentRanges.emplace_back(std::make_pair( 0, 2)); // instrument assembly (with 1 sub-component and self) auto positions = boost::make_shared<PosVec>( diff --git a/Framework/Catalog/src/ONCatEntity.cpp b/Framework/Catalog/src/ONCatEntity.cpp index 45a930fee65c99b166cabb79eaff16d7e6513a09..5faa832bc696b95e36b35cb3b27337cfeea523ad 100644 --- a/Framework/Catalog/src/ONCatEntity.cpp +++ b/Framework/Catalog/src/ONCatEntity.cpp @@ -83,7 +83,7 @@ ONCatEntity::vectorFromJSONStream(std::istream &streamContent) { "were not found."); } - entities.push_back( + entities.emplace_back( ONCatEntity(id, type, std::make_unique<Content>(subContent))); } diff --git a/Framework/Crystal/inc/MantidCrystal/PeakStatisticsTools.h b/Framework/Crystal/inc/MantidCrystal/PeakStatisticsTools.h index ff34b19f76f8f79a953ec46626b1a528d307d76e..46dee9be407446eb9a1296186db6680d349e80ea 100644 --- a/Framework/Crystal/inc/MantidCrystal/PeakStatisticsTools.h +++ b/Framework/Crystal/inc/MantidCrystal/PeakStatisticsTools.h @@ -36,7 +36,7 @@ public: const Kernel::V3D &getHKL() const { return m_hkl; } - void addPeak(const DataObjects::Peak &peak) { m_peaks.push_back(peak); } + void addPeak(const DataObjects::Peak &peak) { m_peaks.emplace_back(peak); } const std::vector<DataObjects::Peak> &getPeaks() const { return m_peaks; } size_t count() const { return m_peaks.size(); } diff --git a/Framework/Crystal/src/AnvredCorrection.cpp b/Framework/Crystal/src/AnvredCorrection.cpp index a13750edbba1e7c4970bc6c21dc749db579ebd9f..9fcba994a70380371d8113511849dfe91abe06a2 100644 --- a/Framework/Crystal/src/AnvredCorrection.cpp +++ b/Framework/Crystal/src/AnvredCorrection.cpp @@ -512,7 +512,7 @@ void AnvredCorrection::BuildLamdaWeights() { // value. m_lamda_weight.reserve(NUM_WAVELENGTHS); for (int i = 0; i < NUM_WAVELENGTHS; i++) - m_lamda_weight.push_back(1.); + m_lamda_weight.emplace_back(1.); } for (size_t i = 0; i < m_lamda_weight.size(); ++i) { diff --git a/Framework/Crystal/src/CentroidPeaks.cpp b/Framework/Crystal/src/CentroidPeaks.cpp index bf3bba243de1a46c929786235c7004806bcfeaff..e2b20787e0a5221721f8816131647f188b8de0d4 100644 --- a/Framework/Crystal/src/CentroidPeaks.cpp +++ b/Framework/Crystal/src/CentroidPeaks.cpp @@ -164,7 +164,7 @@ void CentroidPeaks::integrate() { workspaceIndex = (detidIterator->second); Mantid::Kernel::Units::Wavelength wl; std::vector<double> timeflight; - timeflight.push_back(inWS->x(workspaceIndex)[chan]); + timeflight.emplace_back(inWS->x(workspaceIndex)[chan]); double scattering = peak.getScattering(); double L1 = peak.getL1(); double L2 = peak.getL2(); @@ -285,7 +285,7 @@ void CentroidPeaks::integrateEvent() { double tof = tofcentroid / intensity; Mantid::Kernel::Units::Wavelength wl; std::vector<double> timeflight; - timeflight.push_back(tof); + timeflight.emplace_back(tof); double scattering = peak.getScattering(); double L1 = peak.getL1(); double L2 = peak.getL2(); @@ -361,7 +361,7 @@ void CentroidPeaks::removeEdgePeaks( const std::string &bankName = peak.getBankName(); if (edgePixel(inst, bankName, col, row, Edge)) { - badPeaks.push_back(i); + badPeaks.emplace_back(i); } } peakWS.removePeaks(std::move(badPeaks)); diff --git a/Framework/Crystal/src/Cluster.cpp b/Framework/Crystal/src/Cluster.cpp index 419140dcf61c81726d8c53ef813ccc03b37dcd6e..85a2adbe5684456514e2dd8a5fa1f4804a6060ec 100644 --- a/Framework/Crystal/src/Cluster.cpp +++ b/Framework/Crystal/src/Cluster.cpp @@ -52,7 +52,7 @@ size_t Cluster::size() const { return m_indexes.size(); } * Add the index to the cluster * @param index : index to add */ -void Cluster::addIndex(const size_t &index) { m_indexes.push_back(index); } +void Cluster::addIndex(const size_t &index) { m_indexes.emplace_back(index); } /** * Apply the cluster to the image diff --git a/Framework/Crystal/src/ClusterRegister.cpp b/Framework/Crystal/src/ClusterRegister.cpp index cceb53e004cd64871aad06ad7a1ecff65c5f02ed..51e3542d5cd81fed5e49c293d55cdac933e1c85c 100644 --- a/Framework/Crystal/src/ClusterRegister.cpp +++ b/Framework/Crystal/src/ClusterRegister.cpp @@ -63,13 +63,13 @@ public: // ------------- Find equivalent sets for (auto &cluster : m_groups) { if (cluster.find(aLabel) != cluster.end()) { - containingAny.push_back(cluster); + containingAny.emplace_back(cluster); } else if (cluster.find(bLabel) != cluster.end()) { - containingAny.push_back(cluster); + containingAny.emplace_back(cluster); } else { - containingNone.push_back(cluster); // Current iterated set contains - // NEITHER of these labels. It can - // therfore be ignored. + containingNone.emplace_back(cluster); // Current iterated set contains + // NEITHER of these labels. It can + // therfore be ignored. } } // ------------ Process equivalent sets @@ -78,7 +78,7 @@ public: GroupType::value_type newSet; newSet.insert(aLabel); newSet.insert(bLabel); - m_groups.push_back(newSet); + m_groups.emplace_back(newSet); } else { // At least one set already contains at least one label. We merge all such // sets into a master set. @@ -92,7 +92,7 @@ public: masterSet.insert(childSet.begin(), childSet.end()); // Build the master set. } - temp.push_back(masterSet); + temp.emplace_back(masterSet); m_groups = temp; // Swap. newItem = false; } @@ -111,7 +111,7 @@ public: boost::shared_ptr<ICluster> &cluster = m_register[j]; composite->add(cluster); } - composites.push_back(composite); + composites.emplace_back(composite); } return composites; } diff --git a/Framework/Crystal/src/CompositeCluster.cpp b/Framework/Crystal/src/CompositeCluster.cpp index 56fa4bb2ff232fc713c849f75bd67954be4e55d5..f843ba0a45c73b6913355ee5f354928dad82795b 100644 --- a/Framework/Crystal/src/CompositeCluster.cpp +++ b/Framework/Crystal/src/CompositeCluster.cpp @@ -161,7 +161,7 @@ void CompositeCluster::setRootCluster(ICluster const *root) { void CompositeCluster::add(boost::shared_ptr<ICluster> &toOwn) { if (toOwn->size() > 0) // Do not add empty clusters. { - m_ownedClusters.push_back(toOwn); + m_ownedClusters.emplace_back(toOwn); } } diff --git a/Framework/Crystal/src/ConnectedComponentLabeling.cpp b/Framework/Crystal/src/ConnectedComponentLabeling.cpp index 93c806970e617dbfdf4b5ac2c9d85e8b7192e523..f9d7d39bc887103ba61ff412b23a6ad65c939d4a 100644 --- a/Framework/Crystal/src/ConnectedComponentLabeling.cpp +++ b/Framework/Crystal/src/ConnectedComponentLabeling.cpp @@ -156,7 +156,7 @@ size_t doConnectedComponentLabeling(IMDIterator *iterator, const DisjointElement &neighbourElement = neighbourElements[neighIndex]; if (!neighbourElement.isEmpty()) { - nonEmptyNeighbourIndexes.push_back(neighIndex); + nonEmptyNeighbourIndexes.emplace_back(neighIndex); neighbourIds.insert(neighbourElement.getId()); } } diff --git a/Framework/Crystal/src/DiffPeaksWorkspaces.cpp b/Framework/Crystal/src/DiffPeaksWorkspaces.cpp index 2c32d91c74bd3c1067145d5c949751a5fb43ce6e..8a0cb3f98d79eb2b2cfad3ba28b018b09061e975 100644 --- a/Framework/Crystal/src/DiffPeaksWorkspaces.cpp +++ b/Framework/Crystal/src/DiffPeaksWorkspaces.cpp @@ -94,7 +94,7 @@ void DiffPeaksWorkspaces::exec() { { // As soon as we find a match, remove it from the output and move onto // the next rhs peak - badPeaks.push_back(j); + badPeaks.emplace_back(j); break; } } diff --git a/Framework/Crystal/src/FindClusterFaces.cpp b/Framework/Crystal/src/FindClusterFaces.cpp index 13901f27548d789fca3380d22462d2fac53e3f1c..8aeb6b572e660335e9f0bcdee5ac61dd66a2ecfb 100644 --- a/Framework/Crystal/src/FindClusterFaces.cpp +++ b/Framework/Crystal/src/FindClusterFaces.cpp @@ -148,7 +148,7 @@ void findFacesAtIndex(const size_t linearIndex, IMDIterator *mdIterator, face.maxEdge = maxEdge; face.radius = radius; - localClusterFaces.push_back(face); + localClusterFaces.emplace_back(face); } } } @@ -312,7 +312,7 @@ void FindClusterFaces::exec() { std::vector<size_t> imageShape; const size_t dimensionality = clusterImage->getNumDims(); for (size_t i = 0; i < dimensionality; ++i) { - imageShape.push_back(clusterImage->getDimension(i)->getNBins()); + imageShape.emplace_back(clusterImage->getDimension(i)->getNBins()); } // Get the peaks workspace diff --git a/Framework/Crystal/src/FindSXPeaksHelper.cpp b/Framework/Crystal/src/FindSXPeaksHelper.cpp index 32384c4956811492fe3e8448ab89cb29fbefd57b..ce7a443c34b0bf55e9a068b80df8b7135ee2f25c 100644 --- a/Framework/Crystal/src/FindSXPeaksHelper.cpp +++ b/Framework/Crystal/src/FindSXPeaksHelper.cpp @@ -480,7 +480,7 @@ std::vector<std::unique_ptr<PeakContainer>> AllPeaksStrategy::getAllPeaks( isRecording = true; } else if (isRecording && !isAboveThreshold) { currentPeak->stopRecord(it); - peaks.push_back(std::move(currentPeak)); + peaks.emplace_back(std::move(currentPeak)); currentPeak = nullptr; isRecording = false; } else { @@ -494,7 +494,7 @@ std::vector<std::unique_ptr<PeakContainer>> AllPeaksStrategy::getAllPeaks( --highY; } currentPeak->stopRecord(highY); - peaks.push_back(std::move(currentPeak)); + peaks.emplace_back(std::move(currentPeak)); currentPeak = nullptr; } @@ -564,7 +564,7 @@ std::vector<SXPeak> SimpleReduceStrategy::reduce( return result; }); if (pos == finalPeaks.end()) { - finalPeaks.push_back(currentPeak); + finalPeaks.emplace_back(currentPeak); } } @@ -674,7 +674,7 @@ std::vector<std::vector<SXPeak *>> FindMaxReduceStrategy::getPeakGroups( for (auto i = 0u; i < components.size(); ++i) { auto index = components[i]; - peakGroups[index].push_back(graph[i]); + peakGroups[index].emplace_back(graph[i]); } return peakGroups; @@ -697,7 +697,7 @@ std::vector<SXPeak> FindMaxReduceStrategy::getFinalPeaks( } // Add the max peak - peaks.push_back(*maxPeak); + peaks.emplace_back(*maxPeak); } return peaks; } diff --git a/Framework/Crystal/src/FindUBUsingFFT.cpp b/Framework/Crystal/src/FindUBUsingFFT.cpp index e8c03850a6c83fc197c6a84a305230d94bf2d6f5..d0fc7f3eb55b9aacad01e41826f88d2824b3be87 100644 --- a/Framework/Crystal/src/FindUBUsingFFT.cpp +++ b/Framework/Crystal/src/FindUBUsingFFT.cpp @@ -70,7 +70,7 @@ void FindUBUsingFFT::exec() { std::vector<V3D> q_vectors; for (size_t i = 0; i < n_peaks; i++) { - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); } Matrix<double> UB(3, 3, false); diff --git a/Framework/Crystal/src/FindUBUsingIndexedPeaks.cpp b/Framework/Crystal/src/FindUBUsingIndexedPeaks.cpp index 3514879072607457a691c4e3b68f8cb2c29c6ed0..0b4a621d2ee20c2b0e59b893689d89c063a2572d 100644 --- a/Framework/Crystal/src/FindUBUsingIndexedPeaks.cpp +++ b/Framework/Crystal/src/FindUBUsingIndexedPeaks.cpp @@ -78,9 +78,9 @@ void FindUBUsingIndexedPeaks::exec() { CrossTerm = true; if (isPeakIndexed(peak)) { - q_vectors.push_back(peak.getQSampleFrame()); - hkl_vectors.push_back(hkl); - mnp_vectors.push_back(mnp); + q_vectors.emplace_back(peak.getQSampleFrame()); + hkl_vectors.emplace_back(hkl); + mnp_vectors.emplace_back(mnp); indexed_count++; } } @@ -109,7 +109,7 @@ void FindUBUsingIndexedPeaks::exec() { q_vectors.clear(); // save the UB in the sample q_vectors.reserve(n_peaks); for (const auto &peak : peaks) { - q_vectors.push_back(peak.getQSampleFrame()); + q_vectors.emplace_back(peak.getQSampleFrame()); } int num_indexed = IndexingUtils::NumberIndexed(UB, q_vectors, tolerance); @@ -143,9 +143,9 @@ void FindUBUsingIndexedPeaks::exec() { V3D hkl(peak.getIntHKL()); V3D mnp(peak.getIntMNP()); if (isPeakIndexed(peak)) { - run_q_vectors.push_back(peak.getQSampleFrame()); - run_hkl_vectors.push_back(hkl); - run_mnp_vectors.push_back(mnp); + run_q_vectors.emplace_back(peak.getQSampleFrame()); + run_hkl_vectors.emplace_back(hkl); + run_mnp_vectors.emplace_back(mnp); } } } diff --git a/Framework/Crystal/src/FindUBUsingLatticeParameters.cpp b/Framework/Crystal/src/FindUBUsingLatticeParameters.cpp index 46dd0d02cdee452c6866c3d6fdcfb05f132ab48d..297baea5c70aa67043835d6f49bf120085c1e087 100644 --- a/Framework/Crystal/src/FindUBUsingLatticeParameters.cpp +++ b/Framework/Crystal/src/FindUBUsingLatticeParameters.cpp @@ -85,7 +85,7 @@ void FindUBUsingLatticeParameters::exec() { q_vectors.reserve(n_peaks); for (size_t i = 0; i < n_peaks; i++) - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); Matrix<double> UB(3, 3, false); OrientedLattice lattice(a, b, c, alpha, beta, gamma); diff --git a/Framework/Crystal/src/FindUBUsingMinMaxD.cpp b/Framework/Crystal/src/FindUBUsingMinMaxD.cpp index c3863a360e6b7b11d565af71326a530751cb1052..64d19446ee28fbbdda401a31b2d66d4b87f0065c 100644 --- a/Framework/Crystal/src/FindUBUsingMinMaxD.cpp +++ b/Framework/Crystal/src/FindUBUsingMinMaxD.cpp @@ -93,7 +93,7 @@ void FindUBUsingMinMaxD::exec() { q_vectors.reserve(n_peaks); for (size_t i = 0; i < n_peaks; i++) - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); Matrix<double> UB(3, 3, false); double error = diff --git a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp index 0296ebcdf889319f8bc520afc39262e10ec67318..6ac8127857d9140d215d1158213786ad0f7445ba 100644 --- a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp +++ b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp @@ -250,9 +250,9 @@ void GoniometerAnglesFromPhiRotation::exec() { MantidVec Xvals; for (int i = 0; i < Npeaks; ++i) { - Xvals.push_back(i); - Xvals.push_back(i); - Xvals.push_back(i); + Xvals.emplace_back(i); + Xvals.emplace_back(i); + Xvals.emplace_back(i); } ws->setPoints(0, Xvals); diff --git a/Framework/Crystal/src/IndexPeaksWithSatellites.cpp b/Framework/Crystal/src/IndexPeaksWithSatellites.cpp index 14ed555119ececbdaa7eec90155faa6b4a2d9a0f..951d11cb3bf4d6dccaabecac4c53d1fb5859bde9 100644 --- a/Framework/Crystal/src/IndexPeaksWithSatellites.cpp +++ b/Framework/Crystal/src/IndexPeaksWithSatellites.cpp @@ -168,7 +168,7 @@ void IndexPeaksWithSatellites::exec() { q_vectors.reserve(n_peaks); for (size_t i = 0; i < n_peaks; i++) { - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); } total_indexed = IndexingUtils::CalculateMillerIndices( @@ -200,7 +200,7 @@ void IndexPeaksWithSatellites::exec() { for (size_t i = 0; i < n_peaks; i++) { if (peaks[i].getRunNumber() == run) - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); } Matrix<double> tempUB(UB); @@ -515,9 +515,9 @@ void IndexPeaksWithSatellites::exec() { V3D IndexPeaksWithSatellites::getOffsetVector(const std::string &label) { std::vector<double> offsets = getProperty(label); if (offsets.empty()) { - offsets.push_back(0.0); - offsets.push_back(0.0); - offsets.push_back(0.0); + offsets.emplace_back(0.0); + offsets.emplace_back(0.0); + offsets.emplace_back(0.0); } V3D offsets1 = V3D(offsets[0], offsets[1], offsets[2]); return offsets1; diff --git a/Framework/Crystal/src/IndexSXPeaks.cpp b/Framework/Crystal/src/IndexSXPeaks.cpp index 24efd567b2311ffe831abddaa001c204f1dc3c84..c61c77383fc4ea8f3383f51badf041d39ce2f05f 100644 --- a/Framework/Crystal/src/IndexSXPeaks.cpp +++ b/Framework/Crystal/src/IndexSXPeaks.cpp @@ -162,7 +162,7 @@ void IndexSXPeaks::exec() { for (int i = 1; i <= int(npeaks); i++) // create indexes corresponding to all peak indexes { - peakindices.push_back(i); + peakindices.emplace_back(i); } g_log.information("No peak indexes provided. Algorithm will use all peaks " "in the workspace for the calculation."); diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp index 91e567554eaa108d65fae95eafbef85dda6bea04..8be8e420412b88f1dc162d63e89401e60d64eec4 100644 --- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp +++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp @@ -1514,7 +1514,7 @@ void IntegratePeakTimeSlices::SetUpData1( spec_idList.clear(); for (int i = 0; i < NAttributes + 2; i++) - StatBase.push_back(0); + StatBase.emplace_back(0); std::vector<double> yvalB; std::vector<double> errB; @@ -1579,14 +1579,14 @@ void IntegratePeakTimeSlices::SetUpData1( variance += histoerrs[chan] * histoerrs[chan]; } - yvalB.push_back(intensity); + yvalB.emplace_back(intensity); double sigma = 1; - errB.push_back(sigma); - xvalB.push_back(col); - YvalB.push_back(row); + errB.emplace_back(sigma); + xvalB.emplace_back(col); + YvalB.emplace_back(row); - xRef.push_back(static_cast<double>(jj)); + xRef.emplace_back(static_cast<double>(jj)); jj++; updateStats(intensity, variance, row, col, StatBase); @@ -2011,25 +2011,25 @@ void IntegratePeakTimeSlices::Fit(MatrixWorkspace_sptr &Data, errs.clear(); ITableWorkspace_sptr RRes = fit_alg->getProperty("OutputParameters"); for (int prm = 0; prm < static_cast<int>(RRes->rowCount()) - 1; prm++) { - names.push_back(RRes->getRef<string>("Name", prm)); - params.push_back(RRes->getRef<double>("Value", prm)); + names.emplace_back(RRes->getRef<string>("Name", prm)); + params.emplace_back(RRes->getRef<double>("Value", prm)); double error = RRes->getRef<double>("Error", prm); - errs.push_back(error); + errs.emplace_back(error); } if (names.size() < 5) { - names.push_back(m_ParameterNames[IVXX]); - names.push_back(m_ParameterNames[IVYY]); - names.push_back(m_ParameterNames[IVXY]); + names.emplace_back(m_ParameterNames[IVXX]); + names.emplace_back(m_ParameterNames[IVYY]); + names.emplace_back(m_ParameterNames[IVXY]); double Varxx, Varxy, Varyy; m_AttributeValues->CalcVariancesFromData( params[IBACK], params[IXMEAN], params[IYMEAN], Varxx, Varxy, Varyy, m_AttributeValues->StatBase); - params.push_back(Varxx); - params.push_back(Varyy); - params.push_back(Varxy); - errs.push_back(0); - errs.push_back(0); - errs.push_back(0); + params.emplace_back(Varxx); + params.emplace_back(Varyy); + params.emplace_back(Varxy); + errs.emplace_back(0); + errs.emplace_back(0); + errs.emplace_back(0); } } catch (std::exception diff --git a/Framework/Crystal/src/LoadIsawPeaks.cpp b/Framework/Crystal/src/LoadIsawPeaks.cpp index f01290ab2bd85a29a78fcc6bdd3a568fc69811d8..605e1367c3deb185ed2013c4a3788492ff1547a5 100644 --- a/Framework/Crystal/src/LoadIsawPeaks.cpp +++ b/Framework/Crystal/src/LoadIsawPeaks.cpp @@ -199,7 +199,7 @@ std::string LoadIsawPeaks::readHeader(PeaksWorkspace_sptr outWS, // Save all bank numbers in header lines Strings::convert(getWord(in, false), bank); if (s == "5") - det.push_back(bank); + det.emplace_back(bank); } // Find bank numbers in instument that are not in header lines std::string maskBanks; diff --git a/Framework/Crystal/src/LoadIsawSpectrum.cpp b/Framework/Crystal/src/LoadIsawSpectrum.cpp index 4e640e92c2044f4669cea85a7735dee175db4f12..a2df6423eee430a62019ce3a9a014e1213c3b196 100644 --- a/Framework/Crystal/src/LoadIsawSpectrum.cpp +++ b/Framework/Crystal/src/LoadIsawSpectrum.cpp @@ -79,8 +79,8 @@ void LoadIsawSpectrum::exec() { if (STRING.find("Bank") == std::string::npos) { double time0, spectra0; ss >> time0 >> spectra0; - time[a].push_back(time0); - spectra[a].push_back(spectra0); + time[a].emplace_back(time0); + spectra[a].emplace_back(spectra0); } else { a++; @@ -96,7 +96,7 @@ void LoadIsawSpectrum::exec() { det = boost::dynamic_pointer_cast<RectangularDetector>((*inst)[i]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the first sub-level for RectangularDetectors (e.g. PG3). // We are not doing a full recursive search since that will be very long @@ -106,7 +106,7 @@ void LoadIsawSpectrum::exec() { for (int j = 0; j < assem->nelements(); j++) { det = boost::dynamic_pointer_cast<RectangularDetector>((*assem)[j]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the second sub-level for RectangularDetectors (e.g. // PG3). @@ -118,7 +118,7 @@ void LoadIsawSpectrum::exec() { det = boost::dynamic_pointer_cast<RectangularDetector>( (*assem2)[k]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } } } diff --git a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp index 1e44c97c9c558832cd92c1d7142d911587190936..289ef54c9aa0ca68d618a02504070df441ba6f88 100644 --- a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp +++ b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp @@ -205,7 +205,7 @@ void OptimizeCrystalPlacement::exec() { if (it == RunNumList.end() && use) // add to list of unique run numbers in workspace { - RunNumList.push_back(runNum); + RunNumList.emplace_back(runNum); Geometry::Goniometer Gon(peak.getGoniometerMatrix()); std::vector<double> phichiOmega = Gon.getEulerAngles("YZY"); @@ -215,9 +215,9 @@ void OptimizeCrystalPlacement::exec() { if (use) // add to lists for workspace { nPeaksUsed++; - xRef.push_back(static_cast<double>(i)); - xRef.push_back(static_cast<double>(i)); - xRef.push_back(static_cast<double>(i)); + xRef.emplace_back(static_cast<double>(i)); + xRef.emplace_back(static_cast<double>(i)); + xRef.emplace_back(static_cast<double>(i)); } } @@ -254,7 +254,7 @@ void OptimizeCrystalPlacement::exec() { std::string runNumStr = std::to_string(runNum); OptRunNums += predChar + runNumStr; predChar = "/"; - ChRunNumList.push_back(runNumStr); + ChRunNumList.emplace_back(runNumStr); } } diff --git a/Framework/Crystal/src/OptimizeLatticeForCellType.cpp b/Framework/Crystal/src/OptimizeLatticeForCellType.cpp index b83b5e5978395cadc6a730096d89e4a43b9f52f2..d646cc3d67e1deea9ba79e388fb9570809b8792f 100644 --- a/Framework/Crystal/src/OptimizeLatticeForCellType.cpp +++ b/Framework/Crystal/src/OptimizeLatticeForCellType.cpp @@ -41,13 +41,13 @@ void OptimizeLatticeForCellType::init() { "PeaksWorkspace", "", Direction::InOut), "An input PeaksWorkspace with an instrument."); std::vector<std::string> cellTypes; - cellTypes.push_back(ReducedCell::CUBIC()); - cellTypes.push_back(ReducedCell::TETRAGONAL()); - cellTypes.push_back(ReducedCell::ORTHORHOMBIC()); - cellTypes.push_back(ReducedCell::HEXAGONAL()); - cellTypes.push_back(ReducedCell::RHOMBOHEDRAL()); - cellTypes.push_back(ReducedCell::MONOCLINIC()); - cellTypes.push_back(ReducedCell::TRICLINIC()); + cellTypes.emplace_back(ReducedCell::CUBIC()); + cellTypes.emplace_back(ReducedCell::TETRAGONAL()); + cellTypes.emplace_back(ReducedCell::ORTHORHOMBIC()); + cellTypes.emplace_back(ReducedCell::HEXAGONAL()); + cellTypes.emplace_back(ReducedCell::RHOMBOHEDRAL()); + cellTypes.emplace_back(ReducedCell::MONOCLINIC()); + cellTypes.emplace_back(ReducedCell::TRICLINIC()); declareProperty("CellType", cellTypes[0], boost::make_shared<StringListValidator>(cellTypes), "Select the cell type."); @@ -90,17 +90,17 @@ void OptimizeLatticeForCellType::exec() { const std::vector<Peak> &peaks = ws->getPeaks(); if (edgePixel(inst, peaks[i].getBankName(), peaks[i].getCol(), peaks[i].getRow(), edge)) { - badPeaks.push_back(i); + badPeaks.emplace_back(i); } } ws->removePeaks(std::move(badPeaks)); } - runWS.push_back(ws); + runWS.emplace_back(ws); if (perRun) { std::vector<std::pair<std::string, bool>> criteria; // Sort by run number - criteria.push_back(std::pair<std::string, bool>("runnumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("runnumber", true)); ws->sort(criteria); const std::vector<Peak> &peaks_all = ws->getPeaks(); int run = 0; @@ -111,7 +111,7 @@ void OptimizeLatticeForCellType::exec() { auto cloneWS = boost::make_shared<PeaksWorkspace>(); cloneWS->setInstrument(inst); cloneWS->copyExperimentInfoFrom(ws.get()); - runWS.push_back(cloneWS); + runWS.emplace_back(cloneWS); runWS[count]->addPeak(peak); run = peak.getRunNumber(); AnalysisDataService::Instance().addOrReplace( diff --git a/Framework/Crystal/src/PeakIntegration.cpp b/Framework/Crystal/src/PeakIntegration.cpp index e1b8dde31201593927ff9c0e7edefbcd72f736dc..e1d9747520cda185d319e6a9e89c1a5b41a93e11 100644 --- a/Framework/Crystal/src/PeakIntegration.cpp +++ b/Framework/Crystal/src/PeakIntegration.cpp @@ -119,7 +119,7 @@ void PeakIntegration::exec() { size_t wi = wiEntry->second; if ((matchRun && peak.getRunNumber() != inputW->getRunNumber()) || wi >= Numberwi) - badPeaks.push_back(i); + badPeaks.emplace_back(i); } else // This is for appending peak workspaces when running // SNSSingleCrystalReduction one bank at at time if (i + 1 > MinPeaks) diff --git a/Framework/Crystal/src/PeakStatisticsTools.cpp b/Framework/Crystal/src/PeakStatisticsTools.cpp index 6d5eadd5a1616394bd8ff4caa1feca8941f9e42e..ca56d1dcb775b1285bc3c35187bf3c2a06d3548c 100644 --- a/Framework/Crystal/src/PeakStatisticsTools.cpp +++ b/Framework/Crystal/src/PeakStatisticsTools.cpp @@ -186,7 +186,7 @@ UniqueReflectionCollection::getUnobservedUniqueReflections() const { for (const auto &reflection : m_reflections) { if (reflection.second.count() == 0) { - reflections.push_back(reflection.first); + reflections.emplace_back(reflection.first); } } diff --git a/Framework/Crystal/src/PeaksIntersection.cpp b/Framework/Crystal/src/PeaksIntersection.cpp index eaa584d1da9654ccf5fe37727aad264c5d3edec5..5248084d4e11096ec1fca1e054f2d3a32de568a7 100644 --- a/Framework/Crystal/src/PeaksIntersection.cpp +++ b/Framework/Crystal/src/PeaksIntersection.cpp @@ -38,10 +38,10 @@ void PeaksIntersection::initBaseProperties() { "An input peaks workspace."); std::vector<std::string> propOptions; - propOptions.push_back(detectorSpaceFrame()); - propOptions.push_back(qLabFrame()); - propOptions.push_back(qSampleFrame()); - propOptions.push_back(hklFrame()); + propOptions.emplace_back(detectorSpaceFrame()); + propOptions.emplace_back(qLabFrame()); + propOptions.emplace_back(qSampleFrame()); + propOptions.emplace_back(hklFrame()); declareProperty( "CoordinateFrame", "DetectorSpace", diff --git a/Framework/Crystal/src/PredictFractionalPeaks.cpp b/Framework/Crystal/src/PredictFractionalPeaks.cpp index a92cdd6ed154432f47788fdf97f4e49da021b936..3b285837b0f01489901134ba00b7f8061a605f5a 100644 --- a/Framework/Crystal/src/PredictFractionalPeaks.cpp +++ b/Framework/Crystal/src/PredictFractionalPeaks.cpp @@ -353,11 +353,11 @@ void PredictFractionalPeaks::exec() { std::vector<double> kOffsets = getProperty(PropertyNames::KOFFSET); std::vector<double> lOffsets = getProperty(PropertyNames::LOFFSET); if (hOffsets.empty()) - hOffsets.push_back(0.0); + hOffsets.emplace_back(0.0); if (kOffsets.empty()) - kOffsets.push_back(0.0); + kOffsets.emplace_back(0.0); if (lOffsets.empty()) - lOffsets.push_back(0.0); + lOffsets.emplace_back(0.0); const bool includePeaksInRange = getProperty("IncludeAllPeaksInRange"); const V3D hklMin{getProperty(PropertyNames::HMIN), getProperty(PropertyNames::KMIN), diff --git a/Framework/Crystal/src/PredictPeaks.cpp b/Framework/Crystal/src/PredictPeaks.cpp index 1e6338ffb289a5b6f3301210da2c977d105a39d2..17558ae9e9c06fbaf5d3f78aac2adc780cd37b60 100644 --- a/Framework/Crystal/src/PredictPeaks.cpp +++ b/Framework/Crystal/src/PredictPeaks.cpp @@ -196,7 +196,7 @@ void PredictPeaks::exec() { // Retrieve the goniometer rotation matrix try { DblMatrix goniometerMatrix = matrixWS->run().getGoniometerMatrix(); - gonioVec.push_back(goniometerMatrix); + gonioVec.emplace_back(goniometerMatrix); } catch (std::runtime_error &e) { // If there is no goniometer matrix, use identity matrix instead. g_log.error() << "Error getting the goniometer rotation matrix from the " @@ -208,7 +208,7 @@ void PredictPeaks::exec() { // Sort peaks by run number so that peaks with equal goniometer matrices are // adjacent std::vector<std::pair<std::string, bool>> criteria; - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); peaksWS->sort(criteria); @@ -218,7 +218,7 @@ void PredictPeaks::exec() { IPeak &p = peaksWS->getPeak(i); DblMatrix currentGoniometerMatrix = p.getGoniometerMatrix(); if (!(currentGoniometerMatrix == lastGoniometerMatrix)) { - gonioVec.push_back(currentGoniometerMatrix); + gonioVec.emplace_back(currentGoniometerMatrix); lastGoniometerMatrix = currentGoniometerMatrix; } } @@ -237,10 +237,10 @@ void PredictPeaks::exec() { try { DblMatrix goniometerMatrix = mdWS->getExperimentInfo(i)->mutableRun().getGoniometerMatrix(); - gonioVec.push_back(goniometerMatrix); + gonioVec.emplace_back(goniometerMatrix); } catch (std::runtime_error &e) { // If there is no goniometer matrix, use identity matrix instead. - gonioVec.push_back(DblMatrix(3, 3, true)); + gonioVec.emplace_back(DblMatrix(3, 3, true)); g_log.error() << "Error getting the goniometer rotation matrix from the " @@ -255,7 +255,7 @@ void PredictPeaks::exec() { // If there's no goniometer matrix at this point, push back an identity // matrix. if (gonioVec.empty()) { - gonioVec.push_back(DblMatrix(3, 3, true)); + gonioVec.emplace_back(DblMatrix(3, 3, true)); } setInstrumentFromInputWorkspace(inputExperimentInfo); @@ -372,8 +372,8 @@ void PredictPeaks::exec() { // Sort peaks by run number so that peaks with equal goniometer matrices are // adjacent std::vector<std::pair<std::string, bool>> criteria; - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); - criteria.push_back(std::pair<std::string, bool>("BankName", true)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("BankName", true)); m_pw->sort(criteria); auto &peaks = m_pw->getPeaks(); @@ -520,7 +520,7 @@ void PredictPeaks::fillPossibleHKLsUsingPeaksWorkspace( if (roundHKL) hkl.round(); - possibleHKLs.push_back(hkl); + possibleHKLs.emplace_back(hkl); } // for each hkl in the workspace } diff --git a/Framework/Crystal/src/PredictSatellitePeaks.cpp b/Framework/Crystal/src/PredictSatellitePeaks.cpp index 85b219c6ea978e3f02b1fe0f5c12565ea2720dc5..70dcff85f7435e23bac24d2125e18f8e207234da 100644 --- a/Framework/Crystal/src/PredictSatellitePeaks.cpp +++ b/Framework/Crystal/src/PredictSatellitePeaks.cpp @@ -237,11 +237,11 @@ void PredictSatellitePeaks::exec() { // Sort peaks by run number so that peaks with equal goniometer matrices are // adjacent std::vector<std::pair<std::string, bool>> criteria; - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); - criteria.push_back(std::pair<std::string, bool>("BankName", true)); - criteria.push_back(std::pair<std::string, bool>("h", true)); - criteria.push_back(std::pair<std::string, bool>("k", true)); - criteria.push_back(std::pair<std::string, bool>("l", true)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("BankName", true)); + criteria.emplace_back(std::pair<std::string, bool>("h", true)); + criteria.emplace_back(std::pair<std::string, bool>("k", true)); + criteria.emplace_back(std::pair<std::string, bool>("l", true)); outPeaks->sort(criteria); for (int i = 0; i < static_cast<int>(outPeaks->getNumberPeaks()); ++i) { @@ -323,11 +323,11 @@ void PredictSatellitePeaks::exec_peaks() { // Sort peaks by run number so that peaks with equal goniometer matrices are // adjacent std::vector<std::pair<std::string, bool>> criteria; - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); - criteria.push_back(std::pair<std::string, bool>("BankName", true)); - criteria.push_back(std::pair<std::string, bool>("h", true)); - criteria.push_back(std::pair<std::string, bool>("k", true)); - criteria.push_back(std::pair<std::string, bool>("l", true)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("BankName", true)); + criteria.emplace_back(std::pair<std::string, bool>("h", true)); + criteria.emplace_back(std::pair<std::string, bool>("k", true)); + criteria.emplace_back(std::pair<std::string, bool>("l", true)); outPeaks->sort(criteria); for (int i = 0; i < static_cast<int>(outPeaks->getNumberPeaks()); ++i) { @@ -378,7 +378,7 @@ void PredictSatellitePeaks::predictOffsets( binary_search(AlreadyDonePeaks.begin(), AlreadyDonePeaks.end(), SavPk); if (!foundPeak) { - AlreadyDonePeaks.push_back(SavPk); + AlreadyDonePeaks.emplace_back(SavPk); } else { continue; } @@ -451,7 +451,7 @@ void PredictSatellitePeaks::predictOffsetsWithCrossTerms( AlreadyDonePeaks.end(), SavPk); if (!foundPeak) { - AlreadyDonePeaks.push_back(SavPk); + AlreadyDonePeaks.emplace_back(SavPk); } else { continue; } @@ -467,9 +467,9 @@ void PredictSatellitePeaks::predictOffsetsWithCrossTerms( V3D PredictSatellitePeaks::getOffsetVector(const std::string &label) { vector<double> offsets = getProperty(label); if (offsets.empty()) { - offsets.push_back(0.0); - offsets.push_back(0.0); - offsets.push_back(0.0); + offsets.emplace_back(0.0); + offsets.emplace_back(0.0); + offsets.emplace_back(0.0); } V3D offsets1 = V3D(offsets[0], offsets[1], offsets[2]); return offsets1; diff --git a/Framework/Crystal/src/SCDCalibratePanels.cpp b/Framework/Crystal/src/SCDCalibratePanels.cpp index 0dab65f7f4a9d830e2784e504045e2f00bd0f714..2bd68545267b75138a71c10783a4c15689e8eecc 100644 --- a/Framework/Crystal/src/SCDCalibratePanels.cpp +++ b/Framework/Crystal/src/SCDCalibratePanels.cpp @@ -156,13 +156,13 @@ void SCDCalibratePanels::exec() { // Try again to optimize L1 if (changeL1) { findL1(nPeaks, peaksWs); - parameter_workspaces.push_back("params_L1"); - fit_workspaces.push_back("fit_L1"); + parameter_workspaces.emplace_back("params_L1"); + fit_workspaces.emplace_back("fit_L1"); } // Add T0 files to groups if (changeT0) { - parameter_workspaces.push_back("params_T0"); - fit_workspaces.push_back("fit_T0"); + parameter_workspaces.emplace_back("params_T0"); + fit_workspaces.emplace_back("fit_T0"); } std::sort(parameter_workspaces.begin(), parameter_workspaces.end()); std::sort(fit_workspaces.begin(), fit_workspaces.end()); diff --git a/Framework/Crystal/src/SaveHKL.cpp b/Framework/Crystal/src/SaveHKL.cpp index 4c4c2811e65c7761c67747fa0108abfdde2cbd8d..11593088a1e1c3201f28a494559301e59eb386d2 100644 --- a/Framework/Crystal/src/SaveHKL.cpp +++ b/Framework/Crystal/src/SaveHKL.cpp @@ -219,9 +219,9 @@ void SaveHKL::exec() { // Save in the map if (type.compare(0, 2, "Ru") == 0) - runMap[run][bank].push_back(i); + runMap[run][bank].emplace_back(i); else - runMap[bank][run].push_back(i); + runMap[bank][run].emplace_back(i); // Track unique bank numbers uniqueBanks.insert(bank); uniqueRuns.insert(run); @@ -303,8 +303,8 @@ void SaveHKL::exec() { if (STRING.find("Bank") == std::string::npos) { double time0, spectra0; ss >> time0 >> spectra0; - time[a].push_back(time0); - spectra[a].push_back(spectra0); + time[a].emplace_back(time0); + spectra[a].emplace_back(spectra0); } else { std::string temp; @@ -629,7 +629,7 @@ void SaveHKL::exec() { // delete banned peaks std::vector<int> badPeaks; for (auto it = banned.crbegin(); it != banned.crend(); ++it) { - badPeaks.push_back(static_cast<int>(*it)); + badPeaks.emplace_back(static_cast<int>(*it)); } peaksW->removePeaks(std::move(badPeaks)); setProperty("OutputWorkspace", peaksW); diff --git a/Framework/Crystal/src/SaveIsawPeaks.cpp b/Framework/Crystal/src/SaveIsawPeaks.cpp index 5ac336b5c30b557dbb8a48ff0602fc980fa4811a..e47f2253c054de10b134514872e5f70f04d50715 100644 --- a/Framework/Crystal/src/SaveIsawPeaks.cpp +++ b/Framework/Crystal/src/SaveIsawPeaks.cpp @@ -130,7 +130,7 @@ void SaveIsawPeaks::exec() { Strings::convert(bankName, bank); // Save in the map - runMap[run][bank].push_back(i); + runMap[run][bank].emplace_back(i); } if (m_isModulatedStructure) header = diff --git a/Framework/Crystal/src/SaveLauenorm.cpp b/Framework/Crystal/src/SaveLauenorm.cpp index 76e17c58130582eaa9e4bde0a0173b9a196391f8..3ad3216d368aa5b3333f5302d65e9d79c9c9cc19 100644 --- a/Framework/Crystal/src/SaveLauenorm.cpp +++ b/Framework/Crystal/src/SaveLauenorm.cpp @@ -119,16 +119,16 @@ void SaveLauenorm::exec() { // We must sort the peaks std::vector<std::pair<std::string, bool>> criteria; if (type.compare(0, 2, "Ba") == 0) - criteria.push_back(std::pair<std::string, bool>("BankName", true)); + criteria.emplace_back(std::pair<std::string, bool>("BankName", true)); else if (type.compare(0, 2, "Ru") == 0) - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); else { - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); - criteria.push_back(std::pair<std::string, bool>("BankName", true)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("BankName", true)); } - criteria.push_back(std::pair<std::string, bool>("h", true)); - criteria.push_back(std::pair<std::string, bool>("k", true)); - criteria.push_back(std::pair<std::string, bool>("l", true)); + criteria.emplace_back(std::pair<std::string, bool>("h", true)); + criteria.emplace_back(std::pair<std::string, bool>("k", true)); + criteria.emplace_back(std::pair<std::string, bool>("l", true)); ws->sort(criteria); std::vector<Peak> peaks = ws->getPeaks(); @@ -224,11 +224,11 @@ void SaveLauenorm::exec() { if (sequence != oldSequence) { oldSequence = sequence; - numPeaks.push_back(count); - maxLamVec.push_back(maxLam); - minLamVec.push_back(minLam); - sumLamVec.push_back(sumLam); - minDVec.push_back(minD); + numPeaks.emplace_back(count); + maxLamVec.emplace_back(maxLam); + minLamVec.emplace_back(minLam); + sumLamVec.emplace_back(sumLam); + minDVec.emplace_back(minD); count = 0; maxLam = 0; minLam = EMPTY_DBL(); @@ -244,11 +244,11 @@ void SaveLauenorm::exec() { minD = dsp; sumLam += lambda; } - numPeaks.push_back(count); - maxLamVec.push_back(maxLam); - minLamVec.push_back(minLam); - sumLamVec.push_back(sumLam); - minDVec.push_back(minD); + numPeaks.emplace_back(count); + maxLamVec.emplace_back(maxLam); + minLamVec.emplace_back(minLam); + sumLamVec.emplace_back(sumLam); + minDVec.emplace_back(minD); oldSequence = -1; // Go through each peak at this run / bank for (int wi = 0; wi < ws->getNumberPeaks(); wi++) { diff --git a/Framework/Crystal/src/SelectCellOfType.cpp b/Framework/Crystal/src/SelectCellOfType.cpp index 7b3add3a0eca9de1e5596da9dde689faec5f2e4e..6b5b95f61226bc4ef7526abc5ab8ac2543e93879 100644 --- a/Framework/Crystal/src/SelectCellOfType.cpp +++ b/Framework/Crystal/src/SelectCellOfType.cpp @@ -32,24 +32,24 @@ void SelectCellOfType::init() { "Input Peaks Workspace"); std::vector<std::string> type_list; - type_list.push_back(ReducedCell::CUBIC()); - type_list.push_back(ReducedCell::HEXAGONAL()); - type_list.push_back(ReducedCell::RHOMBOHEDRAL()); - type_list.push_back(ReducedCell::TETRAGONAL()); - type_list.push_back(ReducedCell::ORTHORHOMBIC()); - type_list.push_back(ReducedCell::MONOCLINIC()); - type_list.push_back(ReducedCell::TRICLINIC()); + type_list.emplace_back(ReducedCell::CUBIC()); + type_list.emplace_back(ReducedCell::HEXAGONAL()); + type_list.emplace_back(ReducedCell::RHOMBOHEDRAL()); + type_list.emplace_back(ReducedCell::TETRAGONAL()); + type_list.emplace_back(ReducedCell::ORTHORHOMBIC()); + type_list.emplace_back(ReducedCell::MONOCLINIC()); + type_list.emplace_back(ReducedCell::TRICLINIC()); declareProperty("CellType", type_list[0], boost::make_shared<Kernel::StringListValidator>(type_list), "The conventional cell type to use"); std::vector<std::string> centering_list; - centering_list.push_back(ReducedCell::F_CENTERED()); - centering_list.push_back(ReducedCell::I_CENTERED()); - centering_list.push_back(ReducedCell::C_CENTERED()); - centering_list.push_back(ReducedCell::P_CENTERED()); - centering_list.push_back(ReducedCell::R_CENTERED()); + centering_list.emplace_back(ReducedCell::F_CENTERED()); + centering_list.emplace_back(ReducedCell::I_CENTERED()); + centering_list.emplace_back(ReducedCell::C_CENTERED()); + centering_list.emplace_back(ReducedCell::P_CENTERED()); + centering_list.emplace_back(ReducedCell::R_CENTERED()); declareProperty( "Centering", centering_list[3], @@ -134,7 +134,7 @@ void SelectCellOfType::exec() { std::vector<V3D> miller_indices; std::vector<V3D> q_vectors; for (size_t i = 0; i < n_peaks; i++) { - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); } num_indexed = IndexingUtils::CalculateMillerIndices( newUB, q_vectors, tolerance, miller_indices, average_error); diff --git a/Framework/Crystal/src/SelectCellWithForm.cpp b/Framework/Crystal/src/SelectCellWithForm.cpp index 5d9a736fbcb9f01f542ff5442bce130abc8f2751..c9be3930a97f9f2169fc73c0c06908d9c40128af 100644 --- a/Framework/Crystal/src/SelectCellWithForm.cpp +++ b/Framework/Crystal/src/SelectCellWithForm.cpp @@ -66,7 +66,7 @@ Kernel::Matrix<double> SelectCellWithForm::DetermineErrors( q_vectors.reserve(npeaks); q_vectors0.reserve(npeaks); for (int i = 0; i < npeaks; i++) - q_vectors0.push_back(ws->getPeak(i).getQSampleFrame()); + q_vectors0.emplace_back(ws->getPeak(i).getQSampleFrame()); Kernel::Matrix<double> newUB1(3, 3); IndexingUtils::GetIndexedPeaks(UB, q_vectors0, tolerance, miller_ind, @@ -166,7 +166,7 @@ void SelectCellWithForm::exec() { std::vector<V3D> miller_indices; std::vector<V3D> q_vectors; for (size_t i = 0; i < n_peaks; i++) { - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); } num_indexed = IndexingUtils::CalculateMillerIndices( newUB, q_vectors, tolerance, miller_indices, average_error); diff --git a/Framework/Crystal/src/SetSpecialCoordinates.cpp b/Framework/Crystal/src/SetSpecialCoordinates.cpp index 32c624ecffb19bb7709447e75db15d7022240330..f985d3b90a9895ed1201f2c23bd1d10daa2728db 100644 --- a/Framework/Crystal/src/SetSpecialCoordinates.cpp +++ b/Framework/Crystal/src/SetSpecialCoordinates.cpp @@ -42,9 +42,10 @@ const std::string SetSpecialCoordinates::HKLOption() { /** Constructor */ SetSpecialCoordinates::SetSpecialCoordinates() { - m_specialCoordinatesNames.push_back(SetSpecialCoordinates::QLabOption()); - m_specialCoordinatesNames.push_back(SetSpecialCoordinates::QSampleOption()); - m_specialCoordinatesNames.push_back(SetSpecialCoordinates::HKLOption()); + m_specialCoordinatesNames.emplace_back(SetSpecialCoordinates::QLabOption()); + m_specialCoordinatesNames.emplace_back( + SetSpecialCoordinates::QSampleOption()); + m_specialCoordinatesNames.emplace_back(SetSpecialCoordinates::HKLOption()); m_specialCoordinatesMap.emplace(SetSpecialCoordinates::QLabOption(), Mantid::Kernel::QLab); diff --git a/Framework/Crystal/src/SortHKL.cpp b/Framework/Crystal/src/SortHKL.cpp index c7fc8bf35b1cb25e4271b9caef8a4b510e40bf88..0b18e987eae2f2c72376819f58a328a0e7a0f1b3 100644 --- a/Framework/Crystal/src/SortHKL.cpp +++ b/Framework/Crystal/src/SortHKL.cpp @@ -59,11 +59,11 @@ void SortHKL::init() { std::back_inserter(pgOptions), [](const auto &group) { return group->getName(); }); // Scripts may have Orthorhombic misspelled from past bug in PointGroupFactory - pgOptions.push_back("222 (Orthorombic)"); - pgOptions.push_back("mm2 (Orthorombic)"); - pgOptions.push_back("2mm (Orthorombic)"); - pgOptions.push_back("m2m (Orthorombic)"); - pgOptions.push_back("mmm (Orthorombic)"); + pgOptions.emplace_back("222 (Orthorombic)"); + pgOptions.emplace_back("mm2 (Orthorombic)"); + pgOptions.emplace_back("2mm (Orthorombic)"); + pgOptions.emplace_back("m2m (Orthorombic)"); + pgOptions.emplace_back("mmm (Orthorombic)"); declareProperty("PointGroup", pgOptions[0], boost::make_shared<StringListValidator>(pgOptions), "Which point group applies to this crystal?"); diff --git a/Framework/Crystal/src/SortPeaksWorkspace.cpp b/Framework/Crystal/src/SortPeaksWorkspace.cpp index e36b405ba1eac4daf37a3539241bfa7614851830..f27d344bff8917c2236627da7791ead86a874b23 100644 --- a/Framework/Crystal/src/SortPeaksWorkspace.cpp +++ b/Framework/Crystal/src/SortPeaksWorkspace.cpp @@ -71,7 +71,7 @@ void SortPeaksWorkspace::exec() { // Perform the sorting. std::vector<std::pair<std::string, bool>> sortCriteria; - sortCriteria.push_back( + sortCriteria.emplace_back( std::pair<std::string, bool>(columnToSortBy, sortAscending)); outputWS->sort(sortCriteria); setProperty("OutputWorkspace", outputWS); diff --git a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp index 5f6c985591540e74590270886333fbe4944e5061..38601918d1cb8d1f1fafe72d315be2331c93a538 100644 --- a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp +++ b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp @@ -118,13 +118,13 @@ void StatisticsOfPeaksWorkspace::exec() { // We must sort the peaks std::vector<std::pair<std::string, bool>> criteria; if (sortType.compare(0, 2, "Re") == 0) - criteria.push_back(std::pair<std::string, bool>("DSpacing", false)); + criteria.emplace_back(std::pair<std::string, bool>("DSpacing", false)); else if (sortType.compare(0, 2, "Ru") == 0) - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); - criteria.push_back(std::pair<std::string, bool>("BankName", true)); - criteria.push_back(std::pair<std::string, bool>("h", true)); - criteria.push_back(std::pair<std::string, bool>("k", true)); - criteria.push_back(std::pair<std::string, bool>("l", true)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("BankName", true)); + criteria.emplace_back(std::pair<std::string, bool>("h", true)); + criteria.emplace_back(std::pair<std::string, bool>("k", true)); + criteria.emplace_back(std::pair<std::string, bool>("l", true)); ws->sort(criteria); // ========================================= diff --git a/Framework/Crystal/src/TransformHKL.cpp b/Framework/Crystal/src/TransformHKL.cpp index d22a750e70dec1a3c76080dd9f2ad9622b1a2369..cde96d87420696ea41a0dc5a8e1c338ec4618ad7 100644 --- a/Framework/Crystal/src/TransformHKL.cpp +++ b/Framework/Crystal/src/TransformHKL.cpp @@ -137,9 +137,9 @@ void TransformHKL::exec() { V3D hkl(peaks[i].getHKL()); V3D ihkl(peaks[i].getIntHKL()); peaks[i].setIntHKL(hkl_tran * ihkl); - miller_indices.push_back(hkl_tran * ihkl); + miller_indices.emplace_back(hkl_tran * ihkl); peaks[i].setHKL(hkl_tran * hkl); - q_vectors.push_back(peaks[i].getQSampleFrame()); + q_vectors.emplace_back(peaks[i].getQSampleFrame()); num_indexed++; } diff --git a/Framework/Crystal/test/AddPeakHKLTest.h b/Framework/Crystal/test/AddPeakHKLTest.h index f21be6c975f40e25eb52ed6d6a97d5315b965911..2cdce23b34a14f818d8fcd167869af81ba00e11c 100644 --- a/Framework/Crystal/test/AddPeakHKLTest.h +++ b/Framework/Crystal/test/AddPeakHKLTest.h @@ -89,9 +89,9 @@ public: alg.setChild(true); alg.initialize(); std::vector<double> hklVec; - hklVec.push_back(hkl.X()); - hklVec.push_back(hkl.Y()); - hklVec.push_back(hkl.Z()); + hklVec.emplace_back(hkl.X()); + hklVec.emplace_back(hkl.Y()); + hklVec.emplace_back(hkl.Z()); alg.setProperty("HKL", hklVec); alg.setProperty("Workspace", ws); alg.execute(); diff --git a/Framework/Crystal/test/DisjointElementTest.h b/Framework/Crystal/test/DisjointElementTest.h index 14d8e425ff7a824b7458c84b65343621cfebe721..6304942ca587aad6b4bd09e50d643b0b926e3631 100644 --- a/Framework/Crystal/test/DisjointElementTest.h +++ b/Framework/Crystal/test/DisjointElementTest.h @@ -151,7 +151,7 @@ public: // Create elements from 0-9 VecDisjointElement vecElements; for (int i = 0; i < 10; ++i) { - vecElements.push_back(boost::make_shared<DisjointElement>(i)); + vecElements.emplace_back(boost::make_shared<DisjointElement>(i)); } // Merge selected sets. diff --git a/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h b/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h index 1eff022b52c9cc19b8d838d847d6b5c21422e5dc..dd3965ddd43c084530a2184e16ca670a97e90584 100644 --- a/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h +++ b/Framework/Crystal/test/FindUBUsingLatticeParametersTest.h @@ -148,7 +148,7 @@ public: /// get a UB (although perhaps not a very good one). std::vector<size_t> rows; for (size_t i = 3; i < m_ws->rowCount(); ++i) { - rows.push_back(i); + rows.emplace_back(i); } Mantid::DataHandling::DeleteTableRows removeRowAlg; diff --git a/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h b/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h index cdae219e32f989909f8579428a3374afb3b65f39..924d4fe30502bb6cd01d44f9a36e56fb516b59f7 100644 --- a/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h +++ b/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h @@ -114,7 +114,7 @@ public: const auto L2 = detectorInfo.l2(detInfoIndex); const auto ScatAng = detectorInfo.twoTheta(detInfoIndex) / 180 * M_PI; std::vector<double> x; - x.push_back(PeakTime); + x.emplace_back(PeakTime); wl.fromTOF(x, x, L1, L2, ScatAng, 0, 0, 0); double wavelength = x[0]; @@ -152,8 +152,8 @@ public: T[chan] += val; val += 1.4; - dataY.push_back(val); - dataE.push_back(sqrt(val)); + dataY.emplace_back(val); + dataE.emplace_back(sqrt(val)); if ((val - 1.4) > MaxPeakIntensity * .1) { double Q = calcQ(bankR, detectorInfo, row, col, 1000.0 + chan * 50); dQ = max<double>(dQ, fabs(Q - Q0)); @@ -249,7 +249,7 @@ private: Kernel::Units::MomentumTransfer Q; std::vector<double> x; - x.push_back(time); + x.emplace_back(time); const auto ScatAng = detectorInfo.twoTheta(detInfoIndex) / 180 * M_PI; Q.fromTOF(x, x, L1, L2, ScatAng, 0, 0, 0.0); diff --git a/Framework/Crystal/test/IntegratePeaksHybridTest.h b/Framework/Crystal/test/IntegratePeaksHybridTest.h index c637f4cfa3e6ae78bbb3fe09c398648484eab0fd..dbc3221ad011508f2e85ce5bf0302454e3aa06d6 100644 --- a/Framework/Crystal/test/IntegratePeaksHybridTest.h +++ b/Framework/Crystal/test/IntegratePeaksHybridTest.h @@ -320,8 +320,8 @@ public: const double backgroundOuterRadius = peakRadiusVec[0] * 3; const size_t nBins = 10; std::vector<size_t> nEventsInPeakVec; - nEventsInPeakVec.push_back(10000); - nEventsInPeakVec.push_back( + nEventsInPeakVec.emplace_back(10000); + nEventsInPeakVec.emplace_back( 20000); // Second peak has DOUBLE the intensity of the firse one. MDEventPeaksWSTuple inputWorkspaces = diff --git a/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h b/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h index 8c9d44611fbf5b4ff358a33a87283e6e2a9aeee1..bc88840e56308d7076ab6458151baf342f8e5ea9 100644 --- a/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h +++ b/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h @@ -239,8 +239,8 @@ public: const double peakRadius = 1; const double threshold = 100; std::vector<size_t> nEventsInPeakVec; - nEventsInPeakVec.push_back(10000); - nEventsInPeakVec.push_back( + nEventsInPeakVec.emplace_back(10000); + nEventsInPeakVec.emplace_back( 20000); // Second peak has DOUBLE the intensity of the firse one. MDHistoPeaksWSTuple inputWorkspaces = make_peak_and_md_ws( diff --git a/Framework/Crystal/test/SCDCalibratePanelsTest.h b/Framework/Crystal/test/SCDCalibratePanelsTest.h index 7c3fd118ff95a6ce7f9e2996645488e87151d3d1..872cd45c4209a77fa2b4ad54de11cbe003cef454 100644 --- a/Framework/Crystal/test/SCDCalibratePanelsTest.h +++ b/Framework/Crystal/test/SCDCalibratePanelsTest.h @@ -43,7 +43,7 @@ public: std::vector<int> notBank47; for (int i = 0; i < int(numberPeaks); i++) if (pws->getPeak(i).getBankName() != "bank47") - notBank47.push_back(i); + notBank47.emplace_back(i); pws->removePeaks(std::move(notBank47)); // run the calibration diff --git a/Framework/Crystal/test/SortPeaksWorkspaceTest.h b/Framework/Crystal/test/SortPeaksWorkspaceTest.h index b85e6c6e166ba6bd55aa4638e8f70742533579c1..e8183314341085341cdb7087053925401054a22a 100644 --- a/Framework/Crystal/test/SortPeaksWorkspaceTest.h +++ b/Framework/Crystal/test/SortPeaksWorkspaceTest.h @@ -51,7 +51,7 @@ private: std::vector<double> potentiallySorted; for (size_t rowIndex = 0; rowIndex < outWS->rowCount(); ++rowIndex) { TableRow row = outWS->getRow(rowIndex); - potentiallySorted.push_back(row.Double(columnIndex)); + potentiallySorted.emplace_back(row.Double(columnIndex)); } // Compare the contents of the container to determine how the column has diff --git a/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp index ca60b57c9a586abf944b937019b07a76943d1d90..ba855332462c0086e57d6d8548f911c0fefb0cc4 100644 --- a/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateChiSquared.cpp @@ -463,7 +463,7 @@ void CalculateChiSquared::estimateErrors() { // Find the roots of the derivative polynomial std::vector<double> minima = base->roots(AD); if (minima.empty()) { - minima.push_back(par0); + minima.emplace_back(par0); } if (g_log.is(Kernel::Logger::Priority::PRIO_DEBUG)) { @@ -507,7 +507,7 @@ void CalculateChiSquared::estimateErrors() { } else if (roots.size() == 1) { // Only one root found; use a bound for the other root. if (roots.front() < 0) { - roots.push_back(rBound); + roots.emplace_back(rBound); } else { roots.insert(roots.begin(), lBound); } @@ -626,7 +626,7 @@ void CalculateChiSquared::estimateErrors() { if (roots.front() > 0.0) { roots.insert(roots.begin(), 0.0); } else { - roots.push_back(0.0); + roots.emplace_back(0.0); } } else if (nRoots > 2) { roots[1] = roots.back(); @@ -669,7 +669,7 @@ void CalculateChiSquared::unfixParameters() { for (size_t i = 0; i < m_function->nParams(); ++i) { if (!m_function->isActive(i)) { m_function->unfix(i); - m_fixedParameters.push_back(i); + m_fixedParameters.emplace_back(i); } } } diff --git a/Framework/CurveFitting/src/Algorithms/EstimateFitParameters.cpp b/Framework/CurveFitting/src/Algorithms/EstimateFitParameters.cpp index 0ef7f022ceea4e6f307285191ceab74fb9e31899..b320a5dc615f750fa37f41ee68fe72576704e11f 100644 --- a/Framework/CurveFitting/src/Algorithms/EstimateFitParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/EstimateFitParameters.cpp @@ -103,7 +103,7 @@ void fixBadParameters(CostFunctions::CostFuncFitting &costFunction, if (fix) { // Parameter is bad - fix it. Delay actual fixing until all bad ones // found. - indicesOfFixed.push_back(i); + indicesOfFixed.emplace_back(i); } ++j; } @@ -231,7 +231,7 @@ void runCrossEntropy( for (auto &range : ranges) { auto mean = (range.first + range.second) / 2; auto sigma = std::fabs(range.first - range.second) / 2; - distributionParams.push_back(std::make_pair(mean, sigma)); + distributionParams.emplace_back(std::make_pair(mean, sigma)); } auto nParams = costFunction.nParams(); @@ -371,7 +371,7 @@ void EstimateFitParameters::execConcrete() { for (auto &term : expr.terms()) { IConstraint *c = ConstraintFactory::Instance().createInitialized(func.get(), term); - constraints.push_back(std::unique_ptr<IConstraint>(c)); + constraints.emplace_back(std::unique_ptr<IConstraint>(c)); } } @@ -402,7 +402,7 @@ void EstimateFitParameters::execConcrete() { } // Use the lower and upper bounds of the constraint to set the range // of a generator with uniform distribution. - ranges.push_back(std::make_pair(boundary->lower(), boundary->upper())); + ranges.emplace_back(std::make_pair(boundary->lower(), boundary->upper())); } // Number of parameters could have changed costFunction->reset(); diff --git a/Framework/CurveFitting/src/Algorithms/Fit1D.cpp b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp index 28b4a68fa45e17d90132ecb2418927120fbce2e4..1c2613579d45bdd75f0003e4a23b6d0e3ac272a3 100644 --- a/Framework/CurveFitting/src/Algorithms/Fit1D.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp @@ -286,7 +286,7 @@ void Fit1D::init() { // load the name of these specific parameter into a vector for later use const std::vector<Property *> props = getProperties(); for (size_t i = i0; i < props.size(); i++) { - m_parameterNames.push_back(props[i]->name()); + m_parameterNames.emplace_back(props[i]->name()); } declareProperty("Fix", "", @@ -457,7 +457,7 @@ void Fit1D::exec() { m_fittedParameter.clear(); for (size_t i = 0; i < nParams(); i++) { - m_fittedParameter.push_back(getProperty(m_parameterNames[i])); + m_fittedParameter.emplace_back(getProperty(m_parameterNames[i])); } modifyInitialFittedParameters( m_fittedParameter); // does nothing except if overwritten by derived class @@ -609,7 +609,7 @@ void Fit1D::exec() { int iPNotFixed = 0; for (size_t i = 0; i < nParams(); i++) { - sdExtended.push_back(1.0); + sdExtended.emplace_back(1.0); if (l_data.active[i]) { sdExtended[i] = sqrt(gsl_matrix_get(covar, iPNotFixed, iPNotFixed)); iPNotFixed++; @@ -618,7 +618,7 @@ void Fit1D::exec() { modifyFinalFittedParameters(sdExtended); for (size_t i = 0; i < nParams(); i++) if (l_data.active[i]) - standardDeviations.push_back(sdExtended[i]); + standardDeviations.emplace_back(sdExtended[i]); declareProperty( std::make_unique<WorkspaceProperty<API::ITableWorkspace>>( @@ -637,7 +637,7 @@ void Fit1D::exec() { for (size_t i = 0; i < nParams(); i++) { if (l_data.active[i]) { m_covariance->addColumn("double", m_parameterNames[i]); - paramThatAreFitted.push_back(m_parameterNames[i]); + paramThatAreFitted.emplace_back(m_parameterNames[i]); } } diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index 0f3886ad09c90bd1ad980e057728bba28b6cd385..62cafb6331bdeb001193e9d5db7bb81515cdd056 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -699,9 +699,9 @@ bool FitPowderDiffPeaks::fitSinglePeakRobust( map<string, double> solutiona; storeFunctionParameters(peak, solutiona); - chi2s.push_back(chi2a); - goodfits.push_back(fitgooda); - solutions.push_back(solutiona); + chi2s.emplace_back(chi2a); + goodfits.emplace_back(fitgooda); + solutions.emplace_back(solutiona); string peakinfoa1 = getFunctionInfo(boost::dynamic_pointer_cast<IFunction>(peak)); @@ -726,9 +726,9 @@ bool FitPowderDiffPeaks::fitSinglePeakRobust( map<string, double> solutionb; storeFunctionParameters(peak, solutionb); - chi2s.push_back(chi2b); - goodfits.push_back(fitgoodb); - solutions.push_back(solutionb); + chi2s.emplace_back(chi2b); + goodfits.emplace_back(fitgoodb); + solutions.emplace_back(solutionb); string peakinfob1 = getFunctionInfo(boost::dynamic_pointer_cast<IFunction>(peak)); @@ -754,9 +754,9 @@ bool FitPowderDiffPeaks::fitSinglePeakRobust( map<string, double> solutionc; storeFunctionParameters(peak, solutionc); - chi2s.push_back(chi2c); - goodfits.push_back(fitgoodc); - solutions.push_back(solutionc); + chi2s.emplace_back(chi2c); + goodfits.emplace_back(fitgoodc); + solutions.emplace_back(solutionc); string peakinfoc1 = getFunctionInfo(boost::dynamic_pointer_cast<IFunction>(peak)); @@ -765,9 +765,9 @@ bool FitPowderDiffPeaks::fitSinglePeakRobust( << peakinfoc1 << '\n'; } else { // No right peak information: set a error entry - chi2s.push_back(DBL_MAX); - goodfits.push_back(false); - solutions.push_back(rightpeakparammap); + chi2s.emplace_back(DBL_MAX); + goodfits.emplace_back(false); + solutions.emplace_back(rightpeakparammap); } // 6. Summarize the above 3 approach @@ -1133,7 +1133,7 @@ void FitPowderDiffPeaks::fitPeaksWithGoodStartingValues() { // a) Add this peak, BackToBackExponential_sptr thispeak = m_vecPeakFunctions[ipeak].second.second; - indexpeakgroup.push_back(ipeak); + indexpeakgroup.emplace_back(ipeak); // b) update the peak index --ipeak; @@ -1190,7 +1190,7 @@ void FitPowderDiffPeaks::fitPeaksWithGoodStartingValues() { for (auto ipk : indexpeakgroup) { BackToBackExponential_sptr temppeak = m_vecPeakFunctions[ipk].second.second; - peaksgroup.push_back(temppeak); + peaksgroup.emplace_back(temppeak); } fitOverlappedPeaks(peaksgroup, backgroundfunction, -1.0); @@ -1304,7 +1304,7 @@ bool FitPowderDiffPeaks::fitSinglePeakConfident( // Store parameters map<string, double> step1params; storeFunctionParameters(peak, step1params); - fitparamvaluemaps.push_back(step1params); + fitparamvaluemaps.emplace_back(step1params); if (!goodfit1) chi2height = 1.0E20; chi2indexvec.emplace_back(chi2height, 0); @@ -1326,7 +1326,7 @@ bool FitPowderDiffPeaks::fitSinglePeakConfident( storeFunctionParameters(peak, planAparams); if (!goodfitA) chi2planA = 1.0E20; - fitparamvaluemaps.push_back(planAparams); + fitparamvaluemaps.emplace_back(planAparams); chi2indexvec.emplace_back(chi2planA, 1); // c) Plan B: fit parameters in two groups in 2 steps @@ -1361,7 +1361,7 @@ bool FitPowderDiffPeaks::fitSinglePeakConfident( storeFunctionParameters(peak, planBparams); if (!goodfitB) chi2planB = 1.0E20; - fitparamvaluemaps.push_back(planBparams); + fitparamvaluemaps.emplace_back(planBparams); chi2indexvec.emplace_back(chi2planB, 2); // d) Plan C: fit parameters in two groups in 2 steps in alternate order @@ -1396,7 +1396,7 @@ bool FitPowderDiffPeaks::fitSinglePeakConfident( storeFunctionParameters(peak, planCparams); if (!goodfitC) chi2planC = 1.0E20; - fitparamvaluemaps.push_back(planCparams); + fitparamvaluemaps.emplace_back(planCparams); chi2indexvec.emplace_back(chi2planC, 3); // d) Summarize and compare result @@ -1565,9 +1565,9 @@ FitPowderDiffPeaks::doFitPeak(Workspace2D_sptr dataws, minimizers[1] = "Levenberg-Marquardt"; vector<size_t> maxiterations(2, 1000); vector<double> dampings(2, 0.0); - vecMinimizers.push_back(minimizers); - vecMaxIterations.push_back(maxiterations); - vecDampings.push_back(dampings); + vecMinimizers.emplace_back(minimizers); + vecMaxIterations.emplace_back(maxiterations); + vecDampings.emplace_back(dampings); */ vector<string> minimizers2(3); @@ -1577,9 +1577,9 @@ FitPowderDiffPeaks::doFitPeak(Workspace2D_sptr dataws, vector<size_t> maxiterations2(3, 1000); maxiterations2[0] = 10000; vector<double> dampings2(3, 0.0); - vecMinimizers.push_back(minimizers2); - vecMaxIterations.push_back(maxiterations2); - vecDampings.push_back(dampings2); + vecMinimizers.emplace_back(minimizers2); + vecMaxIterations.emplace_back(maxiterations2); + vecDampings.emplace_back(dampings2); // 4. Fit in different sequential bool goodfit = false; @@ -2070,7 +2070,7 @@ void FitPowderDiffPeaks::estimatePeakHeightsLeBail( vector<vector<double>> peakvalues; for (size_t i = 0; i < (peaks.size() + 1); ++i) { vector<double> peakvalue(domain.size(), 0.0); - peakvalues.push_back(peakvalue); + peakvalues.emplace_back(peakvalue); } // 2. Calcualte peak values @@ -2320,8 +2320,8 @@ void FitPowderDiffPeaks::parseBraggPeakTable( } // ENDFOR Column - parammaps.push_back(doublemap); - hklmaps.push_back(intmap); + parammaps.emplace_back(doublemap); + hklmaps.emplace_back(intmap); } // ENDFOR Row @@ -2405,12 +2405,12 @@ Workspace2D_sptr FitPowderDiffPeaks::genPeakParameterDataWorkspace() { double p_s = peak->getParameter("S"); // b) To vectors - vecchi2.push_back(chi2); - vecdh.push_back(dh); - vectofh.push_back(p_x); - vecalpha.push_back(p_a); - vecbeta.push_back(p_b); - vecsigma.push_back(p_s); + vecchi2.emplace_back(chi2); + vecdh.emplace_back(dh); + vectofh.emplace_back(p_x); + vecalpha.emplace_back(p_a); + vecbeta.emplace_back(p_b); + vecsigma.emplace_back(p_s); } } // ENDFOR i(peak) @@ -2512,10 +2512,10 @@ FitPowderDiffPeaks::genPeakParametersWorkspace() { newrow << chi2; // iv. Prepare for Z-score - // vectofh.push_back(p_x); - // vecalpha.push_back(p_a); - // vecbeta.push_back(p_b); - // vecsigma.push_back(p_s); + // vectofh.emplace_back(p_x); + // vecalpha.emplace_back(p_a); + // vecbeta.emplace_back(p_b); + // vecsigma.emplace_back(p_s); vectofh[i] = p_x; vecalpha[i] = p_a; vecbeta[i] = p_b; @@ -2962,7 +2962,7 @@ bool FitPowderDiffPeaks::getHKLFromMap(map<string, int> intmap, if (miter == intmap.end()) return false; - hkl.push_back(miter->second); + hkl.emplace_back(miter->second); } return true; diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index f18c16cedd0b63b411b313974a74b4b192245383..52b387aeb6b67b201778742de388de1109691fb8 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -414,7 +414,7 @@ void LeBailFit::processInputBackground() { for (size_t i = i0; i < numparams; ++i) { stringstream parss; parss << "A" << (i - i0); - m_backgroundParameterNames.push_back(parss.str()); + m_backgroundParameterNames.emplace_back(parss.str()); } g_log.information() << "[Input] Use background specified with vector with " @@ -748,7 +748,7 @@ void LeBailFit::createLeBailFunction() { vector<pair<vector<int>, double>>::iterator piter; for (piter = m_inputPeakInfoVec.begin(); piter != m_inputPeakInfoVec.end(); ++piter) - vecHKL.push_back(piter->first); + vecHKL.emplace_back(piter->first); m_lebailFunction->addPeaks(vecHKL); // Add background @@ -1123,9 +1123,9 @@ void LeBailFit::parseBraggPeaksParametersTable() { // 3. Insert related data structure std::vector<int> hkl; - hkl.push_back(h); - hkl.push_back(k); - hkl.push_back(l); + hkl.emplace_back(h); + hkl.emplace_back(k); + hkl.emplace_back(l); // optional peak height double peakheight = 1.0; @@ -1203,8 +1203,8 @@ void LeBailFit::parseBackgroundTableWorkspace(TableWorkspace_sptr bkgdparamws, for (mit = parmap.begin(); mit != parmap.end(); ++mit) { std::string parname = mit->first; double parvalue = mit->second; - bkgdparnames.push_back(parname); - bkgdorderparams.push_back(parvalue); + bkgdparnames.emplace_back(parname); + bkgdorderparams.emplace_back(parvalue); } // Debug output @@ -1765,7 +1765,7 @@ void LeBailFit::setupRandomWalkStrategyFromTable( map<int, vector<string>>::iterator giter; giter = m_MCGroups.find(group); if (giter != m_MCGroups.end()) { - giter->second.push_back(parname); + giter->second.emplace_back(parname); } else { // First instance in the new group. m_MCGroups.emplace(group, vector<string>{parname}); @@ -1954,7 +1954,7 @@ void LeBailFit::addParameterToMCMinimize(vector<string> &parnamesforMC, } if (pariter->second.fit) - parnamesforMC.push_back(parname); + parnamesforMC.emplace_back(parname); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp index b00f5e4c3af5c2302d9687870cdee8ca22243450..4be1667ddefc580ed771927b674fc74e7d406bdf 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp @@ -293,7 +293,7 @@ void LeBailFunction::addPeaks(std::vector<std::vector<int>> peakhkls) { double dsp = newpeak->getPeakParameter("d_h"); // Add new peak to all related data storage - m_vecPeaks.push_back(newpeak); + m_vecPeaks.emplace_back(newpeak); // FIXME - Refining lattice size is not considered here! m_dspPeakVec.emplace_back(dsp, newpeak); m_mapHKLPeak.emplace(hkl, newpeak); @@ -773,7 +773,7 @@ void LeBailFunction::groupPeaks( IPowderDiffPeakFunction_sptr peak = m_dspPeakVec[ipk].second; if (peak->centre() <= xmin) { // Add peak - outboundpeakvec.push_back(peak); + outboundpeakvec.emplace_back(peak); ipk += 1; } else { // Get out of while loop if peak is in bound @@ -790,7 +790,7 @@ void LeBailFunction::groupPeaks( // Peak is in the boundary still // add peak to CURRENT peak group - peakgroup.push_back(m_dspPeakVec[ipk]); + peakgroup.emplace_back(m_dspPeakVec[ipk]); if (ipk < m_numPeaks - 1) { // Any peak but not the last (rightmost) peak @@ -806,7 +806,7 @@ void LeBailFunction::groupPeaks( if (thispeak_rightbound < rightpeak_leftbound) { // this peak and its right peak are well separated. // finish this group by swapping values - peakgroupvec.push_back(std::move(peakgroup)); + peakgroupvec.emplace_back(std::move(peakgroup)); peakgroup = {}; } else { // this peak and its right peak are close enough to be in same group. @@ -815,7 +815,7 @@ void LeBailFunction::groupPeaks( } } else { // Rightmost peak. Finish the current peak - peakgroupvec.push_back(peakgroup); + peakgroupvec.emplace_back(peakgroup); } ++ipk; @@ -828,14 +828,14 @@ void LeBailFunction::groupPeaks( << "peak over at maximum TOF = " << xmax << ".\n"; if (!peakgroup.empty()) { - peakgroupvec.push_back(peakgroup); + peakgroupvec.emplace_back(peakgroup); } } // FIRST out of boundary } // ENDWHILE while (ipk < m_numPeaks) { // Group peaks out of uppper boundary to a separate vector of peaks - outboundpeakvec.push_back(m_dspPeakVec[ipk].second); + outboundpeakvec.emplace_back(m_dspPeakVec[ipk].second); ipk += 1; } diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index f604e2ccb471df599c15a55303672ba4735c1667..603098b70397e2f77cbfb81fce9b78b4a0f7fff3 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -486,7 +486,7 @@ PlotPeakByLogValue::getWorkspace(const InputData &data) { for (size_t i = 0; i < axis->length(); ++i) { auto s = double(axis->spectraNo(i)); if (s >= out.start && s <= out.end) { - out.indx.push_back(static_cast<int>(i)); + out.indx.emplace_back(static_cast<int>(i)); } } } @@ -514,7 +514,7 @@ PlotPeakByLogValue::getWorkspace(const InputData &data) { for (size_t i = 0; i < axis->length(); ++i) { double s = (*axis)(i); if (s >= out.start && s <= out.end) { - out.indx.push_back(static_cast<int>(i)); + out.indx.emplace_back(static_cast<int>(i)); } } } @@ -667,7 +667,7 @@ std::string PlotPeakByLogValue::getMinimizerString(const std::string &wsName, const std::string &wsPropValue = minimizerProp->value(); if (!wsPropValue.empty()) { const std::string &wsPropName = minimizerProp->name(); - m_minimizerWorkspaces[wsPropName].push_back(wsPropValue); + m_minimizerWorkspaces[wsPropName].emplace_back(wsPropValue); } } } diff --git a/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp b/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp index 61e0c7df518931e1090a97afb35af30b3886032a..ece25dbf58b55732e0093e812c2e15af4388bd6f 100644 --- a/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp +++ b/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp @@ -304,7 +304,7 @@ runParameterProcessingWithGrouping(IAlgorithm &processingAlgorithm, static_cast<int>(grouping[i + 1]) - 1); processingAlgorithm.setProperty("OutputWorkspace", "__Result"); processingAlgorithm.execute(); - results.push_back(processingAlgorithm.getProperty("OutputWorkspace")); + results.emplace_back(processingAlgorithm.getProperty("OutputWorkspace")); } return createGroup(results); } diff --git a/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp b/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp index 1077bafb7ff4e4b7a4553a4968e3f3f4fc211fff..38a21c703e1196c0caa76824aca6d565b6d49327 100644 --- a/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp +++ b/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp @@ -294,7 +294,7 @@ runParameterProcessingWithGrouping(IAlgorithm &processingAlgorithm, static_cast<int>(grouping[i + 1]) - 1); processingAlgorithm.setProperty("OutputWorkspace", "__Result"); processingAlgorithm.execute(); - results.push_back(processingAlgorithm.getProperty("OutputWorkspace")); + results.emplace_back(processingAlgorithm.getProperty("OutputWorkspace")); } return createGroup(results); } diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index 664c8a1031826c2902df72ac749c0c9d95a8d3b8..d9f43c4a76288799c33ff172eaf046971aaa002f 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -540,7 +540,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( for (size_t i = 0; i < numparameters; ++i) { string parname = parnames[i]; double parvalue = m_FuncParameters[parname]; - paramvalues.push_back(parvalue); + paramvalues.emplace_back(parvalue); m_Function->setParameter(parname, parvalue); } @@ -674,7 +674,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( newparvalues.reserve(numparameters); for (size_t i = 0; i < numparameters; ++i) { double parvalue = func4fit->getParameter(i); - newparvalues.push_back(parvalue); + newparvalues.emplace_back(parvalue); } m_BestFitParameters.emplace_back(homchi2, newparvalues); m_BestFitChi2s.emplace_back(homchi2, gslchi2); @@ -882,9 +882,9 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( newpeakptr->setParameter("I", height); std::vector<int> hkl; - hkl.push_back(h); - hkl.push_back(k); - hkl.push_back(l); + hkl.emplace_back(h); + hkl.emplace_back(k); + hkl.emplace_back(l); m_Peaks.emplace(hkl, newpeakptr); @@ -1008,9 +1008,9 @@ void RefinePowderInstrumentParameters::importMonteCarloParametersFromTable( tstepsize = tmpdbl; } vector<double> tmpvec; - tmpvec.push_back(tmin); - tmpvec.push_back(tmax); - tmpvec.push_back(tstepsize); + tmpvec.emplace_back(tmin); + tmpvec.emplace_back(tmax); + tmpvec.emplace_back(tstepsize); mcparameters.emplace(parname, tmpvec); } @@ -1030,9 +1030,9 @@ void RefinePowderInstrumentParameters::importMonteCarloParametersFromTable( vector<double> mcparvalues = mit->second; // b) Build for the output - lowerbounds.push_back(mcparvalues[0]); - upperbounds.push_back(mcparvalues[1]); - stepsizes.push_back(mcparvalues[2]); + lowerbounds.emplace_back(mcparvalues[0]); + upperbounds.emplace_back(mcparvalues[1]); + stepsizes.emplace_back(mcparvalues[2]); } } @@ -1060,7 +1060,7 @@ void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial( << " is not ThermalNeutronDtoTOFFunction. And it is not " "required to calculate n.\n"; for (size_t i = 0; i < xVals.size(); ++i) - vec_n.push_back(0); + vec_n.emplace_back(0); } double width = m_Function->getParameter("Width"); @@ -1068,7 +1068,7 @@ void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial( for (double dh : xVals) { double n = 0.5 * gsl_sf_erfc(width * (tcross - 1 / dh)); - vec_n.push_back(n); + vec_n.emplace_back(n); } } diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index 306c19e6167678b2a53d444de0663d7e27604dc6..998218c8c57b589446af285dfe2ec6d9545b50de 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -692,7 +692,7 @@ void RefinePowderInstrumentParameters3::setupRandomWalkStrategy( addParameterToMCMinimize(geomparams, "Zerot", parammap); addParameterToMCMinimize(geomparams, "Width", parammap); addParameterToMCMinimize(geomparams, "Tcross", parammap); - mcgroups.push_back(geomparams); + mcgroups.emplace_back(geomparams); dboutss << "Geometry parameters: "; for (auto &geomparam : geomparams) @@ -765,7 +765,7 @@ void RefinePowderInstrumentParameters3::addParameterToMCMinimize( } if (pariter->second.fit) - parnamesforMC.push_back(parname); + parnamesforMC.emplace_back(parname); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp index f26aa2080a8b0c207c471f0ce48208ad223cb657..88ef35a072f43dbbe1f900116f02323914703b93 100644 --- a/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp @@ -240,7 +240,7 @@ void CostFuncFitting::reset() const { m_indexMap.clear(); for (size_t i = 0; i < m_numberFunParams; ++i) { if (m_function->isActive(i)) { - m_indexMap.push_back(i); + m_indexMap.emplace_back(i); } API::IConstraint *c = m_function->getConstraint(i); if (c) { diff --git a/Framework/CurveFitting/src/FitMW.cpp b/Framework/CurveFitting/src/FitMW.cpp index 6a18ba146dd7a6751d9bbfd1a1e6f1cbbd85ea7e..cb57c1d3be78659db1505e8a1628603d6b2f8f5b 100644 --- a/Framework/CurveFitting/src/FitMW.cpp +++ b/Framework/CurveFitting/src/FitMW.cpp @@ -82,8 +82,8 @@ void joinOverlappingRanges(std::vector<double> &exclude) { std::vector<RangePoint> points; points.reserve(exclude.size()); for (auto point = exclude.begin(); point != exclude.end(); point += 2) { - points.push_back(RangePoint{RangePoint::Openning, *point}); - points.push_back(RangePoint{RangePoint::Closing, *(point + 1)}); + points.emplace_back(RangePoint{RangePoint::Openning, *point}); + points.emplace_back(RangePoint{RangePoint::Closing, *(point + 1)}); } // Sort the points according to the operator defined in RangePoint. std::sort(points.begin(), points.end()); @@ -97,14 +97,14 @@ void joinOverlappingRanges(std::vector<double> &exclude) { if (point.kind == RangePoint::Openning) { if (level == 0) { // First openning bracket starts a new exclusion range. - exclude.push_back(point.value); + exclude.emplace_back(point.value); } // Each openning bracket increases the level ++level; } else { if (level == 1) { // The bracket that makes level 0 is an end of a range. - exclude.push_back(point.value); + exclude.emplace_back(point.value); } // Each closing bracket decreases the level --level; diff --git a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp index c4bb3fcf5a2c198ba90859dd8e58eba769bc297c..52407cf3cee0f1eca841d313e9fd5ed34454794f 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp @@ -493,9 +493,9 @@ void FABADAMinimizer::algorithmDisplacement(const size_t ¶meterIndex, // If new Chi square value is lower, jumping directly to new parameter if (chi2New < m_chi2) { for (size_t j = 0; j < m_nParams; j++) { - m_chain[j].push_back(newParameters.get(j)); + m_chain[j].emplace_back(newParameters.get(j)); } - m_chain[m_nParams].push_back(chi2New); + m_chain[m_nParams].emplace_back(chi2New); m_parameters = newParameters; m_chi2 = chi2New; m_changes[parameterIndex] += 1; @@ -510,17 +510,17 @@ void FABADAMinimizer::algorithmDisplacement(const size_t ¶meterIndex, double p = std::uniform_real_distribution<double>(0.0, 1.0)(rng); if (p <= prob) { for (size_t j = 0; j < m_nParams; j++) { - m_chain[j].push_back(newParameters.get(j)); + m_chain[j].emplace_back(newParameters.get(j)); } - m_chain[m_nParams].push_back(chi2New); + m_chain[m_nParams].emplace_back(chi2New); m_parameters = newParameters; m_chi2 = chi2New; m_changes[parameterIndex] += 1; } else { for (size_t j = 0; j < m_nParams; j++) { - m_chain[j].push_back(m_parameters.get(j)); + m_chain[j].emplace_back(m_parameters.get(j)); } - m_chain[m_nParams].push_back(m_chi2); + m_chain[m_nParams].emplace_back(m_chi2); // Old parameters taken again for (size_t j = 0; j < m_nParams; ++j) { m_fitFunction->setParameter(j, m_parameters.get(j)); @@ -1009,7 +1009,7 @@ void FABADAMinimizer::calculateConvChainAndBestParameters( for (size_t j = 0; j < m_nParams; ++j) { // Obs: Starts at 1 (0 already added) for (size_t k = 1; k < convLength; ++k) { - reducedChain[j].push_back(m_chain[j][m_convPoint + nSteps * k]); + reducedChain[j].emplace_back(m_chain[j][m_convPoint + nSteps * k]); } // best fit parameters taken bestParameters[j] = @@ -1085,12 +1085,12 @@ void FABADAMinimizer::initChainsAndParameters() { } // Initialize chains - m_chain.push_back(std::vector<double>(1, param)); + m_chain.emplace_back(std::vector<double>(1, param)); // Initilize jump parameters - m_jump.push_back(param != 0.0 ? std::abs(param / 10) : 0.01); + m_jump.emplace_back(param != 0.0 ? std::abs(param / 10) : 0.01); } m_chi2 = m_leastSquares->val(); - m_chain.push_back(std::vector<double>(1, m_chi2)); + m_chain.emplace_back(std::vector<double>(1, m_chi2)); m_parChanged = std::vector<bool>(m_nParams, false); m_changes = std::vector<int>(m_nParams, 0); m_changesOld = m_changes; diff --git a/Framework/CurveFitting/src/FuncMinimizers/TrustRegionMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/TrustRegionMinimizer.cpp index fe0a083be9d65b2fce55a8c68e7299422eeddb5f..fe01820271590c0169cf34e1e2c33b0656baa0b4 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/TrustRegionMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/TrustRegionMinimizer.cpp @@ -65,10 +65,10 @@ void TrustRegionMinimizer::initialize(API::ICostFunction_sptr costFunction, int j = 0; for (size_t i = 0; i < m_function->nParams(); ++i) { if (m_function->isActive(i)) { - m_J.m_index.push_back(j); + m_J.m_index.emplace_back(j); j++; } else - m_J.m_index.push_back(-1); + m_J.m_index.emplace_back(-1); } m_options.initial_radius = getProperty("InitialRadius"); } @@ -1056,7 +1056,7 @@ void solveSubproblemMain(int n, double radius, double f, history_type history_item; history_item.lambda = lambda; history_item.x_norm = inform.x_norm; - inform.history.push_back(history_item); + inform.history.emplace_back(history_item); inform.len_history = inform.len_history + 1; } diff --git a/Framework/CurveFitting/src/Functions/ChebfunBase.cpp b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp index 808c69daf4fd37753ac218814da73cc681183821..ee537114d65412c2628e787374787c41914feab3 100644 --- a/Framework/CurveFitting/src/Functions/ChebfunBase.cpp +++ b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp @@ -455,7 +455,7 @@ ChebfunBase::bestFitTempl(double start, double end, FunctionType f, } p.clear(); a.clear(); - a.push_back(maxA); + a.emplace_back(maxA); return ChebfunBase_sptr(); } @@ -660,7 +660,7 @@ std::vector<double> ChebfunBase::fitOdd(const API::IFunction &f, xOdd.reserve(pOdd.size()); // m_x is odd-sized so the loop is ok for (auto x = m_x.begin() + 1; x != m_x.end(); x += 2) { - xOdd.push_back(*x); + xOdd.emplace_back(*x); } API::FunctionDomain1DView x(xOdd.data(), xOdd.size()); @@ -737,7 +737,7 @@ std::vector<double> ChebfunBase::roots(const std::vector<double> &a) const { } else { if (im + firstIm < 1e-10) { double x = startX() + (re + 1.0) / 2.0 * Dx; - r.push_back(x); + r.emplace_back(x); } isFirst = true; } diff --git a/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp index 4b9df2c907945ae623ac89a3924d0f199475fe77..9866ce0bfe5e761f3e992b01c85b8f3c1c83a57b 100644 --- a/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp +++ b/Framework/CurveFitting/src/Functions/ComptonScatteringCountRate.cpp @@ -314,12 +314,12 @@ void ComptonScatteringCountRate::cacheFunctions() { void ComptonScatteringCountRate::cacheComptonProfile( const boost::shared_ptr<ComptonProfile> &profile, const size_t paramsOffset) { - m_profiles.push_back(profile.get()); + m_profiles.emplace_back(profile.get()); auto fixedParams = profile->intensityParameterIndices(); for (auto fixedParam : fixedParams) { const size_t indexOfFixed = paramsOffset + fixedParam; this->setParameterStatus(indexOfFixed, Tied); - m_fixedParamIndices.push_back(indexOfFixed); + m_fixedParamIndices.emplace_back(indexOfFixed); } } @@ -340,7 +340,7 @@ void ComptonScatteringCountRate::cacheBackground( { const size_t indexOfFixed = paramsOffset + (i - 1); this->setParameterStatus(indexOfFixed, Tied); - m_fixedParamIndices.push_back(indexOfFixed); + m_fixedParamIndices.emplace_back(indexOfFixed); } } else { std::ostringstream os; diff --git a/Framework/CurveFitting/src/Functions/Convolution.cpp b/Framework/CurveFitting/src/Functions/Convolution.cpp index 0831c2e8897d5209d716e2d07ba2564756905b86..e2065e8a5d0490adc0dfa28d80af74f3724c7011 100644 --- a/Framework/CurveFitting/src/Functions/Convolution.cpp +++ b/Framework/CurveFitting/src/Functions/Convolution.cpp @@ -211,7 +211,7 @@ void Convolution::functionFFTMode(const FunctionDomain &domain, for (size_t i = 0; i < cf->nFunctions(); ++i) { auto df = boost::dynamic_pointer_cast<DeltaFunction>(cf->getFunction(i)); if (df) { - dltFuns.push_back(df); + dltFuns.emplace_back(df); if (df->getParameter("Centre") != 0.0) { deltaShifted = true; } @@ -226,7 +226,7 @@ void Convolution::functionFFTMode(const FunctionDomain &domain, boost::dynamic_pointer_cast<DeltaFunction>(getFunction(1))) { // single delta function - return scaled resolution deltaFunctionsOnly = true; - dltFuns.push_back(df); + dltFuns.emplace_back(df); if (df->getParameter("Centre") != 0.0) { deltaShifted = true; } @@ -366,7 +366,7 @@ void Convolution::functionDirectMode(const FunctionDomain &domain, for (size_t i = 0; i < cf->nFunctions(); ++i) { auto df = boost::dynamic_pointer_cast<DeltaFunction>(cf->getFunction(i)); if (df) { - dltFuns.push_back(df); + dltFuns.emplace_back(df); if (df->getParameter("Centre") != 0.0) { deltaShifted = true; } @@ -381,7 +381,7 @@ void Convolution::functionDirectMode(const FunctionDomain &domain, boost::dynamic_pointer_cast<DeltaFunction>(getFunction(1))) { // single delta function - return scaled resolution deltaFunctionsOnly = true; - dltFuns.push_back(df); + dltFuns.emplace_back(df); if (df->getParameter("Centre") != 0.0) { deltaShifted = true; } diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldControl.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldControl.cpp index ec835c485effe5e312c63fd88728f45ce6ffb21e..243140dbf45130b9c501ffccd68a8b1a2f07dd7b 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldControl.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldControl.cpp @@ -116,15 +116,15 @@ void CrystalFieldControl::cacheAttributes() { if (nSpec == 1) { auto fwhmX = getAttribute("FWHMX").asVector(); auto fwhmY = getAttribute("FWHMY").asVector(); - m_fwhmX.push_back(fwhmX); - m_fwhmY.push_back(fwhmY); + m_fwhmX.emplace_back(fwhmX); + m_fwhmY.emplace_back(fwhmY); } else { for (size_t i = 0; i < nSpec; ++i) { auto &control = *getFunction(i); auto fwhmX = control.getAttribute("FWHMX").asVector(); auto fwhmY = control.getAttribute("FWHMY").asVector(); - m_fwhmX.push_back(fwhmX); - m_fwhmY.push_back(fwhmY); + m_fwhmX.emplace_back(fwhmX); + m_fwhmY.emplace_back(fwhmY); } } } diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp index 88fea6cbb6b25e7f13bcbb923cb13fd9fcb299f0..ac336ed106287991ce1c817ce0b0959d3606a201 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp @@ -95,7 +95,8 @@ public: "Intensity scaling factor for spectrum " + si); } catch (std::invalid_argument &) { } - m_IntensityScalingIdx.push_back(parameterIndex("IntensityScaling" + si)); + m_IntensityScalingIdx.emplace_back( + parameterIndex("IntensityScaling" + si)); } } }; @@ -146,7 +147,7 @@ CrystalFieldFunction::createEquivalentFunctions() const { if (cfun) { cfun->checkFunction(); } - funs.push_back(fun); + funs.emplace_back(fun); } return funs; } @@ -408,7 +409,7 @@ void CrystalFieldFunction::buildAttributeNames() const { controlAttributeNames.end(), name); if (iterFound != controlAttributeNames.end()) { controlAttributeNames.erase(iterFound); - m_attributeNames.push_back(name); + m_attributeNames.emplace_back(name); } }; // Prepend a prefix to attribute names, ignore NumDeriv attribute. @@ -418,7 +419,7 @@ void CrystalFieldFunction::buildAttributeNames() const { if (name == "NumDeriv") continue; name.insert(name.begin(), prefix.begin(), prefix.end()); - m_attributeNames.push_back(name); + m_attributeNames.emplace_back(name); } }; // These names must appear first and in this order in the output vector diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp index d37ddeb348b3195e02f9b2832246e4f07eb9906f..c0c0730f33b6ca174675049780f3e333bb75262b 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldMultiSpectrum.cpp @@ -77,7 +77,8 @@ public: "Intensity scaling factor for spectrum " + si); } catch (std::invalid_argument &) { } - m_IntensityScalingIdx.push_back(parameterIndex("IntensityScaling" + si)); + m_IntensityScalingIdx.emplace_back( + parameterIndex("IntensityScaling" + si)); } } /// Declare the Lambda parameter for susceptibility @@ -137,7 +138,7 @@ CrystalFieldMultiSpectrum::createEquivalentFunctions() const { std::vector<IFunction_sptr> funs; auto &composite = dynamic_cast<CompositeFunction &>(*m_target); for (size_t i = 0; i < composite.nFunctions(); ++i) { - funs.push_back(composite.getFunction(i)); + funs.emplace_back(composite.getFunction(i)); } return funs; } @@ -269,7 +270,7 @@ void CrystalFieldMultiSpectrum::buildTargetFunction() const { } else { m_physprops.clear(); for (auto elem : physprops) { - m_physprops.push_back(static_cast<int>(elem)); + m_physprops.emplace_back(static_cast<int>(elem)); } } // Create the single-spectrum functions. diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldSpectrum.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldSpectrum.cpp index 007e4e38a54b813c8c88af2307ae011f2b9c59ca..35ff744cd66263e943c799954f80059b52431ea4 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldSpectrum.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldSpectrum.cpp @@ -123,7 +123,7 @@ std::string CrystalFieldSpectrum::writeToString( if (isActive(i)) { ostr << ',' << paramOut.str(); } else if (isFixed(i)) { - ties.push_back(paramOut.str()); + ties.emplace_back(paramOut.str()); } } @@ -159,7 +159,7 @@ std::string CrystalFieldSpectrum::writeToString( // collect the non-default ties auto tiesString = writeTies(); if (!tiesString.empty()) { - ties.push_back(tiesString); + ties.emplace_back(tiesString); } // print the ties if (!ties.empty()) { diff --git a/Framework/CurveFitting/src/Functions/CubicSpline.cpp b/Framework/CurveFitting/src/Functions/CubicSpline.cpp index 9baa6628f0a6803b34fb6229ab67200bb9b26341..ec69de11f13977748665b2d7581ba934bfe2c031 100644 --- a/Framework/CurveFitting/src/Functions/CubicSpline.cpp +++ b/Framework/CurveFitting/src/Functions/CubicSpline.cpp @@ -106,7 +106,7 @@ void CubicSpline::setupInput(boost::scoped_array<double> &x, std::vector<point> pairs; pairs.reserve(n); for (int i = 0; i < n; ++i) { - pairs.push_back(std::make_pair(x[i], y[i])); + pairs.emplace_back(std::make_pair(x[i], y[i])); } std::sort(pairs.begin(), pairs.end(), diff --git a/Framework/CurveFitting/src/Functions/FunctionQDepends.cpp b/Framework/CurveFitting/src/Functions/FunctionQDepends.cpp index 630eea8102c627867f6287c7270625281b44d4a1..19b0231170eaf5cbe9e012d9e5788031496e9c6f 100644 --- a/Framework/CurveFitting/src/Functions/FunctionQDepends.cpp +++ b/Framework/CurveFitting/src/Functions/FunctionQDepends.cpp @@ -148,7 +148,7 @@ std::vector<double> FunctionQDepends::extractQValues( double usignTheta = 0.5 * spectrumInfo.twoTheta(wi); double q = Mantid::Kernel::UnitConversion::convertToElasticQ(usignTheta, efixed); - qs.push_back(q); + qs.emplace_back(q); } else { g_log.debug("Cannot populate Q values from workspace"); qs.clear(); diff --git a/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp index 6d5cd021a0e0ae63b1a35055ae09183df7fc61ba..1cbf850c619780656bffdfcfeeb9162c927b10fe 100644 --- a/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/GramCharlierComptonProfile.cpp @@ -140,7 +140,7 @@ void GramCharlierComptonProfile::setHermiteCoefficients( "NCSCountRate - Error reading int from hermite coefficient string: " + coeffs); } - m_hermite.push_back(value); + m_hermite.emplace_back(value); } declareGramCharlierParameters(); } @@ -177,13 +177,13 @@ GramCharlierComptonProfile::intensityParameterIndices() const { std::ostringstream os; os << HERMITE_PREFIX << 2 * i; // refactor to have method that produces the name - indices.push_back(this->parameterIndex(os.str())); + indices.emplace_back(this->parameterIndex(os.str())); } } // Include Kfse if it is not fixed const size_t kIndex = this->parameterIndex(KFSE_NAME); if (isActive(kIndex)) { - indices.push_back(kIndex); + indices.emplace_back(kIndex); } return indices; diff --git a/Framework/CurveFitting/src/Functions/InelasticDiffRotDiscreteCircle.cpp b/Framework/CurveFitting/src/Functions/InelasticDiffRotDiscreteCircle.cpp index 77b0cf3f57f7090a2ee92fb29871d2dd5b688579..bc757e2224fc251411444d23ff08d9b887a4b3ae 100644 --- a/Framework/CurveFitting/src/Functions/InelasticDiffRotDiscreteCircle.cpp +++ b/Framework/CurveFitting/src/Functions/InelasticDiffRotDiscreteCircle.cpp @@ -167,7 +167,7 @@ void InelasticDiffRotDiscreteCircle::setWorkspace( double q = Mantid::Kernel::UnitConversion::convertToElasticQ(usingTheta, efixed); - m_qValueCache.push_back(q); + m_qValueCache.emplace_back(q); } catch (std::runtime_error &) { m_qValueCache.clear(); g_log.information("Cannot populate Q values from workspace - could not " diff --git a/Framework/CurveFitting/src/Functions/InelasticDiffSphere.cpp b/Framework/CurveFitting/src/Functions/InelasticDiffSphere.cpp index f377b47189806392baa808c22ed6c7a46c338761..c2a0d7e2ee2a0ba72ae3a1cadbb682527f56d730 100644 --- a/Framework/CurveFitting/src/Functions/InelasticDiffSphere.cpp +++ b/Framework/CurveFitting/src/Functions/InelasticDiffSphere.cpp @@ -96,7 +96,7 @@ void InelasticDiffSphere::initXnlCoeff() { coeff.x = xvalues[i]; coeff.l = lvalues[i]; coeff.n = nvalues[i]; - m_xnl.push_back(coeff); + m_xnl.emplace_back(coeff); } } @@ -109,7 +109,7 @@ void InelasticDiffSphere::initAlphaCoeff() { ++it) { double x = it->x; // eigenvalue for a (n, l) pair auto l = static_cast<double>(it->l); - m_alpha.push_back((2.0 * l + 1) * 6.0 * x * x / (x * x - l * (l + 1))); + m_alpha.emplace_back((2.0 * l + 1) * 6.0 * x * x / (x * x - l * (l + 1))); } } @@ -136,7 +136,7 @@ void InelasticDiffSphere::initLinJlist() { abJ.intercept = J0 - abJ.slope * (x - m_divZone); // intercept of the linear interpolation - m_linearJlist.push_back( + m_linearJlist.emplace_back( abJ); // store the parameters of the linear interpolation for this it->x } } @@ -232,7 +232,7 @@ void InelasticDiffSphere::function1D(double *out, const double *xValues, size_t ncoeff = m_xnl.size(); for (size_t n = 0; n < ncoeff; n++) { auto x = m_xnl[n].x; // eigenvalue - HWHM.push_back(m_hbar * x * x * D / (R * R)); + HWHM.emplace_back(m_hbar * x * x * D / (R * R)); } std::vector<double> YJ; @@ -283,7 +283,7 @@ void InelasticDiffSphere::setWorkspace( double q = Mantid::Kernel::UnitConversion::convertToElasticQ(usingTheta, efixed); - m_qValueCache.push_back(q); + m_qValueCache.emplace_back(q); } catch (std::runtime_error &) { m_qValueCache.clear(); g_log.information("Cannot populate Q values from workspace - could not " diff --git a/Framework/CurveFitting/src/Functions/MultivariateGaussianComptonProfile.cpp b/Framework/CurveFitting/src/Functions/MultivariateGaussianComptonProfile.cpp index c8a6845358fdb661bf3a632683b2e1c89e1137c9..eac2b6ea3360d24a5ec229be4ee97bfba0d69d88 100644 --- a/Framework/CurveFitting/src/Functions/MultivariateGaussianComptonProfile.cpp +++ b/Framework/CurveFitting/src/Functions/MultivariateGaussianComptonProfile.cpp @@ -252,7 +252,7 @@ void MultivariateGaussianComptonProfile::buildS2Cache( s2 = 1.0 / s2; - s2Cache.push_back(s2); + s2Cache.emplace_back(s2); } } } diff --git a/Framework/CurveFitting/src/Functions/PawleyFunction.cpp b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp index 7c2d8da2baa32b256afa521b1e0478357da9d334..918d3c4cf3204180778331c4eeddd122433fbba2 100644 --- a/Framework/CurveFitting/src/Functions/PawleyFunction.cpp +++ b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp @@ -510,7 +510,7 @@ void PawleyFunction::setPeaks(const std::vector<Kernel::V3D> &hkls, double fwhm, /// Adds a peak with the supplied FWHM and height. void PawleyFunction::addPeak(const Kernel::V3D &hkl, double fwhm, double height) { - m_hkls.push_back(hkl); + m_hkls.emplace_back(hkl); IPeakFunction_sptr peak = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction( diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index b42e0b1bf155081aceb59d0bfed38eb8c8adc01f..0271d5fc754ae4f361bd944d6fbb33f6cc4a3da4 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -319,7 +319,7 @@ void ProcessBackground::deleteRegion() { std::vector<size_t> incIndexes; for (size_t i = 0; i < dataY.size(); i++) { if (dataX[i] < m_lowerBound || dataX[i] > m_upperBound) { - incIndexes.push_back(i); + incIndexes.emplace_back(i); } } size_t sizex = incIndexes.size(); @@ -373,15 +373,15 @@ void ProcessBackground::addRegion() { for (size_t i = 0; i < vecY.size(); ++i) { double xtmp = vecX[i]; if (xtmp < m_lowerBound || xtmp > m_upperBound) { - vx.push_back(vecX[i]); - vy.push_back(vecY[i]); - ve.push_back(vecE[i]); + vx.emplace_back(vecX[i]); + vy.emplace_back(vecY[i]); + ve.emplace_back(vecE[i]); } } // Histogram if (vecX.size() > vecY.size()) - vx.push_back(vecX.back()); + vx.emplace_back(vecX.back()); // Get access to reference workspace DataObjects::Workspace2D_const_sptr refWS = getProperty("ReferenceWorkspace"); @@ -514,7 +514,7 @@ void ProcessBackground::selectFromGivenXValues() { << "\n"; // Add index to list - realIndexes.push_back(index); + realIndexes.emplace_back(index); } // ENDFOR (i) @@ -723,7 +723,7 @@ ProcessBackground::filterForBackground(BackgroundFunction_sptr bkgdfunction) { for (size_t i = 0; i < domain.size(); ++i) { double purey = visualws->y(1)[i]; if (purey < posnoisetolerance && purey > -negnoisetolerance) { - selectedIndexes.push_back(i); + selectedIndexes.emplace_back(i); } } size_t wsSize = selectedIndexes.size(); diff --git a/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp index e2a246d4a4000a6565a18a981b2c24b7399eafdc..468f1fbe306d17c4c602a5af1c11f110746fc129 100644 --- a/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp +++ b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp @@ -155,9 +155,9 @@ std::vector<double> SimpleChebfun::roughRoots(double level) const { for (size_t i = 1; i < m_P.size(); ++i) { auto y = m_P[i] - level; if (y == 0.0) { - rs.push_back(x[i]); + rs.emplace_back(x[i]); } else if (y1 * y < 0.0) { - rs.push_back((-x[i - 1] * y + x[i] * y1) / (y1 - y)); + rs.emplace_back((-x[i - 1] * y + x[i] * y1) / (y1 - y)); } y1 = y; } diff --git a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp index 03954d96a6c7fc59cc70a6f3604b326298fd7998..8ef0e9d2d9f5ebce6929b750b44ad5a9e334936a 100644 --- a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp +++ b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp @@ -248,8 +248,8 @@ size_t TabulatedFunction::nAttributes() const { /// Returns a list of attribute names std::vector<std::string> TabulatedFunction::getAttributeNames() const { std::vector<std::string> attNames = IFunction::getAttributeNames(); - attNames.push_back("X"); - attNames.push_back("Y"); + attNames.emplace_back("X"); + attNames.emplace_back("Y"); return attNames; } diff --git a/Framework/CurveFitting/src/Functions/UserFunction1D.cpp b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp index 3b258b0b5d6ebd294242ffbd5d2cf524f88b3951..f4f3737b167e5d24d12753b1aaa8baeec60631c9 100644 --- a/Framework/CurveFitting/src/Functions/UserFunction1D.cpp +++ b/Framework/CurveFitting/src/Functions/UserFunction1D.cpp @@ -35,7 +35,7 @@ double *UserFunction1D::AddVariable(const char *varName, void *palg) { if (std::string(varName) != "x") { alg.declareProperty(varName, 0.0); - alg.m_parameterNames.push_back(varName); + alg.m_parameterNames.emplace_back(varName); } else { alg.m_x_set = true; alg.m_x = 0.; diff --git a/Framework/CurveFitting/src/GSLFunctions.cpp b/Framework/CurveFitting/src/GSLFunctions.cpp index b6f479c8424d7f47aca0cf658adfca8c273bb577..0c574a027a528c5ef4a2be50cd2ac34559112bc3 100644 --- a/Framework/CurveFitting/src/GSLFunctions.cpp +++ b/Framework/CurveFitting/src/GSLFunctions.cpp @@ -201,10 +201,10 @@ GSL_FitData::GSL_FitData( int j = 0; for (size_t i = 0; i < function->nParams(); ++i) { if (function->isActive(i)) { - J.m_index.push_back(j); + J.m_index.emplace_back(j); j++; } else - J.m_index.push_back(-1); + J.m_index.emplace_back(-1); } } diff --git a/Framework/CurveFitting/src/GeneralDomainCreator.cpp b/Framework/CurveFitting/src/GeneralDomainCreator.cpp index 20afb84adef17f2da28c88183d8c1ea59272ad9b..09059991a19e54dc5ca844cc6e22c7e723bc1f52 100644 --- a/Framework/CurveFitting/src/GeneralDomainCreator.cpp +++ b/Framework/CurveFitting/src/GeneralDomainCreator.cpp @@ -35,21 +35,21 @@ GeneralDomainCreator::GeneralDomainCreator( auto nDomainColumns = fun.getNumberDomainColumns(); if (nDomainColumns > 0) { - m_domainColumnNames.push_back("ArgumentColumn"); + m_domainColumnNames.emplace_back("ArgumentColumn"); for (size_t i = 1; i < nDomainColumns; ++i) { - m_domainColumnNames.push_back(m_domainColumnNames.front() + "_" + - std::to_string(i)); + m_domainColumnNames.emplace_back(m_domainColumnNames.front() + "_" + + std::to_string(i)); } } auto nDataColumns = fun.getNumberValuesPerArgument(); if (nDataColumns > 0) { - m_dataColumnNames.push_back("DataColumn"); - m_weightsColumnNames.push_back("WeightsColumn"); + m_dataColumnNames.emplace_back("DataColumn"); + m_weightsColumnNames.emplace_back("WeightsColumn"); for (size_t i = 1; i < nDataColumns; ++i) { auto si = "_" + std::to_string(i); - m_dataColumnNames.push_back(m_dataColumnNames.front() + si); - m_weightsColumnNames.push_back(m_weightsColumnNames.front() + si); + m_dataColumnNames.emplace_back(m_dataColumnNames.front() + si); + m_weightsColumnNames.emplace_back(m_weightsColumnNames.front() + si); } } } @@ -204,11 +204,11 @@ Workspace_sptr GeneralDomainCreator::createOutputWorkspace( std::vector<std::string> columnsToClone; for (auto &propName : m_domainColumnNames) { auto columnName = m_manager->getPropertyValue(propName); - columnsToClone.push_back(columnName); + columnsToClone.emplace_back(columnName); } for (auto &propName : m_dataColumnNames) { auto columnName = m_manager->getPropertyValue(propName); - columnsToClone.push_back(columnName); + columnsToClone.emplace_back(columnName); } outputWorkspace = inputWorkspace->cloneColumns(columnsToClone); if (rowCount != outputWorkspace->rowCount()) { diff --git a/Framework/CurveFitting/src/IFittingAlgorithm.cpp b/Framework/CurveFitting/src/IFittingAlgorithm.cpp index de2426777a78cca666575f6e25ac79814f97fc57..79e6d5bc2c5a83ca6db91c6487e79f9fae8c5308 100644 --- a/Framework/CurveFitting/src/IFittingAlgorithm.cpp +++ b/Framework/CurveFitting/src/IFittingAlgorithm.cpp @@ -296,7 +296,7 @@ std::vector<std::string> IFittingAlgorithm::getCostFunctionNames() const { for (auto &name : names) { if (boost::dynamic_pointer_cast<CostFunctions::CostFuncFitting>( factory.create(name))) { - out.push_back(name); + out.emplace_back(name); } } return out; diff --git a/Framework/CurveFitting/src/LatticeDomainCreator.cpp b/Framework/CurveFitting/src/LatticeDomainCreator.cpp index e7e81372d52e893b7a98be2d76f990fb8cb3cac6..18f85592d470bf83ab0bcd679524235df5ca4a7f 100644 --- a/Framework/CurveFitting/src/LatticeDomainCreator.cpp +++ b/Framework/CurveFitting/src/LatticeDomainCreator.cpp @@ -195,8 +195,8 @@ void LatticeDomainCreator::createDomainFromPeaksWorkspace( V3D hkl = currentPeak->getHKL(); if (hkl != V3D(0, 0, 0)) { - hkls.push_back(hkl); - dSpacings.push_back(currentPeak->getDSpacing()); + hkls.emplace_back(hkl); + dSpacings.emplace_back(currentPeak->getDSpacing()); } } @@ -258,10 +258,10 @@ void LatticeDomainCreator::createDomainFromPeakTable( V3D hkl = extractor(hklColumn, i); if (hkl != V3D(0, 0, 0)) { - hkls.push_back(hkl); + hkls.emplace_back(hkl); double d = (*dColumn)[i]; - dSpacings.push_back(d); + dSpacings.emplace_back(d); } } catch (const std::bad_alloc &) { // do nothing. diff --git a/Framework/CurveFitting/src/MSVesuvioHelpers.cpp b/Framework/CurveFitting/src/MSVesuvioHelpers.cpp index 52d5a2f70a3ced6b7ccd2324092733ae68bbae30..c8d3a7e22b526b8587692730f19a5aa212083e5b 100644 --- a/Framework/CurveFitting/src/MSVesuvioHelpers.cpp +++ b/Framework/CurveFitting/src/MSVesuvioHelpers.cpp @@ -398,7 +398,7 @@ SimulationAggregator::SimulationAggregator(const size_t nruns) { */ Simulation &SimulationAggregator::newSimulation(const size_t order, const size_t ntimes) { - results.push_back(Simulation(order, ntimes)); + results.emplace_back(Simulation(order, ntimes)); return results.back(); } diff --git a/Framework/CurveFitting/src/SeqDomain.cpp b/Framework/CurveFitting/src/SeqDomain.cpp index b39ac145a866ddfa4401c8f9e490eb886a26ae9c..afa0be20ae25f597301f839858c9addd427b8244 100644 --- a/Framework/CurveFitting/src/SeqDomain.cpp +++ b/Framework/CurveFitting/src/SeqDomain.cpp @@ -51,9 +51,9 @@ void SeqDomain::getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, * @param creator :: A shared pointer to a new creator. */ void SeqDomain::addCreator(API::IDomainCreator_sptr creator) { - m_creators.push_back(creator); - m_domain.push_back(API::FunctionDomain_sptr()); - m_values.push_back(API::FunctionValues_sptr()); + m_creators.emplace_back(creator); + m_domain.emplace_back(API::FunctionDomain_sptr()); + m_values.emplace_back(API::FunctionValues_sptr()); } /** diff --git a/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp b/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp index a028b84de1a2bffc352d7f3a79b8e244e05633dd..4f0df135f975558b30b982001f7dd05414f394c1 100644 --- a/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp +++ b/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp @@ -76,8 +76,8 @@ void joinOverlappingRanges(std::vector<double> &exclude) { std::vector<RangePoint> points; points.reserve(exclude.size()); for (auto point = exclude.begin(); point != exclude.end(); point += 2) { - points.push_back(RangePoint{RangePoint::Opening, *point}); - points.push_back(RangePoint{RangePoint::Closing, *(point + 1)}); + points.emplace_back(RangePoint{RangePoint::Opening, *point}); + points.emplace_back(RangePoint{RangePoint::Closing, *(point + 1)}); } // Sort the points according to the operator defined in RangePoint. std::sort(points.begin(), points.end()); @@ -91,14 +91,14 @@ void joinOverlappingRanges(std::vector<double> &exclude) { if (point.kind == RangePoint::Opening) { if (level == 0) { // First openning bracket starts a new exclusion range. - exclude.push_back(point.value); + exclude.emplace_back(point.value); } // Each openning bracket increases the level ++level; } else { if (level == 1) { // The bracket that makes level 0 is an end of a range. - exclude.push_back(point.value); + exclude.emplace_back(point.value); } // Each closing bracket decreases the level --level; @@ -216,7 +216,7 @@ void TableWorkspaceDomainCreator::createDomain( std::vector<double> xData; xData.reserve(m_tableWorkspace->rowCount()); for (size_t i = 0; i < m_tableWorkspace->rowCount(); ++i) { - xData.push_back(X->toDouble(i)); + xData.emplace_back(X->toDouble(i)); } // find the fitting interval: from -> to @@ -573,9 +573,9 @@ TableWorkspaceDomainCreator::createEmptyResultWS(const size_t nhistograms, eData.reserve(m_tableWorkspace->rowCount()); for (size_t i = 0; i < m_tableWorkspace->rowCount(); ++i) { - xData.push_back(inputX->toDouble(i)); - yData.push_back(inputY->toDouble(i)); - eData.push_back(inputE->toDouble(i)); + xData.emplace_back(inputX->toDouble(i)); + yData.emplace_back(inputY->toDouble(i)); + eData.emplace_back(inputE->toDouble(i)); } // X values for all @@ -601,7 +601,7 @@ size_t TableWorkspaceDomainCreator::getDomainSize() const { std::vector<double> xData; xData.reserve(m_tableWorkspace->rowCount()); for (size_t i = 0; i < m_tableWorkspace->rowCount(); ++i) { - xData.push_back(X->toDouble(i)); + xData.emplace_back(X->toDouble(i)); } size_t startIndex, endIndex; std::tie(startIndex, endIndex) = getXInterval(xData); @@ -791,10 +791,10 @@ void TableWorkspaceDomainCreator::setAndValidateWorkspace( } setXYEColumnNames(tableWorkspace); std::vector<std::string> columnNames; - columnNames.push_back(m_xColName); - columnNames.push_back(m_yColName); + columnNames.emplace_back(m_xColName); + columnNames.emplace_back(m_yColName); if (m_errColName != "") - columnNames.push_back(m_errColName); + columnNames.emplace_back(m_errColName); // table workspace is cloned so it can be changed within the domain m_tableWorkspace = tableWorkspace->cloneColumns(columnNames); diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h index 63bef33247159920147c31e856f86e6691e11413..c8da0939aafbe874f4f4610daa86589c67c41d90 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h @@ -644,19 +644,19 @@ public: double h110 = 660.0 / 0.0064; double h111 = 1370.0 / 0.008; std::vector<double> peakheights; - peakheights.push_back(h111); - peakheights.push_back(h110); + peakheights.emplace_back(h111); + peakheights.emplace_back(h110); std::vector<std::vector<int>> hkls; std::vector<int> p111; - p111.push_back(1); - p111.push_back(1); - p111.push_back(1); - hkls.push_back(p111); + p111.emplace_back(1); + p111.emplace_back(1); + p111.emplace_back(1); + hkls.emplace_back(p111); std::vector<int> p110; - p110.push_back(1); - p110.push_back(1); - p110.push_back(0); - hkls.push_back(p110); + p110.emplace_back(1); + p110.emplace_back(1); + p110.emplace_back(0); + hkls.emplace_back(p110); hklws = createInputHKLWorkspace(hkls, peakheights); AnalysisDataService::Instance().addOrReplace("Data", dataws); @@ -752,12 +752,12 @@ public: TableWorkspace_sptr hklws; double h220 = 660.0 / 0.0064; std::vector<double> peakheights; - peakheights.push_back(h220); + peakheights.emplace_back(h220); std::vector<std::vector<int>> hkls; std::vector<int> p220(3, 2); p220[2] = 0; - hkls.push_back(p220); + hkls.emplace_back(p220); hklws = createInputHKLWorkspace(hkls, peakheights); @@ -855,19 +855,19 @@ public: double h110 = 660.0 / 0.0064; double h111 = 1370.0 / 0.008; std::vector<double> peakheights; - peakheights.push_back(h111); - peakheights.push_back(h110); + peakheights.emplace_back(h111); + peakheights.emplace_back(h110); std::vector<std::vector<int>> hkls; std::vector<int> p111; - p111.push_back(1); - p111.push_back(1); - p111.push_back(1); - hkls.push_back(p111); + p111.emplace_back(1); + p111.emplace_back(1); + p111.emplace_back(1); + hkls.emplace_back(p111); std::vector<int> p110; - p110.push_back(1); - p110.push_back(1); - p110.push_back(0); - hkls.push_back(p110); + p110.emplace_back(1); + p110.emplace_back(1); + p110.emplace_back(0); + hkls.emplace_back(p110); hklws = createInputHKLWorkspace(hkls, peakheights); AnalysisDataService::Instance().addOrReplace("Data", dataws); @@ -956,19 +956,19 @@ public: double h110 = 1.0; double h111 = 1.0; std::vector<double> peakheights; - peakheights.push_back(h111); - peakheights.push_back(h110); + peakheights.emplace_back(h111); + peakheights.emplace_back(h110); std::vector<std::vector<int>> hkls; std::vector<int> p111; - p111.push_back(1); - p111.push_back(1); - p111.push_back(1); - hkls.push_back(p111); + p111.emplace_back(1); + p111.emplace_back(1); + p111.emplace_back(1); + hkls.emplace_back(p111); std::vector<int> p110; - p110.push_back(1); - p110.push_back(1); - p110.push_back(0); - hkls.push_back(p110); + p110.emplace_back(1); + p110.emplace_back(1); + p110.emplace_back(0); + hkls.emplace_back(p110); hklws = createInputHKLWorkspace(hkls, peakheights); AnalysisDataService::Instance().addOrReplace("Data", dataws); @@ -1066,22 +1066,22 @@ public: std::vector<std::vector<int>> hkls; // (222) vector<int> r222(3, 2); - hkls.push_back(r222); + hkls.emplace_back(r222); // (311) vector<int> r311(3, 1); r311[0] = 3; - hkls.push_back(r311); + hkls.emplace_back(r311); // (220) vector<int> r220(3, 2); r220[2] = 0; - hkls.push_back(r220); + hkls.emplace_back(r220); // (200) vector<int> r200(3, 0); r200[0] = 2; - hkls.push_back(r200); + hkls.emplace_back(r200); // (111) vector<int> r111(3, 1); - hkls.push_back(r111); + hkls.emplace_back(r111); size_t numpeaks = hkls.size(); std::cout << "[TESTx349] Nmber of (file imported) peaks = " << hkls.size() @@ -1107,8 +1107,8 @@ public: // 2. Other properties std::vector<double> fitregion; - fitregion.push_back(56198.0); - fitregion.push_back(151239.0); + fitregion.emplace_back(56198.0); + fitregion.emplace_back(151239.0); // 3. Genearte LeBailFit algorithm and set it up LeBailFit lbfit; @@ -1216,8 +1216,8 @@ public: p211[0] = 2; p211[1] = 1; p211[2] = 1; - peakhkls.push_back(p211); - peakheights.push_back(1.0); + peakhkls.emplace_back(p211); + peakheights.emplace_back(1.0); DataObjects::TableWorkspace_sptr hklws; hklws = createInputHKLWorkspace(peakhkls, peakheights); diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h index 6e187ae7b09645a948a2a5c70ea774c2379f7bc4..befe206e35ed281eabd91b069d66bc62c1a1a116 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h @@ -83,7 +83,7 @@ public: // FullprofPolynomial parnames.emplace_back("Bkpos"); - parvalues.push_back(7000.); + parvalues.emplace_back(7000.); LeBailFunction lebailfunction2("NeutronBk2BkExpConvPVoigt"); TS_ASSERT_THROWS_ANYTHING(lebailfunction2.addBackgroundFunction( @@ -152,15 +152,15 @@ public: // Add peaks vector<vector<int>> vechkl; vector<int> p111; - p111.push_back(1); - p111.push_back(1); - p111.push_back(1); - vechkl.push_back(p111); + p111.emplace_back(1); + p111.emplace_back(1); + p111.emplace_back(1); + vechkl.emplace_back(p111); vector<int> p110; - p110.push_back(1); - p110.push_back(1); - p110.push_back(0); - vechkl.push_back(p110); + p110.emplace_back(1); + p110.emplace_back(1); + p110.emplace_back(0); + vechkl.emplace_back(p110); lebailfunction.addPeaks(vechkl); TS_ASSERT(lebailfunction.isParameterValid()); @@ -289,8 +289,8 @@ public: int xp852[] = {8, 5, 2}; std::vector<int> p852(xp852, xp852 + sizeof(xp852) / sizeof(int)); std::vector<std::vector<int>> hkls; - hkls.push_back(p932); - hkls.push_back(p852); + hkls.emplace_back(p932); + hkls.emplace_back(p852); lebailfunction.addPeaks(hkls); // Prepare data @@ -353,7 +353,7 @@ public: vector<int> p220(3, 0); p220[0] = 2; p220[1] = 2; - vechkl.push_back(p220); + vechkl.emplace_back(p220); lebailfunction.addPeaks(vechkl); @@ -444,12 +444,12 @@ public: std::string dataline(line); ss.str(line); ss >> x >> y; - vecX.push_back(x); - vecY.push_back(y); + vecX.emplace_back(x); + vecY.emplace_back(y); double e = 1.0; if (y > 1.0E-5) e = std::sqrt(y); - vecE.push_back(e); + vecE.emplace_back(e); } } } @@ -519,7 +519,7 @@ public: double e = 1.0; if (y > 1.0) e = sqrt(y); - vecE.push_back(e); + vecE.emplace_back(e); } return; @@ -532,75 +532,75 @@ public: std::vector<double> &vecY, std::vector<double> &vecE) { // These data of reflection (932) and (852) - vecX.push_back(12646.470); - vecY.push_back(0.56916749); - vecE.push_back(1000.0000); - vecX.push_back(12658.333); - vecY.push_back(0.35570398); - vecE.push_back(1000.0000); - vecX.push_back(12670.196); - vecY.push_back(0.85166878); - vecE.push_back(1000.0000); - vecX.push_back(12682.061); - vecY.push_back(4.6110063); - vecE.push_back(1000.0000); - vecX.push_back(12693.924); - vecY.push_back(24.960907); - vecE.push_back(1000.0000); - vecX.push_back(12705.787); - vecY.push_back(135.08231); - vecE.push_back(1000.0000); - vecX.push_back(12717.650); - vecY.push_back(613.15887); - vecE.push_back(1000.0000); - vecX.push_back(12729.514); - vecY.push_back(587.66174); - vecE.push_back(1000.0000); - vecX.push_back(12741.378); - vecY.push_back(213.99724); - vecE.push_back(1000.0000); - vecX.push_back(12753.241); - vecY.push_back(85.320320); - vecE.push_back(1000.0000); - vecX.push_back(12765.104); - vecY.push_back(86.317253); - vecE.push_back(1000.0000); - vecX.push_back(12776.968); - vecY.push_back(334.30905); - vecE.push_back(1000.0000); - vecX.push_back(12788.831); - vecY.push_back(1171.0187); - vecE.push_back(1000.0000); - vecX.push_back(12800.695); - vecY.push_back(732.47943); - vecE.push_back(1000.0000); - vecX.push_back(12812.559); - vecY.push_back(258.37717); - vecE.push_back(1000.0000); - vecX.push_back(12824.422); - vecY.push_back(90.549515); - vecE.push_back(1000.0000); - vecX.push_back(12836.285); - vecY.push_back(31.733501); - vecE.push_back(1000.0000); - vecX.push_back(12848.148); - vecY.push_back(11.121155); - vecE.push_back(1000.0000); - vecX.push_back(12860.013); - vecY.push_back(3.9048645); - vecE.push_back(1000.0000); - vecX.push_back(12871.876); - vecY.push_back(4.15836312E-02); - vecE.push_back(1000.0000); - vecX.push_back(12883.739); - vecY.push_back(0.22341134); - vecE.push_back(1000.0000); - vecX.push_back(12895.603); - vecY.push_back(1.2002950); - vecE.push_back(1000.0000); - vecX.push_back(12907.466); - vecY.push_back(6.4486742); - vecE.push_back(1000.0000); + vecX.emplace_back(12646.470); + vecY.emplace_back(0.56916749); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12658.333); + vecY.emplace_back(0.35570398); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12670.196); + vecY.emplace_back(0.85166878); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12682.061); + vecY.emplace_back(4.6110063); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12693.924); + vecY.emplace_back(24.960907); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12705.787); + vecY.emplace_back(135.08231); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12717.650); + vecY.emplace_back(613.15887); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12729.514); + vecY.emplace_back(587.66174); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12741.378); + vecY.emplace_back(213.99724); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12753.241); + vecY.emplace_back(85.320320); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12765.104); + vecY.emplace_back(86.317253); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12776.968); + vecY.emplace_back(334.30905); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12788.831); + vecY.emplace_back(1171.0187); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12800.695); + vecY.emplace_back(732.47943); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12812.559); + vecY.emplace_back(258.37717); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12824.422); + vecY.emplace_back(90.549515); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12836.285); + vecY.emplace_back(31.733501); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12848.148); + vecY.emplace_back(11.121155); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12860.013); + vecY.emplace_back(3.9048645); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12871.876); + vecY.emplace_back(4.15836312E-02); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12883.739); + vecY.emplace_back(0.22341134); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12895.603); + vecY.emplace_back(1.2002950); + vecE.emplace_back(1000.0000); + vecX.emplace_back(12907.466); + vecY.emplace_back(6.4486742); + vecE.emplace_back(1000.0000); return; } @@ -608,84 +608,84 @@ public: void generateVulcanPeak220(std::vector<double> &vecx, std::vector<double> &vecy, std::vector<double> &vece) { - vecx.push_back(31019.30000); - vecy.push_back(0.02624178); - vece.push_back(0.00092672); - vecx.push_back(31050.40000); - vecy.push_back(0.02646138); - vece.push_back(0.00093232); - vecx.push_back(31081.40000); - vecy.push_back(0.02809566); - vece.push_back(0.00096305); - vecx.push_back(31112.50000); - vecy.push_back(0.02896440); - vece.push_back(0.00097980); - vecx.push_back(31143.60000); - vecy.push_back(0.02861105); - vece.push_back(0.00097545); - vecx.push_back(31174.80000); - vecy.push_back(0.03432836); - vece.push_back(0.00107344); - vecx.push_back(31205.90000); - vecy.push_back(0.03941826); - vece.push_back(0.00115486); - vecx.push_back(31237.10000); - vecy.push_back(0.05355697); - vece.push_back(0.00135755); - vecx.push_back(31268.40000); - vecy.push_back(0.09889440); - vece.push_back(0.00188719); - vecx.push_back(31299.60000); - vecy.push_back(0.20556772); - vece.push_back(0.00285447); - vecx.push_back(31330.90000); - vecy.push_back(0.43901506); - vece.push_back(0.00456425); - vecx.push_back(31362.30000); - vecy.push_back(0.81941730); - vece.push_back(0.00702201); - vecx.push_back(31393.60000); - vecy.push_back(1.33883897); - vece.push_back(0.01019324); - vecx.push_back(31425.00000); - vecy.push_back(1.74451085); - vece.push_back(0.01262540); - vecx.push_back(31456.50000); - vecy.push_back(1.83429503); - vece.push_back(0.01317582); - vecx.push_back(31487.90000); - vecy.push_back(1.53455479); - vece.push_back(0.01141480); - vecx.push_back(31519.40000); - vecy.push_back(1.03117425); - vece.push_back(0.00839135); - vecx.push_back(31550.90000); - vecy.push_back(0.52893114); - vece.push_back(0.00522327); - vecx.push_back(31582.50000); - vecy.push_back(0.23198354); - vece.push_back(0.00311024); - vecx.push_back(31614.10000); - vecy.push_back(0.10961397); - vece.push_back(0.00203244); - vecx.push_back(31645.70000); - vecy.push_back(0.06396058); - vece.push_back(0.00152266); - vecx.push_back(31677.30000); - vecy.push_back(0.04880334); - vece.push_back(0.00132322); - vecx.push_back(31709.00000); - vecy.push_back(0.03836045); - vece.push_back(0.00116918); - vecx.push_back(31740.70000); - vecy.push_back(0.03639256); - vece.push_back(0.00113951); - vecx.push_back(31772.50000); - vecy.push_back(0.03248324); - vece.push_back(0.00107658); - vecx.push_back(31804.20000); - vecy.push_back(0.03096179); - vece.push_back(0.00105191); + vecx.emplace_back(31019.30000); + vecy.emplace_back(0.02624178); + vece.emplace_back(0.00092672); + vecx.emplace_back(31050.40000); + vecy.emplace_back(0.02646138); + vece.emplace_back(0.00093232); + vecx.emplace_back(31081.40000); + vecy.emplace_back(0.02809566); + vece.emplace_back(0.00096305); + vecx.emplace_back(31112.50000); + vecy.emplace_back(0.02896440); + vece.emplace_back(0.00097980); + vecx.emplace_back(31143.60000); + vecy.emplace_back(0.02861105); + vece.emplace_back(0.00097545); + vecx.emplace_back(31174.80000); + vecy.emplace_back(0.03432836); + vece.emplace_back(0.00107344); + vecx.emplace_back(31205.90000); + vecy.emplace_back(0.03941826); + vece.emplace_back(0.00115486); + vecx.emplace_back(31237.10000); + vecy.emplace_back(0.05355697); + vece.emplace_back(0.00135755); + vecx.emplace_back(31268.40000); + vecy.emplace_back(0.09889440); + vece.emplace_back(0.00188719); + vecx.emplace_back(31299.60000); + vecy.emplace_back(0.20556772); + vece.emplace_back(0.00285447); + vecx.emplace_back(31330.90000); + vecy.emplace_back(0.43901506); + vece.emplace_back(0.00456425); + vecx.emplace_back(31362.30000); + vecy.emplace_back(0.81941730); + vece.emplace_back(0.00702201); + vecx.emplace_back(31393.60000); + vecy.emplace_back(1.33883897); + vece.emplace_back(0.01019324); + vecx.emplace_back(31425.00000); + vecy.emplace_back(1.74451085); + vece.emplace_back(0.01262540); + vecx.emplace_back(31456.50000); + vecy.emplace_back(1.83429503); + vece.emplace_back(0.01317582); + vecx.emplace_back(31487.90000); + vecy.emplace_back(1.53455479); + vece.emplace_back(0.01141480); + vecx.emplace_back(31519.40000); + vecy.emplace_back(1.03117425); + vece.emplace_back(0.00839135); + vecx.emplace_back(31550.90000); + vecy.emplace_back(0.52893114); + vece.emplace_back(0.00522327); + vecx.emplace_back(31582.50000); + vecy.emplace_back(0.23198354); + vece.emplace_back(0.00311024); + vecx.emplace_back(31614.10000); + vecy.emplace_back(0.10961397); + vece.emplace_back(0.00203244); + vecx.emplace_back(31645.70000); + vecy.emplace_back(0.06396058); + vece.emplace_back(0.00152266); + vecx.emplace_back(31677.30000); + vecy.emplace_back(0.04880334); + vece.emplace_back(0.00132322); + vecx.emplace_back(31709.00000); + vecy.emplace_back(0.03836045); + vece.emplace_back(0.00116918); + vecx.emplace_back(31740.70000); + vecy.emplace_back(0.03639256); + vece.emplace_back(0.00113951); + vecx.emplace_back(31772.50000); + vecy.emplace_back(0.03248324); + vece.emplace_back(0.00107658); + vecx.emplace_back(31804.20000); + vecy.emplace_back(0.03096179); + vece.emplace_back(0.00105191); for (double &i : vecy) i -= 0.02295189; diff --git a/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h index 96824bb4ba2082ecfb36d65024091e8640187b1e..2821737d3f368430a1221aa5afd85732d5d1ed52 100644 --- a/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h @@ -232,7 +232,7 @@ private: << ",Sigma=" << fwhmAbs / (2.0 * sqrt(2.0 * M_LN2)) << ",Height=" << row.String(3); - functionStrings.push_back(fn.str()); + functionStrings.emplace_back(fn.str()); } return boost::join(functionStrings, ";"); diff --git a/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h index 39daa1e51c0c9d315a78f2e9e87932234f028cb8..f5fc113ef468d0f7a6166598d82914130dd59747 100644 --- a/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h +++ b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h @@ -672,9 +672,9 @@ private: testWS->setBinEdges(1, xdata); std::vector<double> edges; - edges.push_back(0.0); - edges.push_back(1.0); - edges.push_back(5.0); + edges.emplace_back(0.0); + edges.emplace_back(1.0); + edges.emplace_back(5.0); auto axis = std::make_unique<BinEdgeAxis>(edges); testWS->replaceAxis(1, std::move(axis)); diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index b86227e9d549ebce04c30ec077765eb4df209ea8..c27368a1fc0e136ce75df752fdb5b41c466a7d1b 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -353,22 +353,22 @@ public: std::stringstream ss; ss.str(line); ss >> h >> k >> l; - hkl.push_back(h); - hkl.push_back(k); - hkl.push_back(l); - hkls.push_back(hkl); + hkl.emplace_back(h); + hkl.emplace_back(k); + hkl.emplace_back(l); + hkls.emplace_back(hkl); double d_h, tof_h, height, alpha, beta, sigma2, chi2; std::vector<double> params; ss >> d_h >> tof_h >> height >> alpha >> beta >> sigma2 >> chi2; - params.push_back(d_h); - params.push_back(tof_h); - params.push_back(height); - params.push_back(alpha); - params.push_back(beta); - params.push_back(sigma2); - params.push_back(chi2); - peakparameters.push_back(params); + params.emplace_back(d_h); + params.emplace_back(tof_h); + params.emplace_back(height); + params.emplace_back(alpha); + params.emplace_back(beta); + params.emplace_back(sigma2); + params.emplace_back(chi2); + peakparameters.emplace_back(params); } } @@ -473,9 +473,9 @@ public: try { ss >> parmin >> parmax >> parstepsize; vector<double> mcpars; - mcpars.push_back(parmin); - mcpars.push_back(parmax); - mcpars.push_back(parstepsize); + mcpars.emplace_back(parmin); + mcpars.emplace_back(parmax); + mcpars.emplace_back(parstepsize); parametermcs.emplace(parname, mcpars); } catch (const std::runtime_error &) { ; diff --git a/Framework/CurveFitting/test/Functions/BivariateNormalTest.h b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h index 2720bfce15dc1d4149b28a8ed88cafa59afc0efd..3b1041577dc6a7d149a825faa61b0613e0102a1d 100644 --- a/Framework/CurveFitting/test/Functions/BivariateNormalTest.h +++ b/Framework/CurveFitting/test/Functions/BivariateNormalTest.h @@ -119,12 +119,12 @@ public: sgn1 = -sgn1 + 1; sgn2 = sgn1; } - xvals.push_back(x); - yvals.push_back(y); + xvals.emplace_back(x); + yvals.emplace_back(y); const double val = NormVal(background, intensity, Mcol, Mrow, Vx, Vy, Vxy, y, x); - data.push_back(val); + data.emplace_back(val); } double xx[nCells]; diff --git a/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h index b283ae8e754005f46552d4e624f7e8a667617c9c..85013ef4821283714a10c22d63fc52ae6b1db35c 100644 --- a/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/NeutronBk2BkExpConvPVoigtTest.h @@ -255,7 +255,7 @@ public: vector<double> vecX; double tof = tofh1 - 10 * fwhm; while (tof < tofh1 + 10 * fwhm) { - vecX.push_back(tof); + vecX.emplace_back(tof); tof += fwhm * 0.1; } vector<double> vecY(vecX.size(), 0.0); diff --git a/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h index 3188f5d8af000d6bcd0c45a51ad36161f4bc9342..4c91ea9b0981824e21fe01df0dba042f1e23a838 100644 --- a/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h @@ -336,9 +336,9 @@ public: double e = 1.0; if (y > 1.0E-5) e = std::sqrt(y); - vx.push_back(x); - vy.push_back(y); - ve.push_back(e); + vx.emplace_back(x); + vy.emplace_back(y); + ve.emplace_back(e); } } diff --git a/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h index a879cb96325d2b3d1d411a7aa6331fabccd6ca69..79a0443006f883bfa412e1cf6d2f8fa200b22afe 100644 --- a/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h +++ b/Framework/CurveFitting/test/Functions/PseudoVoigtTest.h @@ -33,7 +33,7 @@ public: PseudoVoigtTest() : m_xValues() { for (size_t i = 0; i < 200; ++i) { double x_i = -10 + 0.1 * static_cast<double>(i); - m_xValues.push_back(x_i); + m_xValues.emplace_back(x_i); } } @@ -255,7 +255,7 @@ public: pv->setParameter(0, param_value); pv->functionDeriv(domain, jacobian); // get value and add to the vector - vec_jocob_deriv.push_back(jacobian.get(0, 0)); + vec_jocob_deriv.emplace_back(jacobian.get(0, 0)); // update eta param_value += eta_resolution; } @@ -306,7 +306,7 @@ public: pv->setParameter(1, param_value); pv->functionDeriv(domain, jacobian); // get value and add to the vector - vec_jocob_deriv.push_back(jacobian.get(0, 1)); + vec_jocob_deriv.emplace_back(jacobian.get(0, 1)); // update eta param_value += intensity_resolution; } @@ -355,7 +355,7 @@ public: pv->setParameter(2, param_value); pv->functionDeriv(domain, jacobian); // get value and add to the vector - vec_jocob_deriv.push_back(jacobian.get(0, 2)); + vec_jocob_deriv.emplace_back(jacobian.get(0, 2)); // update eta param_value += x0_resolution; } @@ -403,7 +403,7 @@ public: pv->setParameter(3, param_value); pv->functionDeriv(domain, jacobian); // get value and add to the vector - vec_jocob_deriv.push_back(jacobian.get(0, 3)); + vec_jocob_deriv.emplace_back(jacobian.get(0, 3)); // update eta param_value += fwhm_resolution; } @@ -493,8 +493,8 @@ private: pv->setParameter(param_index, param_value); pv->function(domain, values); // set to vector - param_vec.push_back(param_value); - pv_vec.push_back(values[0]); + param_vec.emplace_back(param_value); + pv_vec.emplace_back(values[0]); // increment param_value += resolution; } diff --git a/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h index 9e4cbd57bcfbde839323a8038350a0e4be704749..1e5c24a45981a2fd095c870b285edd5867987451 100644 --- a/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/ThermalNeutronDtoTOFFunctionTest.h @@ -76,18 +76,18 @@ public: { double a = erfc(x); double da = -2*exp(-x*x)/sqrt(M_PI); - xvec.push_back(x); - erfcy.push_back(a); - derfc.push_back(da); + xvec.emplace_back(x); + erfcy.emplace_back(a); + derfc.emplace_back(da); outss << x <<"\t\t" << a << '\n'; } // numerical derivative for erfc - nderfc.push_back(0.0); + nderfc.emplace_back(0.0); for (size_t i = 1; i < xvec.size(); ++i) { double nda = (erfcy[i]-erfcy[i-1])/0.01; - nderfc.push_back(nda); + nderfc.emplace_back(nda); } ofstream outfile; diff --git a/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h b/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h index 943a1e2886b173497871779e91e21a55b0fcb443..f01e2c8a19efdf9495b6593b223bc6cb74aab06c 100644 --- a/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h +++ b/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h @@ -107,7 +107,7 @@ private: FunctionFactory::Instance().createFunction(registeredFunction)); if (peakFunction) { - peakFunctions.push_back(peakFunction); + peakFunctions.emplace_back(peakFunction); } } } @@ -139,10 +139,10 @@ private: std::vector<ParameterSet> getParameterSets() const { std::vector<ParameterSet> parameterSets; - parameterSets.push_back(ParameterSet(0.0, 4.34, 0.25)); - parameterSets.push_back(ParameterSet(0.0, 5.34, 0.25)); - parameterSets.push_back(ParameterSet(0.0, 6.34, 0.25)); - parameterSets.push_back(ParameterSet(0.0, 7.34, 0.25)); + parameterSets.emplace_back(ParameterSet(0.0, 4.34, 0.25)); + parameterSets.emplace_back(ParameterSet(0.0, 5.34, 0.25)); + parameterSets.emplace_back(ParameterSet(0.0, 6.34, 0.25)); + parameterSets.emplace_back(ParameterSet(0.0, 7.34, 0.25)); return parameterSets; } @@ -152,7 +152,7 @@ private: std::vector<double> intensities; for (const auto &peak : peaks) { - intensities.push_back(peak->intensity()); + intensities.emplace_back(peak->intensity()); } return intensities; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h index 2ee62a9cf3fd5802f790fce92a8350473f1325f9..e4b737866153747d7649e692de6405e8b4df7ed3 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h @@ -379,7 +379,7 @@ void adjustTimeOfFlightISISLegacy(::NeXus::File &file, T localWorkspace, std::string entry_name(it->first); std::string entry_class(it->second); if (entry_class == classType) { - bankNames.push_back(entry_name); + bankNames.emplace_back(entry_name); } } for (size_t i = 0; i < bankNames.size(); ++i) { diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveOpenGenieAscii.h b/Framework/DataHandling/inc/MantidDataHandling/SaveOpenGenieAscii.h index 1efa3fe4d12060a032e598382c0bd15beabbfbed..022cd98bab0f4dc20f506eaf491fc1107e27bb51 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveOpenGenieAscii.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveOpenGenieAscii.h @@ -54,7 +54,7 @@ private: inline void addToOutputBuffer(const std::string &outName, const std::string &outType, const std::string &outVal) { - m_outputVector.push_back(OutputBufferEntry(outName, outType, outVal)); + m_outputVector.emplace_back(OutputBufferEntry(outName, outType, outVal)); } /// Adds ENGINX related data which is required for OpenGenie diff --git a/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp b/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp index 5b6f11f42955de161658c4dd0a62272c9b9e2b3e..f00a57613d54d04e6786fd5deb297dc5cc727127 100644 --- a/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp +++ b/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp @@ -232,10 +232,10 @@ void AppendGeometryToSNSNexus::exec() { azimuthal_angle.reserve(dets.size()); for (auto &det : dets) { - pixel_id.push_back(det->getID()); - distance.push_back(det->getDistance(*sample)); - azimuthal_angle.push_back(det->getPhi()); - polar_angle.push_back(ws->detectorTwoTheta(*det)); + pixel_id.emplace_back(det->getID()); + distance.emplace_back(det->getDistance(*sample)); + azimuthal_angle.emplace_back(det->getPhi()); + polar_angle.emplace_back(ws->detectorTwoTheta(*det)); } // Write Pixel ID to file diff --git a/Framework/DataHandling/src/AsciiPointBase.cpp b/Framework/DataHandling/src/AsciiPointBase.cpp index c8837f4675bbd79d22b4f56485eecc7b07567c43..8279276950143475707ca22b392c4c840bbecea5 100644 --- a/Framework/DataHandling/src/AsciiPointBase.cpp +++ b/Framework/DataHandling/src/AsciiPointBase.cpp @@ -127,9 +127,9 @@ void AsciiPointBase::outputval(double val, std::ofstream &file, /// appends the separator property to the algorithm void AsciiPointBase::appendSeparatorProperty() { std::vector<std::string> propOptions; - propOptions.push_back("comma"); - propOptions.push_back("space"); - propOptions.push_back("tab"); + propOptions.emplace_back("comma"); + propOptions.emplace_back("space"); + propOptions.emplace_back("tab"); declareProperty("Separator", "tab", boost::make_shared<StringListValidator>(propOptions), "The separator used for splitting data columns."); diff --git a/Framework/DataHandling/src/CheckMantidVersion.cpp b/Framework/DataHandling/src/CheckMantidVersion.cpp index 455e38a24261cec5d3781f72f977a29c7d9740f8..387a1c3e381b859936bcd7bb178c43ecbed0cfeb 100644 --- a/Framework/DataHandling/src/CheckMantidVersion.cpp +++ b/Framework/DataHandling/src/CheckMantidVersion.cpp @@ -175,11 +175,11 @@ CheckMantidVersion::splitVersionString(const std::string &versionString) const { for (; h != tokenizer.end(); ++h) { try { auto part = boost::lexical_cast<int>(*h); - retVal.push_back(part); + retVal.emplace_back(part); } catch (const boost::bad_lexical_cast &) { g_log.error("Failed to convert the following string to an integer '" + *h + "' as part of CheckMantidVersion::splitVersionString"); - retVal.push_back(0); + retVal.emplace_back(0); } } return retVal; diff --git a/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp b/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp index 09158df8e2d66e251151ac04a0217b4db0a44fdb..fea21ffd0f8eb22d59bbeb6053a2f1f99b2bd2e6 100644 --- a/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp +++ b/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp @@ -424,7 +424,7 @@ void CreateChunkingFromInstrument::exec() { if (grouping.count(parent) == 0) grouping[parent] = vector<string>(); - grouping[parent].push_back(comp->getName()); + grouping[parent].emplace_back(comp->getName()); } } progress.report(); diff --git a/Framework/DataHandling/src/DataBlockComposite.cpp b/Framework/DataHandling/src/DataBlockComposite.cpp index 937dcef353d31473f309297ad3f58492895fdc62..325170c2378b3d39986ccd4a5a92847a4229d32a 100644 --- a/Framework/DataHandling/src/DataBlockComposite.cpp +++ b/Framework/DataHandling/src/DataBlockComposite.cpp @@ -40,7 +40,7 @@ getRemovalIntervalsRelevantForTheCurrentOriginalInterval( std::vector<std::pair<int64_t, int64_t>> overlaps; for (auto &removeInterval : removeIntervals) { if (hasOverlap(original, removeInterval)) { - overlaps.push_back(removeInterval); + overlaps.emplace_back(removeInterval); } } return overlaps; @@ -167,12 +167,12 @@ std::vector<std::pair<int64_t, int64_t>> getSlicedIntervals( break; } else if (isRightHandSideOverlap(original, removeInterval)) { auto newInterval = handleRightHandSideOverlap(original, removeInterval); - newIntervals.push_back(newInterval); + newIntervals.emplace_back(newInterval); } else if (isLeftHandSideOverlap(original, removeInterval)) { handleLeftHandSideOverlap(original, removeInterval); } else if (isFullyContained(original, removeInterval)) { auto newInterval = handleFullyContained(original, removeInterval); - newIntervals.push_back(newInterval); + newIntervals.emplace_back(newInterval); } else { throw std::runtime_error( "DataBlockComposite: The intervals don't seem to overlap."); @@ -185,7 +185,7 @@ std::vector<std::pair<int64_t, int64_t>> getSlicedIntervals( // or no righ-hand-side overlap of a removal interval if ((original.first != invalidIntervalValue) && (original.second != invalidIntervalValue)) { - newIntervals.push_back(original); + newIntervals.emplace_back(original); } return newIntervals; @@ -260,7 +260,7 @@ void DataBlockComposite::addDataBlock(DataBlock dataBlock) { m_numberOfSpectra = dataBlock.getNumberOfSpectra(); // Insert the data block - m_dataBlocks.push_back(dataBlock); + m_dataBlocks.emplace_back(dataBlock); } size_t DataBlockComposite::getNumberOfSpectra() const { @@ -447,7 +447,7 @@ void DataBlockComposite::removeSpectra(DataBlockComposite &toRemove) { numberOfChannels); dataBlock.setMinSpectrumID(newInterval.first); dataBlock.setMaxSpectrumID(newInterval.second); - m_dataBlocks.push_back(dataBlock); + m_dataBlocks.emplace_back(dataBlock); } } @@ -460,7 +460,7 @@ std::vector<int64_t> DataBlockComposite::getAllSpectrumNumbers() { std::vector<int64_t> allSpectra; for (; !generator->isDone(); generator->next()) { - allSpectra.push_back(generator->getValue()); + allSpectra.emplace_back(generator->getValue()); } return allSpectra; diff --git a/Framework/DataHandling/src/DownloadInstrument.cpp b/Framework/DataHandling/src/DownloadInstrument.cpp index f87d6cdf3b7245182a9f0cdcad7bac9c01dfebf7..4be0290038b0aec718c2f490b993e709346478c2 100644 --- a/Framework/DataHandling/src/DownloadInstrument.cpp +++ b/Framework/DataHandling/src/DownloadInstrument.cpp @@ -329,7 +329,7 @@ size_t DownloadInstrument::removeOrphanedFiles( g_log.debug() << "File not found in remote instrument repository, will " "be deleted: " << entryPath.getFileName() << '\n'; - filesToDelete.push_back(it->path()); + filesToDelete.emplace_back(it->path()); } } } catch (Poco::Exception &ex) { diff --git a/Framework/DataHandling/src/ExtractPolarizationEfficiencies.cpp b/Framework/DataHandling/src/ExtractPolarizationEfficiencies.cpp index 7c5344cc19480d122118c083a7bc4794c8b60dd7..fe3e6bbacfed32cef0599496af4de3e2eafd3f36 100644 --- a/Framework/DataHandling/src/ExtractPolarizationEfficiencies.cpp +++ b/Framework/DataHandling/src/ExtractPolarizationEfficiencies.cpp @@ -43,7 +43,7 @@ std::vector<double> parseVector(std::string const &name, std::vector<double> result; double number; while (istr >> number) { - result.push_back(number); + result.emplace_back(number); } if (!istr.eof()) { diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index b6fadad0a208a8f63b1a21b9aaf85940144ee650..831ff495be1ab0a2bda720afa442e125bdf1b458 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -188,7 +188,7 @@ static string generateMappingfileName(EventWorkspace_sptr &wksp) { .append("/calibrations/") .append(mapping); if (Poco::File(path).exists()) { - files.push_back(path); + files.emplace_back(path); } } } @@ -1295,8 +1295,8 @@ void FilterEventsByLogValuePreNexus::procEventsLinear( std::vector<Types::Core::DateAndTime> tempvectime; std::vector<double> temptofs; - local_pulsetimes.push_back(tempvectime); - local_tofs.push_back(temptofs); + local_pulsetimes.emplace_back(tempvectime); + local_tofs.emplace_back(temptofs); theindex = newindex; @@ -1307,8 +1307,8 @@ void FilterEventsByLogValuePreNexus::procEventsLinear( } // Store pulse time and tof of this event - local_pulsetimes[theindex].push_back(pulsetime); - local_tofs[theindex].push_back(tof); + local_pulsetimes[theindex].emplace_back(pulsetime); + local_tofs[theindex].emplace_back(tof); } // END-IF-ELSE: On Event's Pixel's Nature } // ENDIF (event is masked error) @@ -1341,8 +1341,8 @@ void FilterEventsByLogValuePreNexus::procEventsLinear( std::vector<Types::Core::DateAndTime> vec_pulsetimes; std::vector<double> vec_tofs; - this->wrongdetid_pulsetimes.push_back(vec_pulsetimes); - this->wrongdetid_tofs.push_back(vec_tofs); + this->wrongdetid_pulsetimes.emplace_back(vec_pulsetimes); + this->wrongdetid_tofs.emplace_back(vec_tofs); mindex = newindex; } else { @@ -1356,9 +1356,9 @@ void FilterEventsByLogValuePreNexus::procEventsLinear( // Append local (thread) loaded events (pulse + tof) to global wrong detid // data structure for (size_t iv = 0; iv < local_pulsetimes[localindex].size(); iv++) { - this->wrongdetid_pulsetimes[mindex].push_back( + this->wrongdetid_pulsetimes[mindex].emplace_back( local_pulsetimes[localindex][iv]); - this->wrongdetid_tofs[mindex].push_back(local_tofs[localindex][iv]); + this->wrongdetid_tofs[mindex].emplace_back(local_tofs[localindex][iv]); } } @@ -2070,8 +2070,8 @@ void FilterEventsByLogValuePreNexus::filterEventsLinear( std::vector<Types::Core::DateAndTime> tempvectime; std::vector<double> temptofs; - local_pulsetimes.push_back(tempvectime); - local_tofs.push_back(temptofs); + local_pulsetimes.emplace_back(tempvectime); + local_tofs.emplace_back(temptofs); theindex = newindex; @@ -2082,8 +2082,8 @@ void FilterEventsByLogValuePreNexus::filterEventsLinear( } // Store pulse time and tof of this event - local_pulsetimes[theindex].push_back(pulsetime); - local_tofs[theindex].push_back(tof); + local_pulsetimes[theindex].emplace_back(pulsetime); + local_tofs[theindex].emplace_back(tof); #else // Ignore all operation ; @@ -2376,8 +2376,8 @@ void FilterEventsByLogValuePreNexus::readPulseidFile( for (const auto &pulse : pulses) { DateAndTime pulseDateTime(static_cast<int64_t>(pulse.seconds), static_cast<int64_t>(pulse.nanoseconds)); - this->pulsetimes.push_back(pulseDateTime); - this->m_vecEventIndex.push_back(pulse.event_index); + this->pulsetimes.emplace_back(pulseDateTime); + this->m_vecEventIndex.emplace_back(pulse.event_index); if (pulseDateTime < lastPulseDateTime) this->m_pulseTimesIncreasing = false; @@ -2385,7 +2385,7 @@ void FilterEventsByLogValuePreNexus::readPulseidFile( lastPulseDateTime = pulseDateTime; temp = pulse.pCurrent; - this->m_protonCharge.push_back(temp); + this->m_protonCharge.emplace_back(temp); if (temp < 0.) this->g_log.warning("Individual proton charge < 0 being ignored"); else diff --git a/Framework/DataHandling/src/FindDetectorsInShape.cpp b/Framework/DataHandling/src/FindDetectorsInShape.cpp index 7ca1efa5da4447d8ffcc0eab47f6939dfdf50ce2..4f07956d3fea1d41be2f8631d4dda86c76c16451 100644 --- a/Framework/DataHandling/src/FindDetectorsInShape.cpp +++ b/Framework/DataHandling/src/FindDetectorsInShape.cpp @@ -68,7 +68,7 @@ void FindDetectorsInShape::exec() { if (shape_sptr->isValid(detectorInfo.position(i))) { // shape encloses this objectComponent g_log.debug() << "Detector contained in shape " << detIDs[i] << '\n'; - foundDets.push_back(detIDs[i]); + foundDets.emplace_back(detIDs[i]); } } iprogress++; diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 5a9cc03280176bdd87264d879a20ac24474cd5a5..9669306c1f8e8f746efa9a8d8532d84de8903f5c 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -178,7 +178,7 @@ void GroupDetectors2::exec() { // the ungrouped list could be very big but might be none at all unGroupedInds.reserve(numInHists); for (size_t i = 0; i < numInHists; i++) { - unGroupedInds.push_back(i); + unGroupedInds.emplace_back(i); } getGroups(inputWS, unGroupedInds); @@ -251,7 +251,7 @@ void GroupDetectors2::execEvent() { // the ungrouped list could be very big but might be none at all unGroupedInds.reserve(numInHists); for (size_t i = 0; i < numInHists; i++) { - unGroupedInds.push_back(i); + unGroupedInds.emplace_back(i); } // read in the input parameters to make that map, if KeepUngroupedSpectra was @@ -588,7 +588,7 @@ void GroupDetectors2::processXMLFile(const std::string &fname, auto ind = detIdToWiMap.find(detid); if (ind != detIdToWiMap.end()) { size_t wsid = ind->second; - wsindexes.push_back(wsid); + wsindexes.emplace_back(wsid); if (unUsedSpec[wsid] != (USED)) { unUsedSpec[wsid] = (USED); } @@ -614,7 +614,7 @@ void GroupDetectors2::processXMLFile(const std::string &fname, auto ind = specs2index.find(specNum); if (ind != specs2index.end()) { size_t wsid = ind->second; - wsindexes.push_back(wsid); + wsindexes.emplace_back(wsid); if (unUsedSpec[wsid] != (USED)) { unUsedSpec[wsid] = (USED); } @@ -892,9 +892,9 @@ void GroupDetectors2::readSpectraIndexes(const std::string &line, // sets KeepUngroupedSpectra, as // well as to find duplicates unUsedSpec[ind->second] = USED; - output.push_back(ind->second); + output.emplace_back(ind->second); } else { // the spectra was already included in a group - output.push_back(ind->second); + output.emplace_back(ind->second); } } } @@ -1178,7 +1178,7 @@ void GroupDetectors2::RangeHelper::getList(const std::string &line, "interpret range specification"); } for (; readPostion != beforeHyphen.end(); ++readPostion) { - outList.push_back(boost::lexical_cast<size_t>(*readPostion)); + outList.emplace_back(boost::lexical_cast<size_t>(*readPostion)); } // this will be the start of a range if it was followed by a - i.e. // another token was captured @@ -1207,7 +1207,7 @@ void GroupDetectors2::RangeHelper::getList(const std::string &line, // expand the range for (size_t j = rangeStart + 1; j < rangeEnd; j++) { - outList.push_back(j); + outList.emplace_back(j); } loop++; diff --git a/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp b/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp index af65b1d0dbe1e8f38bf68102f13e896ad50d3605..c882579d9b3749ad32227454807fb10e59139cdd 100644 --- a/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp +++ b/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp @@ -110,7 +110,7 @@ MatrixWorkspace_sptr JoinISISPolarizationEfficiencies::createEfficiencies( "Loaded workspace must contain a single histogram. Found " + std::to_string(ws->getNumberHistograms())); } - workspaces.push_back(ws); + workspaces.emplace_back(ws); } return createEfficiencies(props, workspaces); @@ -180,14 +180,14 @@ JoinISISPolarizationEfficiencies::interpolateWorkspaces( for (auto const &ws : workspaces) { if (ws->blocksize() < maxSize) { if (allAreHistograms) { - interpolatedWorkspaces.push_back( + interpolatedWorkspaces.emplace_back( interpolateHistogramWorkspace(ws, maxSize)); } else { - interpolatedWorkspaces.push_back( + interpolatedWorkspaces.emplace_back( interpolatePointDataWorkspace(ws, maxSize)); } } else { - interpolatedWorkspaces.push_back(ws); + interpolatedWorkspaces.emplace_back(ws); } } diff --git a/Framework/DataHandling/src/Load.cpp b/Framework/DataHandling/src/Load.cpp index 6441366335df378a1597bd9146c7894f937963da..9016deff67f020149bfc81a894ad3415d60aac19 100644 --- a/Framework/DataHandling/src/Load.cpp +++ b/Framework/DataHandling/src/Load.cpp @@ -426,7 +426,7 @@ void Load::loadMultipleFiles() { } } // Add the sum to the list of loaded workspace names. - loadedWsList.push_back(sumWS); + loadedWsList.emplace_back(sumWS); } // If we only have one loaded ws, set it as the output. diff --git a/Framework/DataHandling/src/LoadANSTOHelper.cpp b/Framework/DataHandling/src/LoadANSTOHelper.cpp index cd7fe6012610c2a86489a210e584ec38e4ef92fc..d1bd8acda8ed6a3dbe546c3555a421af4f2fb696 100644 --- a/Framework/DataHandling/src/LoadANSTOHelper.cpp +++ b/Framework/DataHandling/src/LoadANSTOHelper.cpp @@ -172,7 +172,7 @@ void EventAssignerFixedWavelength::addEventImpl(size_t id, int64_t pulse, double tof) { UNUSED_ARG(pulse); UNUSED_ARG(tof); - m_eventVectors[id]->push_back(m_wavelength); + m_eventVectors[id]->emplace_back(m_wavelength); } // FastReadOnlyFile @@ -277,8 +277,8 @@ File::File(const std::string &path) fileInfo.Size = header.readFileSize(); if (header.TypeFlag == TarTypeFlag_NormalFile) { - m_fileNames.push_back(fileName); - m_fileInfos.push_back(fileInfo); + m_fileNames.emplace_back(fileName); + m_fileInfos.emplace_back(fileInfo); } auto offset = static_cast<size_t>(fileInfo.Size % 512); diff --git a/Framework/DataHandling/src/LoadAscii.cpp b/Framework/DataHandling/src/LoadAscii.cpp index bd96ed28756cd962b20e21a076984eea80d8140d..8b102fc8a0d07d35873b061f4e708b2d85836af4 100644 --- a/Framework/DataHandling/src/LoadAscii.cpp +++ b/Framework/DataHandling/src/LoadAscii.cpp @@ -217,7 +217,7 @@ API::Workspace_sptr LoadAscii::readData(std::ifstream &file) const { if (haveXErrors) { // Note: we only have X errors with 4-column files. // We are only here when i=0. - dx.push_back(values[3]); + dx.emplace_back(values[3]); } ++numBins; } while (getline(file, line)); diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp index 29c74ee21e58c04e220babbafb19719a78e71212..75a208de12569937a509d8b089bca07ec6fbcfcd 100644 --- a/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Framework/DataHandling/src/LoadAscii2.cpp @@ -477,7 +477,7 @@ void LoadAscii2::addToCurrentSpectra(std::list<std::string> &columns) { case 4: { // E and DX in file, include both histo.mutableE().back() = values[2]; - m_curDx.push_back(values[3]); + m_curDx.emplace_back(values[3]); break; } } @@ -537,7 +537,7 @@ void LoadAscii2::newSpectra() { if (specSize > 0 && specSize == m_lastBins) { if (m_curSpectra->x().size() == m_curDx.size()) m_curSpectra->setPointStandardDeviations(std::move(m_curDx)); - m_spectra.push_back(*m_curSpectra); + m_spectra.emplace_back(*m_curSpectra); } m_curSpectra.reset(); } diff --git a/Framework/DataHandling/src/LoadBankFromDiskTask.cpp b/Framework/DataHandling/src/LoadBankFromDiskTask.cpp index 179dd1dac6ad87b6dc76631419388f61d415a99e..aca1aa0aabf3fe21e1b5c5c756b44d875d9caac7 100644 --- a/Framework/DataHandling/src/LoadBankFromDiskTask.cpp +++ b/Framework/DataHandling/src/LoadBankFromDiskTask.cpp @@ -77,7 +77,7 @@ void LoadBankFromDiskTask::loadPulseTimes(::NeXus::File &file) { // Not found? Need to load and add it thisBankPulseTimes = boost::make_shared<BankPulseTimes>(boost::ref(file), m_framePeriodNumbers); - m_loader.m_bankPulseTimes.push_back(thisBankPulseTimes); + m_loader.m_bankPulseTimes.emplace_back(thisBankPulseTimes); } /** Load the event_index field diff --git a/Framework/DataHandling/src/LoadCanSAS1D2.cpp b/Framework/DataHandling/src/LoadCanSAS1D2.cpp index 7486d01fec9749c3dfdb2fd6bb26e717def76bdf..608615c1884303cb50113528fa49f6a7f7281cd2 100644 --- a/Framework/DataHandling/src/LoadCanSAS1D2.cpp +++ b/Framework/DataHandling/src/LoadCanSAS1D2.cpp @@ -223,7 +223,7 @@ LoadCanSAS1D2::loadEntry(Poco::XML::Node *const workspaceData, dataWS->getAxis(0)->setUnit("Wavelength"); // add to group - group.push_back(dataWS); + group.emplace_back(dataWS); } return main_out; } diff --git a/Framework/DataHandling/src/LoadDaveGrp.cpp b/Framework/DataHandling/src/LoadDaveGrp.cpp index b06b31782b32f6b13f3c64e5dfd3f86de0d6197c..7e2f8c40d0462ecef8155e1ca57d8308949ff217 100644 --- a/Framework/DataHandling/src/LoadDaveGrp.cpp +++ b/Framework/DataHandling/src/LoadDaveGrp.cpp @@ -227,7 +227,7 @@ void LoadDaveGrp::getAxisValues(std::vector<double> &axis, readLine(); std::istringstream is(line); is >> value; - axis.push_back(value); + axis.emplace_back(value); } } diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index 89d62db19da2e5204e27d6cf77271cb28c386133..6320362d2e5ceac533226092660214b449c8a01b 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -380,7 +380,7 @@ void LoadDetectorsGroupingFile::generateNoInstrumentGroupWorkspace() { int groupid = groupspeciter->first; for (auto specid : groupspeciter->second) { spectrumidgroupmap.emplace(specid, groupid); - specids.push_back(specid); + specids.emplace_back(specid); } } diff --git a/Framework/DataHandling/src/LoadDspacemap.cpp b/Framework/DataHandling/src/LoadDspacemap.cpp index 8a6001f89ab8fe8e48a30228d51c1e493cd3d28c..f4730178194b3a5cda9909fce19eccb1f3d6a8fb 100644 --- a/Framework/DataHandling/src/LoadDspacemap.cpp +++ b/Framework/DataHandling/src/LoadDspacemap.cpp @@ -111,7 +111,7 @@ void LoadDspacemap::CalculateOffsetsFromDSpacemapFile( fin.read(reinterpret_cast<char *>(&read), sizeof read); // Factor of 10 between ISAW and Mantid read *= 10.; - dspace.push_back(read); + dspace.emplace_back(read); } const auto &detectorIds = detectorInfo.detectorIDs(); diff --git a/Framework/DataHandling/src/LoadEMU.cpp b/Framework/DataHandling/src/LoadEMU.cpp index 82b761fb439d01641fff90f3486de3acd68af093..433cd332d037cd4971d9dbbb3f2376cc08db87e2 100644 --- a/Framework/DataHandling/src/LoadEMU.cpp +++ b/Framework/DataHandling/src/LoadEMU.cpp @@ -496,7 +496,7 @@ protected: m_tofMax = tof; auto ev = Types::Event::TofEvent(tof, Types::Core::DateAndTime(offset)); - m_eventVectors[id]->push_back(ev); + m_eventVectors[id]->emplace_back(ev); } public: diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index 2c770928dd7e02887d5d5e3a4984bac894e9cd7c..2ad6acd86acc42414ad9797234bb0055ff134058 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -274,7 +274,7 @@ void LoadEventNexus::init() { std::vector<std::string> loadType{"Default"}; #ifndef _WIN32 - loadType.push_back("Multiprocess (experimental)"); + loadType.emplace_back("Multiprocess (experimental)"); #endif // _WIN32 #ifdef MPI_EXPERIMENTAL @@ -842,8 +842,8 @@ void LoadEventNexus::loadEvents(API::Progress *const prog, } // get the number of events std::size_t num = numEvents(*m_file, hasTotalCounts, oldNeXusFileNames); - bankNames.push_back(entry_name); - bankNumEvents.push_back(num); + bankNames.emplace_back(entry_name); + bankNumEvents.emplace_back(num); // Look for weights in simulated file haveWeights = exists(*m_file, "event_weight"); @@ -1172,7 +1172,7 @@ void LoadEventNexus::deleteBanks(EventWorkspaceCollection_sptr workspace, det = boost::dynamic_pointer_cast<RectangularDetector>((*inst)[i]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the first sub-level for RectangularDetectors (e.g. // PG3). We are not doing a full recursive search since that will be @@ -1182,7 +1182,7 @@ void LoadEventNexus::deleteBanks(EventWorkspaceCollection_sptr workspace, for (int j = 0; j < assem->nelements(); j++) { det = boost::dynamic_pointer_cast<RectangularDetector>((*assem)[j]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the second sub-level for RectangularDetectors @@ -1194,7 +1194,7 @@ void LoadEventNexus::deleteBanks(EventWorkspaceCollection_sptr workspace, det = boost::dynamic_pointer_cast<RectangularDetector>( (*assem2)[k]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } } } diff --git a/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp b/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp index 4f0d6635154c6cc34af8273cd656a07cdfca626e..6bf7d7dc2f585e436add5e941aaa590e8a023d74 100644 --- a/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp +++ b/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp @@ -32,7 +32,7 @@ void setupConsistentSpectrumNumbers(IndexInfo &filtered, // included in DetectorInfo). for (int32_t i = 0; i < static_cast<int32_t>(detIDs.size()); ++i) { if (filtered.spectrumNumber(spectrumNumbers.size()) == detIDs[i]) - spectrumNumbers.push_back(i + 1); + spectrumNumbers.emplace_back(i + 1); if (filtered.size() == spectrumNumbers.size()) break; } @@ -186,7 +186,8 @@ LoadEventNexusIndexSetup::filterIndexInfo(const IndexInfo &indexInfo) { const auto indices = indexInfo.makeIndexSet( static_cast<SpectrumNumber>(m_min), static_cast<SpectrumNumber>(m_max)); for (const auto index : indices) - m_range.push_back(static_cast<int32_t>(indexInfo.spectrumNumber(index))); + m_range.emplace_back( + static_cast<int32_t>(indexInfo.spectrumNumber(index))); } // Check if SpectrumList was supplied (or filled via min/max above) if (!m_range.empty()) { diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index 37c0f6dab65095726432708be5e1ce760289d800..88121741c4398d3df1b2b6ff689ae166825e293e 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -185,7 +185,7 @@ static string generateMappingfileName(EventWorkspace_sptr &wksp) { .append("/calibrations/") .append(mapping); if (Poco::File(path).exists()) - files.push_back(path); + files.emplace_back(path); } } @@ -1095,8 +1095,8 @@ void LoadEventPreNexus2::procEventsLinear( std::vector<Types::Core::DateAndTime> tempvectime; std::vector<double> temptofs; - local_pulsetimes.push_back(tempvectime); - local_tofs.push_back(temptofs); + local_pulsetimes.emplace_back(tempvectime); + local_tofs.emplace_back(temptofs); theindex = newindex; @@ -1110,8 +1110,8 @@ void LoadEventPreNexus2::procEventsLinear( // ii. calculate and add absolute time // int64_t abstime = (pulsetime.totalNanoseconds()+int64_t(tof*1000)); - local_pulsetimes[theindex].push_back(pulsetime); - local_tofs[theindex].push_back(tof); + local_pulsetimes[theindex].emplace_back(pulsetime); + local_tofs[theindex].emplace_back(tof); } // END-IF-ELSE: On Event's Pixel's Nature @@ -1144,8 +1144,8 @@ void LoadEventPreNexus2::procEventsLinear( std::vector<Types::Core::DateAndTime> temppulsetimes; std::vector<double> temptofs; - this->wrongdetid_pulsetimes.push_back(temppulsetimes); - this->wrongdetid_tofs.push_back(temptofs); + this->wrongdetid_pulsetimes.emplace_back(temppulsetimes); + this->wrongdetid_tofs.emplace_back(temptofs); mindex = newindex; } else { @@ -1157,9 +1157,9 @@ void LoadEventPreNexus2::procEventsLinear( size_t localindex = lit->second; for (size_t iv = 0; iv < local_pulsetimes[localindex].size(); iv++) { - this->wrongdetid_pulsetimes[mindex].push_back( + this->wrongdetid_pulsetimes[mindex].emplace_back( local_pulsetimes[localindex][iv]); - this->wrongdetid_tofs[mindex].push_back(local_tofs[localindex][iv]); + this->wrongdetid_tofs[mindex].emplace_back(local_tofs[localindex][iv]); } // std::sort(this->wrongdetid_abstimes[mindex].begin(), // this->wrongdetid_abstimes[mindex].end()); @@ -1333,8 +1333,8 @@ void LoadEventPreNexus2::readPulseidFile(const std::string &filename, for (const auto &pulse : pulses) { DateAndTime pulseDateTime(static_cast<int64_t>(pulse.seconds), static_cast<int64_t>(pulse.nanoseconds)); - this->pulsetimes.push_back(pulseDateTime); - this->event_indices.push_back(pulse.event_index); + this->pulsetimes.emplace_back(pulseDateTime); + this->event_indices.emplace_back(pulse.event_index); if (pulseDateTime < lastPulseDateTime) this->pulsetimesincreasing = false; @@ -1342,7 +1342,7 @@ void LoadEventPreNexus2::readPulseidFile(const std::string &filename, lastPulseDateTime = pulseDateTime; temp = pulse.pCurrent; - this->proton_charge.push_back(temp); + this->proton_charge.emplace_back(temp); if (temp < 0.) this->g_log.warning("Individual proton charge < 0 being ignored"); else diff --git a/Framework/DataHandling/src/LoadFITS.cpp b/Framework/DataHandling/src/LoadFITS.cpp index 25ab916587dffe9cd0517b20360e6281adb4342d..7b7cbdc4af6cfa80d8647222eb1c54df526a6140 100644 --- a/Framework/DataHandling/src/LoadFITS.cpp +++ b/Framework/DataHandling/src/LoadFITS.cpp @@ -278,7 +278,7 @@ void LoadFITS::loadHeader(const std::string &filePath, FITSInfo &header) { header.numberOfAxis = static_cast<int>(m_headerAxisNameKeys.size()); for (int j = 0; j < header.numberOfAxis; ++j) { - header.axisPixelLengths.push_back(boost::lexical_cast<size_t>( + header.axisPixelLengths.emplace_back(boost::lexical_cast<size_t>( header.headerKeys[m_headerAxisNameKeys[j]])); // only debug level, when loading multiple files this is very verbose g_log.debug() << "Found axis length header entry: " @@ -601,7 +601,7 @@ void LoadFITS::parseHeader(FITSInfo &headerInfo) { // map of individual keys. std::string part; reader.readRaw(80, part); - headerInfo.headerItems.push_back(part); + headerInfo.headerItems.emplace_back(part); // from the FITS standard about COMMENT: This keyword shall have no // associated value; columns 9-80 may contain any ASCII text. diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index 029d54761312dfc8efaff1bdf7125e7e84e52fee..371ee85edb9d4f59eca0af54b01d55b44b37c58f 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -167,7 +167,7 @@ void LoadFullprofResolution::exec() { g_log.error(errmsg.str()); throw runtime_error(errmsg.str()); } else { - vec_bankids.push_back(outputbankid); + vec_bankids.emplace_back(outputbankid); } } } @@ -258,7 +258,7 @@ void LoadFullprofResolution::loadFile(string filename, vector<string> &lines) { // display the line we gathered: boost::algorithm::trim(line); if (!line.empty()) - lines.push_back(line); + lines.emplace_back(line); } // close the stream: @@ -339,7 +339,7 @@ void LoadFullprofResolution::scanBanks(const vector<string> &lines, } else { // Get bank ID as ordinal number of bank bankid++; } - banks.push_back(bankid); + banks.emplace_back(bankid); } } if (startindex >= 0) { @@ -672,13 +672,13 @@ TableWorkspace_sptr LoadFullprofResolution::genTableWorkspace( for (parmapiter = bankmapiter->second.begin(); parmapiter != bankmapiter->second.end(); ++parmapiter) { string parname = parmapiter->first; - vec_parname.push_back(parname); + vec_parname.emplace_back(parname); } for (bankmapiter = bankparammap.begin(); bankmapiter != bankparammap.end(); ++bankmapiter) { int bankid = bankmapiter->first; - vec_bankids.push_back(bankid); + vec_bankids.emplace_back(bankid); } g_log.debug() << "[DBx240] Number of imported parameters is " << numparams diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp index e780841cbe745cf135891c48ae7b577f3fe6b7a8..11bb6c6d6bda7080a3ce9697f10b052d4d27c9d4 100644 --- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp @@ -232,7 +232,7 @@ void LoadGSASInstrumentFile::loadFile(string filename, vector<string> &lines) { // display the line we gathered: boost::algorithm::trim(line); if (!line.empty()) - lines.push_back(line); + lines.emplace_back(line); } // close the stream: @@ -304,7 +304,7 @@ void LoadGSASInstrumentFile::scanBanks(const std::vector<std::string> &lines, "INS") { // Ignore all lines that don't begin with INS if (line.find("BNKPAR") != string::npos) { // We've found start of a new bank - bankStartIndex.push_back(i); + bankStartIndex.emplace_back(i); } } // INS } // for(i) @@ -412,13 +412,13 @@ TableWorkspace_sptr LoadGSASInstrumentFile::genTableWorkspace( for (parmapiter = bankmapiter->second.begin(); parmapiter != bankmapiter->second.end(); ++parmapiter) { string parname = parmapiter->first; - vec_parname.push_back(parname); + vec_parname.emplace_back(parname); } for (bankmapiter = bankparammap.begin(); bankmapiter != bankparammap.end(); ++bankmapiter) { size_t bankid = bankmapiter->first; - vec_bankids.push_back(bankid); + vec_bankids.emplace_back(bankid); } g_log.debug() << "[DBx240] Number of imported parameters is " << numparams diff --git a/Framework/DataHandling/src/LoadGSS.cpp b/Framework/DataHandling/src/LoadGSS.cpp index 40cce6328d52ab199a6880da52c3eab99250052c..7c8e64ca991c6c202e197a2399cb03aacba917e4 100644 --- a/Framework/DataHandling/src/LoadGSS.cpp +++ b/Framework/DataHandling/src/LoadGSS.cpp @@ -245,9 +245,9 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, g_log.warning(msg.str()); } - totalflightpaths.push_back(totalpath); - twothetas.push_back(tth); - difcs.push_back(difc); + totalflightpaths.emplace_back(totalpath); + twothetas.emplace_back(tth); + difcs.emplace_back(difc); std::stringstream msg; msg << "Bank " << difcs.size() - 1 @@ -296,7 +296,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, g_log.debug() << "Bank: " << specno << " filetypestring = " << filetypestring << '\n'; - detectorIDs.push_back(specno); + detectorIDs.emplace_back(specno); if (filetypestring[0] == 'S') { // SLOG @@ -316,7 +316,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, if (filetype == 'r') { double x0 = bc1 / 32; g_log.debug() << "RALF: x0 = " << x0 << " bc4 = " << bc4 << '\n'; - vecX.push_back(x0); + vecX.emplace_back(x0); } else { // Cannot calculate x0, turn on the flag calslogx0 = true; @@ -375,7 +375,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, g_log.debug() << "x'_0 = " << xValue << " bc3 = " << bc3 << '\n'; double x0 = 2 * xValue / (bc3 + 2.0); - vecX.push_back(x0); + vecX.emplace_back(x0); xPrev = x0; g_log.debug() << "SLOG: x0 = " << x0 << '\n'; calslogx0 = false; @@ -393,9 +393,9 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, } // store read in data (x, y, e) to vector - vecX.push_back(std::move(xValue)); - vecY.push_back(std::move(yValue)); - vecE.push_back(std::move(eValue)); + vecX.emplace_back(std::move(xValue)); + vecY.emplace_back(std::move(yValue)); + vecE.emplace_back(std::move(eValue)); } // Date Line else { g_log.warning() << "Line not defined: " << currentLine << '\n'; diff --git a/Framework/DataHandling/src/LoadHFIRSANS.cpp b/Framework/DataHandling/src/LoadHFIRSANS.cpp index 49783ca68c01e5fef63431725332e502ed2e4024..fff19d713188c0ba730189b0b288a2024e00f3f8 100644 --- a/Framework/DataHandling/src/LoadHFIRSANS.cpp +++ b/Framework/DataHandling/src/LoadHFIRSANS.cpp @@ -299,7 +299,7 @@ std::vector<int> LoadHFIRSANS::readData(const std::string &dataXpath) { std::stringstream iss(data_str); double number; while (iss >> number) { - data.push_back(static_cast<int>(number)); + data.emplace_back(static_cast<int>(number)); } g_log.debug() << "Detector XPath: " << detectorXpath << " parsed. Total size of data processed up to now = " @@ -455,13 +455,13 @@ void LoadHFIRSANS::setBeamTrapRunProperty() { double trapDiameterInUse = trapDiameters[1]; std::vector<double> trapMotorPositions; - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(m_metadata["Motor_Positions/trap_y_25mm"])); - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(m_metadata["Motor_Positions/trap_y_50mm"])); - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(m_metadata["Motor_Positions/trap_y_76mm"])); - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(m_metadata["Motor_Positions/trap_y_101mm"])); // Check how many traps are in use (store indexes): @@ -469,7 +469,7 @@ void LoadHFIRSANS::setBeamTrapRunProperty() { for (size_t i = 0; i < trapMotorPositions.size(); i++) { if (trapMotorPositions[i] > 26.0) { // Resting positions are below 25. Make sure we have one trap in use! - trapIndexInUse.push_back(i); + trapIndexInUse.emplace_back(i); } } @@ -479,7 +479,7 @@ void LoadHFIRSANS::setBeamTrapRunProperty() { std::vector<double> trapDiametersInUse; trapDiametersInUse.reserve(trapIndexInUse.size()); for (auto index : trapIndexInUse) { - trapDiametersInUse.push_back(trapDiameters[index]); + trapDiametersInUse.emplace_back(trapDiameters[index]); } g_log.debug() << "trapDiametersInUse length:" << trapDiametersInUse.size() diff --git a/Framework/DataHandling/src/LoadILLDiffraction.cpp b/Framework/DataHandling/src/LoadILLDiffraction.cpp index 39ac9ed7025354215b15aee4741d55210a4fb51b..f94255db22c8f0866347bd49fb0c5d0cb8bc3607 100644 --- a/Framework/DataHandling/src/LoadILLDiffraction.cpp +++ b/Framework/DataHandling/src/LoadILLDiffraction.cpp @@ -622,7 +622,7 @@ std::vector<double> LoadILLDiffraction::getScannedVaribleByPropertyName( for (size_t i = 0; i < m_scanVar.size(); ++i) { if (m_scanVar[i].property == propertyName) { for (size_t j = 0; j < m_numberScanPoints; ++j) { - scannedVariable.push_back( + scannedVariable.emplace_back( scan(static_cast<int>(i), static_cast<int>(j))); } break; @@ -710,7 +710,7 @@ LoadILLDiffraction::getAbsoluteTimes(const NXDouble &scan) const { size_t timeIndex = 1; while (timeIndex < m_numberScanPoints) { time += durations[timeIndex - 1]; - times.push_back(time); + times.emplace_back(time); ++timeIndex; } return times; diff --git a/Framework/DataHandling/src/LoadILLTOF2.cpp b/Framework/DataHandling/src/LoadILLTOF2.cpp index 3940b2209954da22db7d6be206f9440e6864ecab..7d39cfc67fbfc3eac373fe24fbe2fd76e19ada23 100644 --- a/Framework/DataHandling/src/LoadILLTOF2.cpp +++ b/Framework/DataHandling/src/LoadILLTOF2.cpp @@ -136,7 +136,7 @@ LoadILLTOF2::getMonitorInfo(NeXus::NXEntry &firstEntry) { data.load(); std::vector<int> thisMonitor(data(), data() + data.size()); - monitorList.push_back(thisMonitor); + monitorList.emplace_back(thisMonitor); } } return monitorList; diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index 6cf572214164f8ff58b213daa093fe04b0737296..b05477979af60eb6de989bedf580372b28a95bfa 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -605,7 +605,7 @@ bool LoadISISNexus2::checkOptionalProperties(bool bseparateMonitors, // The spec_min - spec_max range needs to be added to the spec list for (int64_t i = spec_min; i < spec_max + 1; ++i) { auto spec_num = static_cast<specnum_t>(i); - spec_list.push_back(spec_num); + spec_list.emplace_back(spec_num); std::sort(spec_list.begin(), spec_list.end()); // supplied range converted into the list, so no more supplied range } @@ -720,12 +720,12 @@ LoadISISNexus2::prepareSpectraBlocks(std::map<int64_t, std::string> &monitors, for (const auto &dataBlock : dataBlocks) { auto min = dataBlock.getMinSpectrumID(); if (isMonitor(min)) { - m_spectraBlocks.push_back( + m_spectraBlocks.emplace_back( SpectraBlock(min, min, true, monitors.find(min)->second)); - includedMonitors.push_back(min); + includedMonitors.emplace_back(min); } else { auto max = dataBlock.getMaxSpectrumID(); - m_spectraBlocks.push_back(SpectraBlock(min, max, false, "")); + m_spectraBlocks.emplace_back(SpectraBlock(min, max, false, "")); } } diff --git a/Framework/DataHandling/src/LoadIsawDetCal.cpp b/Framework/DataHandling/src/LoadIsawDetCal.cpp index 3a92eb1da12dd5911592fba51ff1415071480eaa..b2771173b1f9acfbb934d6134c98caa5c801055d 100644 --- a/Framework/DataHandling/src/LoadIsawDetCal.cpp +++ b/Framework/DataHandling/src/LoadIsawDetCal.cpp @@ -145,7 +145,7 @@ void LoadIsawDetCal::exec() { det = boost::dynamic_pointer_cast<RectangularDetector>((*inst)[i]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the first sub-level for RectangularDetectors (e.g. PG3). // We are not doing a full recursive search since that will be very long @@ -155,7 +155,7 @@ void LoadIsawDetCal::exec() { for (int j = 0; j < assem->nelements(); j++) { det = boost::dynamic_pointer_cast<RectangularDetector>((*assem)[j]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } else { // Also, look in the second sub-level for RectangularDetectors (e.g. @@ -168,7 +168,7 @@ void LoadIsawDetCal::exec() { det = boost::dynamic_pointer_cast<RectangularDetector>( (*assem2)[k]); if (det) { - detList.push_back(det); + detList.emplace_back(det); } } } @@ -303,7 +303,7 @@ void LoadIsawDetCal::exec() { detScaling.scaleY *= oldscaley[0]; } - rectangularDetectorScalings.push_back(detScaling); + rectangularDetectorScalings.emplace_back(detScaling); doRotation(rX, rY, componentInfo, det); } @@ -417,7 +417,7 @@ std::vector<std::string> LoadIsawDetCal::getFilenames() { // shouldn't be used except for legacy cases const std::string filename2 = this->getProperty("Filename2"); if (!filename2.empty()) - filenamesFromPropertyUnraveld.push_back(filename2); + filenamesFromPropertyUnraveld.emplace_back(filename2); return filenamesFromPropertyUnraveld; } diff --git a/Framework/DataHandling/src/LoadLog.cpp b/Framework/DataHandling/src/LoadLog.cpp index 23219b4cc0de145a3309cfabf18f3e0c0f92ca10..039ad3a6693db773b60e7d55adc914ac4b293efc 100644 --- a/Framework/DataHandling/src/LoadLog.cpp +++ b/Framework/DataHandling/src/LoadLog.cpp @@ -374,7 +374,7 @@ bool LoadLog::LoadSNSText() { auto p = new TimeSeriesProperty<double>(names[i]); if (units.size() == numCols) p->setUnits(units[i]); - props.push_back(p); + props.emplace_back(p); } // Go back to start inLogFile.seekg(0); @@ -506,7 +506,7 @@ bool LoadLog::SNSTextFormatColumns(const std::string &str, if (!Strings::convert<double>(str, val)) return false; else - out.push_back(val); + out.emplace_back(val); } // Nothing failed = it is that format. return true; diff --git a/Framework/DataHandling/src/LoadMLZ.cpp b/Framework/DataHandling/src/LoadMLZ.cpp index 19ec61a37909990031d21e7d86a66803c1b36620..46e856275e2029d8cd76fdee1cbfea7e1a8f2698 100644 --- a/Framework/DataHandling/src/LoadMLZ.cpp +++ b/Framework/DataHandling/src/LoadMLZ.cpp @@ -135,7 +135,7 @@ void LoadMLZ::maskDetectors(NeXus::NXEntry &entry) { g_log.debug() << masked_detector; g_log.debug() << ", "; try { - indicesToMask.push_back(detInfo.indexOf(masked_detector)); + indicesToMask.emplace_back(detInfo.indexOf(masked_detector)); } catch (std::out_of_range &) { g_log.warning() << "Invalid detector ID " << masked_detector << ". Found while running LoadMLZ\n"; diff --git a/Framework/DataHandling/src/LoadMask.cpp b/Framework/DataHandling/src/LoadMask.cpp index cbc9fb838d698b863444288e32316dfa772b3f10..f37e142eb35d2586e0fafd71f00280ef3cabd8c9 100644 --- a/Framework/DataHandling/src/LoadMask.cpp +++ b/Framework/DataHandling/src/LoadMask.cpp @@ -75,7 +75,7 @@ void convertToVector(const std::vector<T> &singles, // expand pairs for (size_t i = 0; i < ranges.size(); i += 2) { for (T obj_id = ranges[i]; obj_id < ranges[i + 1] + 1; ++obj_id) { - tot_singles.push_back(obj_id); + tot_singles.emplace_back(obj_id); } } } @@ -122,12 +122,12 @@ void parseRangeText(const std::string &inputstr, std::vector<T> &singles, "Range string " + rawstring + " has wrong order of detectors ID!"; throw std::invalid_argument(error); } - pairs.push_back(intstart); - pairs.push_back(intend); + pairs.emplace_back(intstart); + pairs.emplace_back(intend); } else { // 3. Treat singles auto itemp = boost::lexical_cast<T>(rawstring); - singles.push_back(itemp); + singles.emplace_back(itemp); } } // ENDFOR i } @@ -189,18 +189,18 @@ void parseISISStringToVector(const std::string &ins, index = 0; while (tocontinue) { // i) push to the starting vector - ranges.push_back( + ranges.emplace_back( boost::lexical_cast<Mantid::specnum_t>(splitstrings[index])); // ii) push the ending vector if (index == splitstrings.size() - 1 || splitstrings[index + 1] != "-") { // the next one is not '-' - ranges.push_back( + ranges.emplace_back( boost::lexical_cast<Mantid::specnum_t>(splitstrings[index])); index++; } else { // the next one is '-', thus read '-', next - ranges.push_back( + ranges.emplace_back( boost::lexical_cast<Mantid::specnum_t>(splitstrings[index + 2])); index += 3; } @@ -259,9 +259,9 @@ void parseComponent(const std::string &valuetext, bool tomask, // 1. Parse bank out if (tomask) { - toMask.push_back(valuetext); + toMask.emplace_back(valuetext); } else { - toUnmask.push_back(valuetext); + toUnmask.emplace_back(valuetext); } } } // namespace @@ -451,7 +451,7 @@ void LoadMask::componentToDetectors( if (det) { detid_t detid = det->getID(); - detectors.push_back(detid); + detectors.emplace_back(detid); numdets++; if (detid < id_min) id_min = detid; @@ -498,7 +498,7 @@ void LoadMask::bankToDetectors(const std::vector<std::string> &singlebanks, for (const auto &det : idetectors) { detid_t detid = det->getID(); - detectors.push_back(detid); + detectors.emplace_back(detid); } g_log.debug() << "Number of Detectors in Bank " << singlebank << " is: " << numdets << "\nRange From: " << detid_first @@ -731,7 +731,7 @@ void LoadMask::convertSpMasksToDetIDs(const API::MatrixWorkspace &sourceWS, } // add detectors to the masked det-id list for (auto it = source_range.first; it != source_range.second; ++it) { - singleDetIds.push_back(it->second); + singleDetIds.emplace_back(it->second); } } } diff --git a/Framework/DataHandling/src/LoadMcStas.cpp b/Framework/DataHandling/src/LoadMcStas.cpp index e0f87f9a44b125384d9b75322d1d259eaec02afe..95f7fc732c5562c4cb7aac192ea69661b38d50df 100644 --- a/Framework/DataHandling/src/LoadMcStas.cpp +++ b/Framework/DataHandling/src/LoadMcStas.cpp @@ -507,7 +507,7 @@ std::vector<std::string> LoadMcStas::readHistogramData( nxFile.readData<double>(axis1Name, axis1Values); if (axis2Name.length() == 0) { axis2Name = nameAttrValueYLABEL; - axis2Values.push_back(0.0); + axis2Values.emplace_back(0.0); } else { nxFile.readData<double>(axis2Name, axis2Values); } diff --git a/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Framework/DataHandling/src/LoadMuonNexus1.cpp index d827546ed2c858d8183916b1cdee8c58416e29ce..22ed23222941768b0ec18eaaf4fcb3785c058b34 100644 --- a/Framework/DataHandling/src/LoadMuonNexus1.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus1.cpp @@ -298,8 +298,8 @@ void LoadMuonNexus1::exec() { } std::vector<int> specIDs, detecIDs; for (size_t i = 0; i < localWorkspace->getNumberHistograms(); i++) { - specIDs.push_back(localWorkspace->getSpectrum(i).getSpectrumNo()); - detecIDs.push_back(localWorkspace->getSpectrum(i).getSpectrumNo()); + specIDs.emplace_back(localWorkspace->getSpectrum(i).getSpectrumNo()); + detecIDs.emplace_back(localWorkspace->getSpectrum(i).getSpectrumNo()); } API::SpectrumDetectorMapping mapping(specIDs, detecIDs); localWorkspace->updateSpectraUsing(mapping); @@ -477,7 +477,7 @@ LoadMuonNexus1::loadDetectorGrouping(NXRoot &root, // Start from 1 to N+1 to be consistent with // the case where spectra are specified for (int i = 1; i < m_numberOfSpectra + 1; i++) - specToLoad.push_back(i); + specToLoad.emplace_back(i); } if (numGroupingEntries < m_numberOfSpectra) { @@ -525,7 +525,7 @@ LoadMuonNexus1::loadDetectorGrouping(NXRoot &root, // Multiple periods - same grouping for each specToLoad.clear(); for (int i = 1; i < m_numberOfSpectra + 1; i++) { - specToLoad.push_back(i); + specToLoad.emplace_back(i); } for (const auto &spectrum : specToLoad) { grouping.emplace_back(groupingData[spectrum - 1]); @@ -585,7 +585,7 @@ LoadMuonNexus1::loadDetectorGrouping(NXRoot &root, // Make sure it uses the right number of detectors std::ostringstream oss; oss << "1-" << m_numberOfSpectra; - dummyGrouping->groups.push_back(oss.str()); + dummyGrouping->groups.emplace_back(oss.str()); dummyGrouping->description = "Dummy grouping"; dummyGrouping->groupNames.emplace_back("all"); } @@ -637,7 +637,7 @@ LoadMuonNexus1::createDetectorGroupingTable(std::vector<int> specToLoad, for (size_t i = 0; i < specToLoad.size(); i++) { // Add detector ID to the list of group detectors. Detector ID is always // spectra index + 1 - groupingMap[grouping[i]].push_back(specToLoad[i]); + groupingMap[grouping[i]].emplace_back(specToLoad[i]); } for (auto &group : groupingMap) { diff --git a/Framework/DataHandling/src/LoadMuonNexus2.cpp b/Framework/DataHandling/src/LoadMuonNexus2.cpp index 2b9d5a93837b22e44f26088f3b6f238f0bcc3372..58ad6f2b99c267a5287c21a39bf712dae8c97708 100644 --- a/Framework/DataHandling/src/LoadMuonNexus2.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus2.cpp @@ -156,7 +156,7 @@ void LoadMuonNexus2::doExec() { int nBins = raw_time.dim0(); std::vector<double> timeBins; timeBins.assign(raw_time(), raw_time() + nBins); - timeBins.push_back(raw_time[nBins - 1] + raw_time[1] - raw_time[0]); + timeBins.emplace_back(raw_time[nBins - 1] + raw_time[1] - raw_time[0]); // Calculate the size of a workspace, given its number of periods & spectra to // read diff --git a/Framework/DataHandling/src/LoadNGEM.cpp b/Framework/DataHandling/src/LoadNGEM.cpp index 092b73e5ed2463294f169d085777558ec4d7ad94..3c31e52297b2152ee73e671330246c6d9333bd5c 100644 --- a/Framework/DataHandling/src/LoadNGEM.cpp +++ b/Framework/DataHandling/src/LoadNGEM.cpp @@ -106,7 +106,7 @@ void createEventWorkspace(const int &maxToF, const double &binWidth, // Round up number of bins needed and reserve the space in the vector. xAxis.reserve(int(std::ceil(maxToF / binWidth))); for (auto i = 0; i < (maxToF / binWidth); i++) { - xAxis.push_back(i * binWidth); + xAxis.emplace_back(i * binWidth); } dataWorkspace = DataObjects::create<DataObjects::EventWorkspace>( diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index 9162a9df98a5da6137babb001cacaaf3d2e81590..fa37dd5678f11c8d19985f73cc149426f61a57ec 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -354,8 +354,8 @@ void LoadNexusLogs::exec() { plog->timesAsVector(); std::vector<double> plogv = plog->valuesAsVector(); for (auto number : event_frame_number) { - ptime.push_back(plogt[number]); - pval.push_back(plogv[number]); + ptime.emplace_back(plogt[number]); + pval.emplace_back(plogv[number]); } pcharge->create(ptime, pval); pcharge->setUnits("uAh"); diff --git a/Framework/DataHandling/src/LoadNexusMonitors2.cpp b/Framework/DataHandling/src/LoadNexusMonitors2.cpp index 142d94decb3bc66921e60ff36d5163bf93583762..60a4e9a00593210f22ce14426a98dff6da584c9c 100644 --- a/Framework/DataHandling/src/LoadNexusMonitors2.cpp +++ b/Framework/DataHandling/src/LoadNexusMonitors2.cpp @@ -583,7 +583,7 @@ size_t LoadNexusMonitors2::getMonitorInfo(::NeXus::File &file, } file.closeGroup(); // close NXmonitor - m_monitorInfo.push_back(info); + m_monitorInfo.emplace_back(info); } prog2.report(); } @@ -646,12 +646,12 @@ bool LoadNexusMonitors2::createOutputWorkspace( if (useEventMon) { // load event for (size_t i_mon = 0; i_mon < m_monitor_count; ++i_mon) { - loadMonitorFlags.push_back(m_monitorInfo[i_mon].hasEvent); + loadMonitorFlags.emplace_back(m_monitorInfo[i_mon].hasEvent); } } else { // load histogram for (size_t i_mon = 0; i_mon < m_monitor_count; ++i_mon) { - loadMonitorFlags.push_back(m_monitorInfo[i_mon].hasHisto); + loadMonitorFlags.emplace_back(m_monitorInfo[i_mon].hasHisto); } } diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp index 8a6b70fb81b4cb5ff056c78093a3e4ef572767b2..b84ad04c3e5cf9e857abca6227ca684cc3bf48fd 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -1000,7 +1000,7 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) { } // store column names - columnNames.push_back(str); + columnNames.emplace_back(str); // determine number of peaks // here we assume that a peaks_table has always one column of doubles diff --git a/Framework/DataHandling/src/LoadNexusProcessed2.cpp b/Framework/DataHandling/src/LoadNexusProcessed2.cpp index 87be902bfd3c45c6558ff96016758dc536d250cc..0f2c075897fad50c22bcc496d91ae00335e649f4 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed2.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed2.cpp @@ -44,7 +44,7 @@ findEntriesOfType(const T &entry, const std::string &nxClass) { std::vector<Mantid::NeXus::NXClassInfo> result; for (const auto &group : entry.groups()) { if (group.nxclass == nxClass) - result.push_back(group); + result.emplace_back(group); } return result; } @@ -217,7 +217,7 @@ bool LoadNexusProcessed2::loadNexusGeometry(API::Workspace &ws, for (size_t j = 0; j < counts; ++j, ++detCounter) { def.add(detInfo.indexOf(m_detectorIds[detCounter])); } - definitions.push_back(def); + definitions.emplace_back(def); } info.setSpectrumDefinitions(definitions); matrixWs->setIndexInfo(info); diff --git a/Framework/DataHandling/src/LoadPDFgetNFile.cpp b/Framework/DataHandling/src/LoadPDFgetNFile.cpp index 0fee26e0df59216a7e27dd013f2540add1a2f613..0f6c63c80546f07f565edf54ae000bd66483cf9c 100644 --- a/Framework/DataHandling/src/LoadPDFgetNFile.cpp +++ b/Framework/DataHandling/src/LoadPDFgetNFile.cpp @@ -136,7 +136,7 @@ void LoadPDFgetNFile::parseDataFile(std::string filename) { size_t numcols = mColumnNames.size(); for (size_t i = 0; i < numcols; ++i) { std::vector<double> tempvec; - mData.push_back(tempvec); + mData.emplace_back(tempvec); } } else if (readdata) { @@ -207,7 +207,7 @@ void LoadPDFgetNFile::parseColumnNameLine(std::string line) { stringstream msgss; msgss << "Column Names: "; for (size_t i = 0; i < numcols; ++i) { - this->mColumnNames.push_back(terms[i + 1]); + this->mColumnNames.emplace_back(terms[i + 1]); msgss << setw(-3) << i << ": " << setw(-10) << mColumnNames[i]; } g_log.information() << msgss.str() << '\n'; @@ -252,7 +252,7 @@ void LoadPDFgetNFile::parseDataLine(string line) { tempvalue = std::stod(temps); } - mData[i].push_back(tempvalue); + mData[i].emplace_back(tempvalue); } } @@ -301,7 +301,7 @@ size_t calcVecSize(const std::vector<double> &data0, // X in descending order and hit the end of one set of data // Record the current data set information and start the next data set numsets += 1; - numptsvec.push_back(vecsize); + numptsvec.emplace_back(vecsize); vecsize = 1; } else { // In the middle of a set of data @@ -361,7 +361,7 @@ void LoadPDFgetNFile::generateDataWorkspace() { // Record the last data set information ++numsets; - numptsvec.push_back(calcVecSize(mData[0], numptsvec, numsets, xascend)); + numptsvec.emplace_back(calcVecSize(mData[0], numptsvec, numsets, xascend)); checkSameSize(numptsvec, numsets); diff --git a/Framework/DataHandling/src/LoadPLN.cpp b/Framework/DataHandling/src/LoadPLN.cpp index c3cb48e764a9e5b4644160ebc8a5312c0df12824..416d4d4a3557fdc7805e25f2d2c116340917bcc5 100644 --- a/Framework/DataHandling/src/LoadPLN.cpp +++ b/Framework/DataHandling/src/LoadPLN.cpp @@ -422,7 +422,7 @@ protected: m_tofMax = tof; auto ev = Types::Event::TofEvent(tof, Types::Core::DateAndTime(offset)); - m_eventVectors[id]->push_back(ev); + m_eventVectors[id]->emplace_back(ev); } public: diff --git a/Framework/DataHandling/src/LoadPSIMuonBin.cpp b/Framework/DataHandling/src/LoadPSIMuonBin.cpp index 07248e448762d629d54dba4ac72e176b32425eae..cad149ce738d4856e3c108833c7fff7d86fd684a 100644 --- a/Framework/DataHandling/src/LoadPSIMuonBin.cpp +++ b/Framework/DataHandling/src/LoadPSIMuonBin.cpp @@ -393,16 +393,17 @@ void LoadPSIMuonBin::generateUnknownAxis() { // Create a x axis, assumption that m_histograms will all be the same size, // and that x will be 1 more in size than y for (auto xIndex = 0u; xIndex <= m_histograms[0].size(); ++xIndex) { - m_xAxis.push_back(static_cast<double>(xIndex) * m_header.histogramBinWidth); + m_xAxis.emplace_back(static_cast<double>(xIndex) * + m_header.histogramBinWidth); } // Create Errors for (const auto &histogram : m_histograms) { std::vector<double> newEAxis; for (auto eIndex = 0u; eIndex < m_histograms[0].size(); ++eIndex) { - newEAxis.push_back(sqrt(histogram[eIndex])); + newEAxis.emplace_back(sqrt(histogram[eIndex])); } - m_eAxis.push_back(newEAxis); + m_eAxis.emplace_back(newEAxis); } } diff --git a/Framework/DataHandling/src/LoadPreNexus.cpp b/Framework/DataHandling/src/LoadPreNexus.cpp index 118fe67566c1814541f08f2d434436ad5be62592..bd0e5c8407fdbb5a577e8e9e5e43575196813ce1 100644 --- a/Framework/DataHandling/src/LoadPreNexus.cpp +++ b/Framework/DataHandling/src/LoadPreNexus.cpp @@ -235,7 +235,7 @@ void LoadPreNexus::parseRuninfo(const string &runinfo, string &dataDir, while (pNode) { if (pNode->nodeName() == "scattering") { auto *element = static_cast<Poco::XML::Element *>(pNode); - eventFilenames.push_back(element->getAttribute("name")); + eventFilenames.emplace_back(element->getAttribute("name")); } pNode = pNode->nextSibling(); } @@ -280,14 +280,14 @@ void LoadPreNexus::runLoadNexusLogs(const string &runinfo, // put together a list of possible locations vector<string> possibilities; - possibilities.push_back(dataDir + shortName + - "_event.nxs"); // next to runinfo - possibilities.push_back(dataDir + shortName + "_histo.nxs"); - possibilities.push_back(dataDir + shortName + ".nxs"); - possibilities.push_back(dataDir + "../NeXus/" + shortName + - "_event.nxs"); // in NeXus directory - possibilities.push_back(dataDir + "../NeXus/" + shortName + "_histo.nxs"); - possibilities.push_back(dataDir + "../NeXus/" + shortName + ".nxs"); + possibilities.emplace_back(dataDir + shortName + + "_event.nxs"); // next to runinfo + possibilities.emplace_back(dataDir + shortName + "_histo.nxs"); + possibilities.emplace_back(dataDir + shortName + ".nxs"); + possibilities.emplace_back(dataDir + "../NeXus/" + shortName + + "_event.nxs"); // in NeXus directory + possibilities.emplace_back(dataDir + "../NeXus/" + shortName + "_histo.nxs"); + possibilities.emplace_back(dataDir + "../NeXus/" + shortName + ".nxs"); // run the algorithm bool loadedLogs = false; diff --git a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp index 3e96bff20aede7965aa461fea9125b6598f1ff84..5b2b81a994b403d2788ec7bc26c923d22f47ced0 100644 --- a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp +++ b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp @@ -143,9 +143,9 @@ void LoadPreNexusMonitors::exec() { if (pDataListChildren->item(i)->nodeName() == "monitor") { auto *element = static_cast<Poco::XML::Element *>(pDataListChildren->item(i)); - monitorIDs.push_back( + monitorIDs.emplace_back( boost::lexical_cast<int>(element->getAttribute("id"))); - monitorFilenames.push_back(element->getAttribute("name")); + monitorFilenames.emplace_back(element->getAttribute("name")); } } } diff --git a/Framework/DataHandling/src/LoadRKH.cpp b/Framework/DataHandling/src/LoadRKH.cpp index 057587836e536b7f004bdae189098eff3cc166ec..62b710e177d4bb2c652c409dde55a315dfcfb6b7 100644 --- a/Framework/DataHandling/src/LoadRKH.cpp +++ b/Framework/DataHandling/src/LoadRKH.cpp @@ -95,15 +95,15 @@ void LoadRKH::readLinesForRKH1D(std::istream &stream, int readStart, std::istringstream datastr(fileline); datastr >> xValue >> yValue >> yErrorValue; - xData.push_back(xValue); - yData.push_back(yValue); - yError.push_back(yErrorValue); + xData.emplace_back(xValue); + yData.emplace_back(yValue); + yError.emplace_back(yErrorValue); // check if we need to read in x error values if (readXError) { double xErrorValue(0.); datastr >> xErrorValue; - xError.push_back(xErrorValue); + xError.emplace_back(xErrorValue); } prog.report(); diff --git a/Framework/DataHandling/src/LoadRawBin0.cpp b/Framework/DataHandling/src/LoadRawBin0.cpp index 93234ba714b59487d4fb059cb66aeeb28da3508c..d14d8d56d001ab995b975776167728ab2fe5453f 100644 --- a/Framework/DataHandling/src/LoadRawBin0.cpp +++ b/Framework/DataHandling/src/LoadRawBin0.cpp @@ -91,7 +91,7 @@ void LoadRawBin0::exec() { // no real X values for bin 0,so initialize this to zero auto channelsVec = boost::make_shared<HistogramData::HistogramX>(1, 0); - m_timeChannelsVec.push_back(channelsVec); + m_timeChannelsVec.emplace_back(channelsVec); auto histTotal = static_cast<double>(m_total_specs * m_numberOfPeriods); int64_t histCurrent = -1; diff --git a/Framework/DataHandling/src/LoadRawHelper.cpp b/Framework/DataHandling/src/LoadRawHelper.cpp index 47f300714ae38e28165cb2ac2393e9a0abed3431..40437f212c538ab7f737b17660c10cd865831db0 100644 --- a/Framework/DataHandling/src/LoadRawHelper.cpp +++ b/Framework/DataHandling/src/LoadRawHelper.cpp @@ -455,7 +455,7 @@ LoadRawHelper::getmonitorSpectrumList(const SpectrumDetectorMapping &mapping) { if (std::find(m_monitordetectorList.begin(), m_monitordetectorList.end(), detID) != m_monitordetectorList.end()) { - spectrumIndices.push_back(SpectrumDetectorPair.first); + spectrumIndices.emplace_back(SpectrumDetectorPair.first); } } } @@ -514,7 +514,7 @@ LoadRawHelper::getTimeChannels(const int64_t ®imes, std::transform(channelsVec->begin(), channelsVec->end(), channelsVec->begin(), std::bind(std::plus<double>(), _1, shift)); - timeChannelsVec.push_back(channelsVec); + timeChannelsVec.emplace_back(channelsVec); } // In this case, also need to populate the map of spectrum-regime // correspondence @@ -531,7 +531,7 @@ LoadRawHelper::getTimeChannels(const int64_t ®imes, { boost::shared_ptr<HistogramData::HistogramX> channelsVec( new HistogramData::HistogramX(timeChannels, timeChannels + lengthIn)); - timeChannelsVec.push_back(channelsVec); + timeChannelsVec.emplace_back(channelsVec); } // Done with the timeChannels C array so clean up delete[] timeChannels; diff --git a/Framework/DataHandling/src/LoadSESANS.cpp b/Framework/DataHandling/src/LoadSESANS.cpp index 6f40cc7efd0e0892039496df9142821fa344f484..d22254c24602d7be380b0ae433de8528ea9b4a41 100644 --- a/Framework/DataHandling/src/LoadSESANS.cpp +++ b/Framework/DataHandling/src/LoadSESANS.cpp @@ -275,7 +275,7 @@ ColumnMap LoadSESANS::consumeData(std::ifstream &infile, std::string &line, boost::split(tokens, line, isspace, boost::token_compress_on); for (size_t i = 0; i < tokens.size(); i++) - columns[columnHeaders[i]].push_back(std::stod(tokens[i])); + columns[columnHeaders[i]].emplace_back(std::stod(tokens[i])); } else { g_log.warning("Line " + std::to_string(lineNum) + " discarded, as it was badly formed. Expected " + diff --git a/Framework/DataHandling/src/LoadSassena.cpp b/Framework/DataHandling/src/LoadSassena.cpp index 31c095cc8b03cb117d3bf4033e034b268654cc3c..f1d53337aad52ad0d62da8a223b05ee6637f4d01 100644 --- a/Framework/DataHandling/src/LoadSassena.cpp +++ b/Framework/DataHandling/src/LoadSassena.cpp @@ -136,7 +136,7 @@ LoadSassena::loadQvectors(const hid_t &h5file, API::WorkspaceGroup_sptr gws, qvmod.reserve(nq); for (auto curr = buf.cbegin(); curr != buf.cend(); curr += 3) { - qvmod.push_back( + qvmod.emplace_back( sqrt(curr[0] * curr[0] + curr[1] * curr[1] + curr[2] * curr[2])); } @@ -147,11 +147,11 @@ LoadSassena::loadQvectors(const hid_t &h5file, API::WorkspaceGroup_sptr gws, qvmodpair.emplace_back(qvmod[iq], iq); std::sort(qvmodpair.begin(), qvmodpair.end(), compare); for (int iq = 0; iq < nq; iq++) - sorting_indexes.push_back(qvmodpair[iq].second); + sorting_indexes.emplace_back(qvmodpair[iq].second); std::sort(qvmod.begin(), qvmod.end()); } else for (int iq = 0; iq < nq; iq++) - sorting_indexes.push_back(iq); + sorting_indexes.emplace_back(iq); DataObjects::Workspace2D_sptr ws = boost::dynamic_pointer_cast<DataObjects::Workspace2D>( @@ -395,7 +395,7 @@ void LoadSassena::exec() { int nvalidSets = 4; const char *validSets[] = {"fq", "fq0", "fq2", "fqt"}; for (int iSet = 0; iSet < nvalidSets; iSet++) - this->m_validSets.push_back(validSets[iSet]); + this->m_validSets.emplace_back(validSets[iSet]); // open the HDF5 file for reading m_filename = this->getPropertyValue("Filename"); diff --git a/Framework/DataHandling/src/LoadSpec.cpp b/Framework/DataHandling/src/LoadSpec.cpp index 146dee8a31e3c8692935695e0f415996581d3ada..be236c9d7de739c3534c91c6db70760bb3cc5409 100644 --- a/Framework/DataHandling/src/LoadSpec.cpp +++ b/Framework/DataHandling/src/LoadSpec.cpp @@ -168,11 +168,11 @@ void LoadSpec::readHistogram(const std::vector<double> &input, e.reserve(nElements); for (size_t index = 0; index < nElements; index++) { - x.push_back(input[index]); + x.emplace_back(input[index]); index++; - y.push_back(input[index]); + y.emplace_back(input[index]); index++; - e.push_back(input[index]); + e.emplace_back(input[index]); } histogram.resize(y.size()); @@ -180,7 +180,7 @@ void LoadSpec::readHistogram(const std::vector<double> &input, if (isHist) { // we're loading binned data // last value is final x bin - x.push_back(input.back()); + x.emplace_back(input.back()); histogram.setBinEdges(x); } else { histogram.setPoints(x); diff --git a/Framework/DataHandling/src/LoadSpice2D.cpp b/Framework/DataHandling/src/LoadSpice2D.cpp index 7d8941c14a19a7417d8725839cf207ebac90da31..cd6e533e977d10bb7eb00bd1bdd461cd61ef3fb7 100644 --- a/Framework/DataHandling/src/LoadSpice2D.cpp +++ b/Framework/DataHandling/src/LoadSpice2D.cpp @@ -341,7 +341,7 @@ std::vector<int> LoadSpice2D::getData(const std::string &dataXpath = "//Data") { std::stringstream iss(data_str); double number; while (iss >> number) { - data.push_back(static_cast<int>(number)); + data.emplace_back(static_cast<int>(number)); } g_log.debug() << "Detector XPath: " << detectorXpath << " parsed. Total size of data processed up to now = " @@ -441,13 +441,13 @@ void LoadSpice2D::setBeamTrapRunProperty( double trapDiameterInUse = trapDiameters[1]; std::vector<double> trapMotorPositions; - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(metadata["Motor_Positions/trap_y_25mm"])); - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(metadata["Motor_Positions/trap_y_50mm"])); - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(metadata["Motor_Positions/trap_y_76mm"])); - trapMotorPositions.push_back( + trapMotorPositions.emplace_back( boost::lexical_cast<double>(metadata["Motor_Positions/trap_y_101mm"])); // Check how many traps are in use (store indexes): @@ -455,7 +455,7 @@ void LoadSpice2D::setBeamTrapRunProperty( for (size_t i = 0; i < trapMotorPositions.size(); i++) { if (trapMotorPositions[i] > 26.0) { // Resting positions are below 25. Make sure we have one trap in use! - trapIndexInUse.push_back(i); + trapIndexInUse.emplace_back(i); } } diff --git a/Framework/DataHandling/src/LoadSpiceAscii.cpp b/Framework/DataHandling/src/LoadSpiceAscii.cpp index e34a245cedd865ce953a0711c871549971ce6888..1e5322cc1e96b813d7b1d224e1fab6aca34db30c 100644 --- a/Framework/DataHandling/src/LoadSpiceAscii.cpp +++ b/Framework/DataHandling/src/LoadSpiceAscii.cpp @@ -193,9 +193,9 @@ bool LoadSpiceAscii::validateLogNamesType( const std::vector<std::string> &intlognames, const std::vector<std::string> &strlognames) { std::vector<std::vector<std::string>> vec_lognamelist; - vec_lognamelist.push_back(floatlognames); - vec_lognamelist.push_back(intlognames); - vec_lognamelist.push_back(strlognames); + vec_lognamelist.emplace_back(floatlognames); + vec_lognamelist.emplace_back(intlognames); + vec_lognamelist.emplace_back(strlognames); // Check whther there is any intersction among 3 sets bool hascommon = false; @@ -301,7 +301,7 @@ void LoadSpiceAscii::parseSPICEAscii( std::vector<std::string> terms; boost::split(terms, line, boost::is_any_of(" \t\n"), boost::token_compress_on); - datalist.push_back(terms); + datalist.emplace_back(terms); } } diff --git a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp index 35f4b7bc9cb8889a309c3cfa7c31b8d4fb7708a9..84d48ef9292c10725a2a80a8d290a046f2b89b48 100644 --- a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp +++ b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp @@ -168,8 +168,8 @@ const std::string LoadSpiceXML2DDet::summary() const { */ void LoadSpiceXML2DDet::init() { std::vector<std::string> exts; - exts.push_back(".xml"); - exts.push_back(".bin"); + exts.emplace_back(".xml"); + exts.emplace_back(".bin"); declareProperty( std::make_unique<FileProperty>("Filename", "", FileProperty::FileAction::Load, exts), @@ -426,7 +426,7 @@ LoadSpiceXML2DDet::xmlParseSpice(const std::string &xmlfilename) { std::string attvalue = pNode->attributes()->item(j)->innerText(); SpiceXMLNode xmlnode(attname); xmlnode.setValue(attvalue); - vecspicenode.push_back(xmlnode); + vecspicenode.emplace_back(xmlnode); g_log.debug() << "SPICErack attribute " << j << " Name = " << attname << ", Value = " << attvalue << "\n"; } @@ -462,7 +462,7 @@ LoadSpiceXML2DDet::xmlParseSpice(const std::string &xmlfilename) { xmlnode.setParameters(nodetype, nodeunit, nodedescription); xmlnode.setValue(innertext); - vecspicenode.push_back(xmlnode); + vecspicenode.emplace_back(xmlnode); } else { // An unexpected case but no guarantee for not happening g_log.error("Funny... No child node."); diff --git a/Framework/DataHandling/src/LoadSwans.cpp b/Framework/DataHandling/src/LoadSwans.cpp index 2d58fec46b745624e71eee11d2479756659aa2d0..fd920544c289f9db828119f1d9aceb3320fa8015 100644 --- a/Framework/DataHandling/src/LoadSwans.cpp +++ b/Framework/DataHandling/src/LoadSwans.cpp @@ -183,7 +183,7 @@ std::map<uint32_t, std::vector<uint32_t>> LoadSwans::loadData() { continue; } pos -= 400000; - eventMap[pos].push_back(tof); + eventMap[pos].emplace_back(tof); } return eventMap; } diff --git a/Framework/DataHandling/src/LoadTBL.cpp b/Framework/DataHandling/src/LoadTBL.cpp index e44e1c852e6f116683f358c1719d5f8b5cbd5bcc..1a13221e1807ea618236cb224b855a3999b4af4c 100644 --- a/Framework/DataHandling/src/LoadTBL.cpp +++ b/Framework/DataHandling/src/LoadTBL.cpp @@ -113,9 +113,9 @@ LoadTBL::findQuotePairs(std::string line, quoteTwo = line.find('"', quoteOne + 1); if (quoteTwo != std::string::npos) { std::vector<size_t> quotepair; - quotepair.push_back(quoteOne); - quotepair.push_back(quoteTwo); - quoteBounds.push_back(quotepair); + quotepair.emplace_back(quoteOne); + quotepair.emplace_back(quoteTwo); + quoteBounds.emplace_back(quotepair); } } } @@ -154,24 +154,25 @@ void LoadTBL::csvParse(std::string line, std::vector<std::string> &cols, if (pairID < quoteBounds.size() && pos > quoteBounds.at(pairID).at(0)) { if (pos > quoteBounds.at(pairID).at(1)) { // use the quote indexes to get the substring - cols.push_back(line.substr(quoteBounds.at(pairID).at(0) + 1, - quoteBounds.at(pairID).at(1) - - (quoteBounds.at(pairID).at(0) + 1))); + cols.emplace_back( + line.substr(quoteBounds.at(pairID).at(0) + 1, + quoteBounds.at(pairID).at(1) - + (quoteBounds.at(pairID).at(0) + 1))); ++pairID; } } else { if (firstCell) { - cols.push_back(line.substr(0, pos)); + cols.emplace_back(line.substr(0, pos)); firstCell = false; } else { auto colVal = line.substr(lastComma + 1, pos - (lastComma + 1)); - cols.push_back(line.substr(lastComma + 1, pos - (lastComma + 1))); + cols.emplace_back(line.substr(lastComma + 1, pos - (lastComma + 1))); } } lastComma = pos; } else { if (lastComma + 1 < line.length()) { - cols.push_back(line.substr(lastComma + 1)); + cols.emplace_back(line.substr(lastComma + 1)); } else { cols.emplace_back(""); } diff --git a/Framework/DataHandling/src/LoadTOFRawNexus.cpp b/Framework/DataHandling/src/LoadTOFRawNexus.cpp index 17ce59df5b42db4b8b95a66971af320a599935e6..a7293f402c4e0ab1264b0a93cc57dbc9efa10d4a 100644 --- a/Framework/DataHandling/src/LoadTOFRawNexus.cpp +++ b/Framework/DataHandling/src/LoadTOFRawNexus.cpp @@ -202,7 +202,7 @@ void LoadTOFRawNexus::countPixels(const std::string &nexusfilename, const auto bankEntries = file.getEntries(); if (bankEntries.find("pixel_id") != bankEntries.end()) { - bankNames.push_back(name); + bankNames.emplace_back(name); // Count how many pixels in the bank file.openData("pixel_id"); @@ -216,7 +216,7 @@ void LoadTOFRawNexus::countPixels(const std::string &nexusfilename, m_numPixels += newPixels; } } else { - bankNames.push_back(name); + bankNames.emplace_back(name); // Get the number of pixels from the offsets arrays file.openData("x_pixel_offset"); @@ -351,7 +351,7 @@ void LoadTOFRawNexus::loadBank(const std::string &nexusfilename, for (size_t i = 0; i < numX; i++) { for (size_t j = 0; j < numY; j++) { - pixel_id.push_back( + pixel_id.emplace_back( static_cast<uint32_t>(j + numY * (i + numX * bankNum))); } } diff --git a/Framework/DataHandling/src/MaskDetectors.cpp b/Framework/DataHandling/src/MaskDetectors.cpp index ed5498c1f031dd0298283d870b553ef765fedffb..37c03c2fe0dd87007946ea89886c8c665412fa80 100644 --- a/Framework/DataHandling/src/MaskDetectors.cpp +++ b/Framework/DataHandling/src/MaskDetectors.cpp @@ -413,7 +413,7 @@ void MaskDetectors::execPeaks(PeaksWorkspace_sptr WS) { std::vector<size_t> indicesToMask; for (const auto &detID : detectorList) { try { - indicesToMask.push_back(detInfo.indexOf(detID)); + indicesToMask.emplace_back(detInfo.indexOf(detID)); } catch (std::out_of_range &) { g_log.warning() << "Invalid detector ID " << detID << ". Found while running MaskDetectors\n"; @@ -436,7 +436,7 @@ void MaskDetectors::execPeaks(PeaksWorkspace_sptr WS) { for (size_t i = 0; i < maskDetInfo.size(); ++i) if (maskDetInfo.isMasked(i)) - indicesToMask.push_back(i); + indicesToMask.emplace_back(i); } } @@ -479,7 +479,7 @@ void MaskDetectors::fillIndexListFromSpectra( if (range_constrained && (ws_index < startIndex || ws_index > endIndex)) { continue; } - tmp_index.push_back(ws_index); + tmp_index.emplace_back(ws_index); } tmp_index.swap(indexList); @@ -508,7 +508,7 @@ void MaskDetectors::appendToIndexListFromWS( for (size_t i = startIndex; i <= endIndex; ++i) { if (spectrumInfo.hasDetectors(i) && spectrumInfo.isMasked(i)) { - tmp_index.push_back(i); + tmp_index.emplace_back(i); } } } else { @@ -517,7 +517,7 @@ void MaskDetectors::appendToIndexListFromWS( endIndex = sourceWS->getNumberHistograms(); for (size_t i = 0; i < endIndex; ++i) { if (spectrumInfo.hasDetectors(i) && spectrumInfo.isMasked(i)) { - tmp_index.push_back(i); + tmp_index.emplace_back(i); } } } @@ -550,7 +550,7 @@ void MaskDetectors::appendToDetectorListFromWS( const auto &spec = maskWs->getSpectrum(i); for (const auto &id : spec.getDetectorIDs()) { if (detMap.at(id) >= startIndex && detMap.at(id) <= endIndex) - detectorList.push_back(id); + detectorList.emplace_back(id); } } } @@ -582,7 +582,7 @@ void MaskDetectors::appendToIndexListFromMaskWS( for (size_t i = startIndex; i <= endIndex; ++i) { if (maskedWorkspace->y(i)[0] > 0.5) { g_log.debug() << "Adding WorkspaceIndex " << i << " to mask.\n"; - tmp_index.push_back(i); + tmp_index.emplace_back(i); } } } else { @@ -592,7 +592,7 @@ void MaskDetectors::appendToIndexListFromMaskWS( if (maskedWorkspace->y(i)[0] > 0.5) { g_log.debug() << "Adding WorkspaceIndex " << i << " to mask.\n"; - tmp_index.push_back(i); + tmp_index.emplace_back(i); } } } diff --git a/Framework/DataHandling/src/NexusTester.cpp b/Framework/DataHandling/src/NexusTester.cpp index 36e18c5b2b250add7681a9093db139f1c53ad5b6..4aeef600cf38813150de7123306fea306c570280 100644 --- a/Framework/DataHandling/src/NexusTester.cpp +++ b/Framework/DataHandling/src/NexusTester.cpp @@ -113,9 +113,9 @@ void NexusTester::exec() { } std::vector<int64_t> dims; - dims.push_back(int64_t(chunkSize) * NumChunks); + dims.emplace_back(int64_t(chunkSize) * NumChunks); std::vector<int64_t> chunkDims; - chunkDims.push_back(int64_t(chunkSize)); + chunkDims.emplace_back(int64_t(chunkSize)); // Total size in BYTES double dataSizeMB = @@ -132,7 +132,7 @@ void NexusTester::exec() { CPUTimer tim; for (int i = 0; i < NumChunks; i++) { std::vector<int64_t> startDims; - startDims.push_back(i * int64_t(chunkSize)); + startDims.emplace_back(i * int64_t(chunkSize)); file.putSlab(fakeData, startDims, chunkDims); prog.report(); } @@ -171,7 +171,7 @@ void NexusTester::exec() { for (int i = 0; i < NumChunks; i++) { file.openData("FakeData"); std::vector<int64_t> startDims; - startDims.push_back(i * int64_t(chunkSize)); + startDims.emplace_back(i * int64_t(chunkSize)); file.getSlab(fakeData, startDims, chunkDims); prog.report(); file.closeData(); diff --git a/Framework/DataHandling/src/PDLoadCharacterizations.cpp b/Framework/DataHandling/src/PDLoadCharacterizations.cpp index 1b1207bee3c7799b17d709346cdaf6e46eb75262..ee65146cd9e59df09a37a911e4b9ade867665778 100644 --- a/Framework/DataHandling/src/PDLoadCharacterizations.cpp +++ b/Framework/DataHandling/src/PDLoadCharacterizations.cpp @@ -335,17 +335,18 @@ int PDLoadCharacterizations::readFocusInfo(std::ifstream &file, lexical_cast<double>(splitted[1], filename, linenum, "l1")); break; } else if (splitted.size() >= 3) { // specid, L2, theta - specIds.push_back(lexical_cast<int32_t>(splitted[0], filename, linenum, - "spectrum number")); - l2.push_back(lexical_cast<double>(splitted[1], filename, linenum, "l2")); - polar.push_back( + specIds.emplace_back(lexical_cast<int32_t>(splitted[0], filename, linenum, + "spectrum number")); + l2.emplace_back( + lexical_cast<double>(splitted[1], filename, linenum, "l2")); + polar.emplace_back( lexical_cast<double>(splitted[2], filename, linenum, "polar")); if (splitted.size() >= 4 && (!splitted[3].empty())) { // azimuthal was specified - azi.push_back( + azi.emplace_back( lexical_cast<double>(splitted[3], filename, linenum, "azimuthal")); } else { // just set it to zero - azi.push_back(0.); + azi.emplace_back(0.); } } } @@ -402,7 +403,7 @@ void PDLoadCharacterizations::readCharInfo(std::ifstream &file, boost::split(splitted, line, boost::is_any_of("\t "), boost::token_compress_on); while (splitted.size() < 12) - splitted.push_back(ZERO); // extra values default to zero + splitted.emplace_back(ZERO); // extra values default to zero // add the row API::TableRow row = wksp->appendRow(); diff --git a/Framework/DataHandling/src/PatchBBY.cpp b/Framework/DataHandling/src/PatchBBY.cpp index 7e6954d5c90686f94e56097886c9243a2152bf8c..ab695d1a070457933d67fd37e2a5123bee4635f1 100644 --- a/Framework/DataHandling/src/PatchBBY.cpp +++ b/Framework/DataHandling/src/PatchBBY.cpp @@ -98,7 +98,7 @@ void PatchBBY::init() { // Declare the Filename algorithm property. Mandatory. Sets the path to the // file to load. exts.clear(); - exts.push_back(".tar"); + exts.emplace_back(".tar"); declareProperty(std::make_unique<API::FileProperty>( FilenameStr, "", API::FileProperty::Load, exts), "The filename of the stored data to be patched"); diff --git a/Framework/DataHandling/src/SaveAscii.cpp b/Framework/DataHandling/src/SaveAscii.cpp index 9168ba3cf59946c3eed686108aea2805eb7b9d1b..ec718bc25528250ed1ae8b0fc270679ddd08b4f4 100644 --- a/Framework/DataHandling/src/SaveAscii.cpp +++ b/Framework/DataHandling/src/SaveAscii.cpp @@ -69,7 +69,7 @@ void SaveAscii::init() { std::string option = spacer[0]; m_separatorIndex.insert( std::pair<std::string, std::string>(option, spacer[1])); - sepOptions.push_back(option); + sepOptions.emplace_back(option); } declareProperty("Separator", "CSV", diff --git a/Framework/DataHandling/src/SaveAscii2.cpp b/Framework/DataHandling/src/SaveAscii2.cpp index 99c96d2d51f619f7cf8c7f992258ad2dacc96271..fab6e66fffee6d0a258b62cd72a2f382b63ab56e 100644 --- a/Framework/DataHandling/src/SaveAscii2.cpp +++ b/Framework/DataHandling/src/SaveAscii2.cpp @@ -89,7 +89,7 @@ void SaveAscii2::init() { std::string option = spacer[0]; m_separatorIndex.insert( std::pair<std::string, std::string>(option, spacer[1])); - sepOptions.push_back(option); + sepOptions.emplace_back(option); } declareProperty("Separator", "CSV", @@ -393,7 +393,7 @@ void SaveAscii2::populateQMetaData() { // Convert to MomentumTransfer auto qValue = Kernel::UnitConversion::convertToElasticQ(theta, efixed); auto qValueStr = boost::lexical_cast<std::string>(qValue); - qValues.push_back(qValueStr); + qValues.emplace_back(qValueStr); } m_metaDataMap["q"] = qValues; } @@ -407,7 +407,7 @@ void SaveAscii2::populateSpectrumNumberMetaData() { for (size_t i = 0; i < nHist; i++) { const auto specNum = m_ws->getSpectrum(i).getSpectrumNo(); const auto specNumStr = std::to_string(specNum); - spectrumNumbers.push_back(specNumStr); + spectrumNumbers.emplace_back(specNumStr); } m_metaDataMap["spectrumnumber"] = spectrumNumbers; } @@ -424,7 +424,7 @@ void SaveAscii2::populateAngleMetaData() { constexpr double rad2deg = 180. / M_PI; const auto angleInDeg = two_theta * rad2deg; const auto angleInDegStr = boost::lexical_cast<std::string>(angleInDeg); - angles.push_back(angleInDegStr); + angles.emplace_back(angleInDegStr); } m_metaDataMap["angle"] = angles; } diff --git a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp index 48f9970cf0f270461ef6e32a24aba31ff87b8fd2..669ff7626bf3ab469cef886eee2eef2698bd6e4e 100644 --- a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp +++ b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp @@ -125,16 +125,16 @@ void SaveDetectorsGrouping::convertToDetectorsRanges( ed = detid; } else { // broken: (1) store (2) start new - detranges.push_back(st); - detranges.push_back(ed); + detranges.emplace_back(st); + detranges.emplace_back(ed); st = detid; ed = detid; } } // ENDFOR detectors // Complete the uncompleted - detranges.push_back(st); - detranges.push_back(ed); + detranges.emplace_back(st); + detranges.emplace_back(ed); // c) Save entry in output groupdetidrangemap[groupid] = detranges; diff --git a/Framework/DataHandling/src/SaveDiffFittingAscii.cpp b/Framework/DataHandling/src/SaveDiffFittingAscii.cpp index 491e2e932943c547f9a61b63db872131689d0e11..1ff23b2fb823997c4c60a5e46fb36c0e3e3acbb3 100644 --- a/Framework/DataHandling/src/SaveDiffFittingAscii.cpp +++ b/Framework/DataHandling/src/SaveDiffFittingAscii.cpp @@ -58,8 +58,8 @@ void SaveDiffFittingAscii::init() { std::vector<std::string> formats; - formats.push_back("AppendToExistingFile"); - formats.push_back("OverwriteFile"); + formats.emplace_back("AppendToExistingFile"); + formats.emplace_back("OverwriteFile"); declareProperty("OutMode", "AppendToExistingFile", boost::make_shared<Kernel::StringListValidator>(formats), "Over write the file or append data to existing file"); @@ -78,7 +78,7 @@ void SaveDiffFittingAscii::exec() { "Please provide an input table workspace to be saved."); std::vector<API::ITableWorkspace_sptr> input_ws; - input_ws.push_back( + input_ws.emplace_back( boost::dynamic_pointer_cast<DataObjects::TableWorkspace>(tbl_ws)); processAll(input_ws); @@ -96,7 +96,7 @@ bool SaveDiffFittingAscii::processGroups() { std::vector<API::ITableWorkspace_sptr> input_ws; input_ws.reserve(inputGroup->getNumberOfEntries()); for (int i = 0; i < inputGroup->getNumberOfEntries(); ++i) { - input_ws.push_back( + input_ws.emplace_back( boost::dynamic_pointer_cast<ITableWorkspace>(inputGroup->getItem(i))); } diff --git a/Framework/DataHandling/src/SaveFullprofResolution.cpp b/Framework/DataHandling/src/SaveFullprofResolution.cpp index 480efce50a3dfdd396b0cf3c6983a667068d7557..1f3ac15a050e49752013d2049aefcfea93f6f02b 100644 --- a/Framework/DataHandling/src/SaveFullprofResolution.cpp +++ b/Framework/DataHandling/src/SaveFullprofResolution.cpp @@ -58,7 +58,7 @@ void SaveFullprofResolution::init() { "Bank number of the parameters belonged to. "); vector<string> supportedfunctions; - supportedfunctions.push_back( + supportedfunctions.emplace_back( "Back-to-back exponential convoluted with pseudo-voigt (profile 9)"); supportedfunctions.emplace_back("Jason Hodge's function (profile 10)"); auto funcvalidator = diff --git a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp index a1958ed61a9e5a04be4b84d1ba92b9d3dc45ae9a..d36fa246eb29397761a11f39fa1b25eb597fb7d3 100644 --- a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp @@ -242,7 +242,7 @@ ChopperConfiguration::parseStringDbl(const string &instring) const { for (auto &str : strs) { if (!str.empty()) { double item = std::stod(str.c_str()); - vecdouble.push_back(item); + vecdouble.emplace_back(item); // cout << "[C] |" << strs[i] << "|" << item << "\n"; } } @@ -269,7 +269,7 @@ ChopperConfiguration::parseStringUnsignedInt(const string &instring) const { throw runtime_error( "Found negative number in a string for unsigned integers."); } - vecinteger.push_back(static_cast<unsigned int>(item)); + vecinteger.emplace_back(static_cast<unsigned int>(item)); } } @@ -362,7 +362,7 @@ void SaveGSASInstrumentFile::exec() { // Default is to export all banks for (auto &miter : bankprofileparammap) { unsigned int bankid = miter.first; - m_vecBankID2File.push_back(bankid); + m_vecBankID2File.emplace_back(bankid); } sort(m_vecBankID2File.begin(), m_vecBankID2File.end()); } @@ -565,7 +565,7 @@ ChopperConfiguration_sptr SaveGSASInstrumentFile::setupInstrumentConstants( map<unsigned int, map<string, double>>::const_iterator bmiter; for (bmiter = profmap.begin(); bmiter != profmap.end(); ++bmiter) { int bankid = bmiter->first; - bankids.push_back(bankid); + bankids.emplace_back(bankid); } // Create a configuration object diff --git a/Framework/DataHandling/src/SaveGSS.cpp b/Framework/DataHandling/src/SaveGSS.cpp index f56f6319e7e6db7831a5ab7f6310504655f4a5ed..ff3121a8fa55bab15ac10a73554d25ba15ffded6 100644 --- a/Framework/DataHandling/src/SaveGSS.cpp +++ b/Framework/DataHandling/src/SaveGSS.cpp @@ -542,7 +542,7 @@ void SaveGSS::generateOutFileNames(size_t numberOfOutFiles) { if (numberOfOutFiles == 1) { // Only add one name and don't generate split filenames // when we are not in split mode - m_outFileNames.push_back(outputFileName); + m_outFileNames.emplace_back(outputFileName); return; } diff --git a/Framework/DataHandling/src/SaveISISNexus.cpp b/Framework/DataHandling/src/SaveISISNexus.cpp index cec7fefa984e155f9d157cad88c602dbc702cfbc..c2b5fb00fb6c7462318da5f844e01fef6e1d7ceb 100644 --- a/Framework/DataHandling/src/SaveISISNexus.cpp +++ b/Framework/DataHandling/src/SaveISISNexus.cpp @@ -800,19 +800,19 @@ void SaveISISNexus::runlog() { boost::posix_time::ptime time( boost::posix_time::time_from_string(date_time_str)); boost::posix_time::time_duration dt = time - start_time; - time_vec.push_back(float(dt.total_seconds())); - period_vec.push_back(period); - is_running_vec.push_back(is_running); - is_waiting_vec.push_back(is_waiting); - good_frames_vec.push_back(good_frames); - raw_frames_vec.push_back(raw_frames); - monitor_sum_1_vec.push_back(monitor_sum_1); - total_counts_vec.push_back(total_counts); - proton_charge_vec.push_back(proton_charge); - proton_charge_raw_vec.push_back(proton_charge_raw); - dae_beam_current_vec.push_back(dae_beam_current); - count_rate_vec.push_back(count_rate); - np_ratio_vec.push_back(np_ratio); + time_vec.emplace_back(float(dt.total_seconds())); + period_vec.emplace_back(period); + is_running_vec.emplace_back(is_running); + is_waiting_vec.emplace_back(is_waiting); + good_frames_vec.emplace_back(good_frames); + raw_frames_vec.emplace_back(raw_frames); + monitor_sum_1_vec.emplace_back(monitor_sum_1); + total_counts_vec.emplace_back(total_counts); + proton_charge_vec.emplace_back(proton_charge); + proton_charge_raw_vec.emplace_back(proton_charge_raw); + dae_beam_current_vec.emplace_back(dae_beam_current); + count_rate_vec.emplace_back(count_rate); + np_ratio_vec.emplace_back(np_ratio); } fil.close(); @@ -872,8 +872,8 @@ void SaveISISNexus::runlog() { boost::posix_time::ptime time( boost::posix_time::time_from_string(date_time_str)); boost::posix_time::time_duration dt = time - start_time; - time_vec.push_back(float(dt.total_seconds())); - event_vec.push_back(line.substr(20)); + time_vec.emplace_back(float(dt.total_seconds())); + event_vec.emplace_back(line.substr(20)); } icpevent_fil.close(); @@ -961,7 +961,7 @@ void SaveISISNexus::selog() { l_filenamePart = Poco::Path(dir_itr->path()).getFileName(); if (boost::regex_match(l_filenamePart, regex)) { - potentialLogFiles.push_back(dir_itr->path()); + potentialLogFiles.emplace_back(dir_itr->path()); } } @@ -1007,7 +1007,7 @@ void SaveISISNexus::selog() { boost::posix_time::ptime time( boost::posix_time::time_from_string(date_time_str)); boost::posix_time::time_duration dt = time - start_time; - time_vec.push_back(float(dt.total_seconds())); + time_vec.emplace_back(float(dt.total_seconds())); std::istringstream istr(line.substr(20)); // check if the data are numeric then save them in flt_vec if (!isNotNumeric) { @@ -1016,10 +1016,10 @@ void SaveISISNexus::selog() { if (istr.bad() || istr.fail()) { isNotNumeric = true; } else { - flt_vec.push_back(flt); + flt_vec.emplace_back(flt); } } - str_vec.push_back(istr.str()); + str_vec.emplace_back(istr.str()); } fil.close(); NXmakegroup(handle, &logName[0], "IXseblock"); diff --git a/Framework/DataHandling/src/SaveMask.cpp b/Framework/DataHandling/src/SaveMask.cpp index ad2b6169121f109c4502019c6120c900e76c0de5..0db860c97baf3c9d146276469f0624ed7c62794c 100644 --- a/Framework/DataHandling/src/SaveMask.cpp +++ b/Framework/DataHandling/src/SaveMask.cpp @@ -101,8 +101,8 @@ void SaveMask::exec() { } else { // If skip: restart everything // i) record previous result - idx0sts.push_back(i0st); - idx0eds.push_back(i0ed); + idx0sts.emplace_back(i0st); + idx0eds.emplace_back(i0ed); // ii) reset the register i0st = detid0s[i]; i0ed = detid0s[i]; @@ -111,8 +111,8 @@ void SaveMask::exec() { } // for // Complete the registration - idx0sts.push_back(i0st); - idx0eds.push_back(i0ed); + idx0sts.emplace_back(i0st); + idx0eds.emplace_back(i0ed); for (size_t i = 0; i < idx0sts.size(); i++) { g_log.information() << "Section " << i << " : " << idx0sts[i] << " , " diff --git a/Framework/DataHandling/src/SaveNXTomo.cpp b/Framework/DataHandling/src/SaveNXTomo.cpp index 65ac3494b35b0c2dda0bc6ec1d1bf9c5cec6c3e4..525b39fb2d946db1f9675deac2d07e157a2f65b0 100644 --- a/Framework/DataHandling/src/SaveNXTomo.cpp +++ b/Framework/DataHandling/src/SaveNXTomo.cpp @@ -83,7 +83,7 @@ void SaveNXTomo::init() { void SaveNXTomo::exec() { try { MatrixWorkspace_sptr m = getProperty("InputWorkspaces"); - m_workspaces.push_back(boost::dynamic_pointer_cast<Workspace2D>(m)); + m_workspaces.emplace_back(boost::dynamic_pointer_cast<Workspace2D>(m)); } catch (...) { } @@ -101,7 +101,7 @@ bool SaveNXTomo::processGroups() { AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(name); for (int i = 0; i < groupWS->getNumberOfEntries(); ++i) { - m_workspaces.push_back( + m_workspaces.emplace_back( boost::dynamic_pointer_cast<Workspace2D>(groupWS->getItem(i))); } } catch (...) { @@ -136,10 +136,10 @@ void SaveNXTomo::processAll() { this->m_filename = getPropertyValue("Filename"); // Populate the dimension array - assume all are the same - m_dimensions.push_back(m_workspaces.size()); - m_dimensions.push_back(boost::lexical_cast<int64_t>( + m_dimensions.emplace_back(m_workspaces.size()); + m_dimensions.emplace_back(boost::lexical_cast<int64_t>( m_workspaces[0]->mutableRun().getLogData("Axis1")->value())); - m_dimensions.push_back(boost::lexical_cast<int64_t>( + m_dimensions.emplace_back(boost::lexical_cast<int64_t>( m_workspaces[0]->mutableRun().getLogData("Axis2")->value())); m_spectraCount = m_dimensions[1] * m_dimensions[2]; @@ -149,14 +149,14 @@ void SaveNXTomo::processAll() { m_infDimensions[0] = NX_UNLIMITED; // What size slabs are we going to write - m_slabSize.push_back(1); - m_slabSize.push_back(m_dimensions[1]); - m_slabSize.push_back(m_dimensions[2]); + m_slabSize.emplace_back(1); + m_slabSize.emplace_back(m_dimensions[1]); + m_slabSize.emplace_back(m_dimensions[2]); // Init start to first row - m_slabStart.push_back(0); - m_slabStart.push_back(0); - m_slabStart.push_back(0); + m_slabStart.emplace_back(0); + m_slabStart.emplace_back(0); + m_slabStart.emplace_back(0); ::NeXus::File nxFile = setupFile(); @@ -244,7 +244,7 @@ void SaveNXTomo::processAll() { nxFile.makeGroup("detector", "NXdetector", true); std::vector<int64_t> infDim; - infDim.push_back(NX_UNLIMITED); + infDim.emplace_back(NX_UNLIMITED); nxFile.makeData("image_key", ::NeXus::FLOAT64, infDim, false); nxFile.closeGroup(); // detector @@ -321,7 +321,7 @@ void SaveNXTomo::writeSingleWorkspace(const Workspace2D_sptr workspace, // Set the rotation value for this WS std::vector<double> rotValue; - rotValue.push_back(0); + rotValue.emplace_back(0); if (workspace->run().hasProperty("Rotation")) { std::string tmpVal = workspace->run().getLogData("Rotation")->value(); @@ -383,7 +383,7 @@ void SaveNXTomo::writeImageKeyValue( // Set the default key value for this WS std::vector<double> keyValue; - keyValue.push_back(0); + keyValue.emplace_back(0); if (workspace->run().hasProperty("ImageKey")) { std::string tmpVal = workspace->run().getLogData("ImageKey")->value(); @@ -425,8 +425,8 @@ void SaveNXTomo::writeLogValues(const DataObjects::Workspace2D_sptr workspace, } catch (::NeXus::Exception &) { // Create the data entry if it doesn't exist yet, and open. std::vector<int64_t> infDim; - infDim.push_back(NX_UNLIMITED); - infDim.push_back(NX_UNLIMITED); + infDim.emplace_back(NX_UNLIMITED); + infDim.emplace_back(NX_UNLIMITED); nxFile.makeData(prop->name(), ::NeXus::UINT8, infDim, true); } @@ -442,10 +442,10 @@ void SaveNXTomo::writeLogValues(const DataObjects::Workspace2D_sptr workspace, strncpy(val, prop->value().c_str(), strSize); std::vector<int64_t> start, size; - start.push_back(thisFileInd); - start.push_back(0); - size.push_back(1); - size.push_back(strSize); + start.emplace_back(thisFileInd); + start.emplace_back(0); + size.emplace_back(1); + size.emplace_back(strSize); // single item nxFile.putSlab(val, start, size); @@ -466,7 +466,7 @@ void SaveNXTomo::writeIntensityValue( } std::vector<double> intensityValue; - intensityValue.push_back(1); + intensityValue.emplace_back(1); if (workspace->run().hasProperty("Intensity")) { std::string tmpVal = workspace->run().getLogData("Intensity")->value(); diff --git a/Framework/DataHandling/src/SaveNXcanSAS.cpp b/Framework/DataHandling/src/SaveNXcanSAS.cpp index fec2b7014b88884033e7f3bf5ca090912b065af4..0437e754d6d2e5510010378bb0fec362bbb412b7 100644 --- a/Framework/DataHandling/src/SaveNXcanSAS.cpp +++ b/Framework/DataHandling/src/SaveNXcanSAS.cpp @@ -156,12 +156,12 @@ std::vector<std::string> splitDetectorNames(std::string detectorNames) { while ((pos = detectorNames.find(delimiter)) != std::string::npos) { detectorName = detectorNames.substr(0, pos); boost::algorithm::trim(detectorName); - detectors.push_back(detectorName); + detectors.emplace_back(detectorName); detectorNames.erase(0, pos + delimiter.length()); } // Push remaining element boost::algorithm::trim(detectorNames); - detectors.push_back(detectorNames); + detectors.emplace_back(detectorNames); return detectors; } @@ -552,7 +552,7 @@ private: void setSpectrumAxisValues() { auto sAxis = m_workspace->getAxis(1); for (size_t index = 0; index < sAxis->length(); ++index) { - m_spectrumAxisValues.push_back((*sAxis)(index)); + m_spectrumAxisValues.emplace_back((*sAxis)(index)); } } diff --git a/Framework/DataHandling/src/SaveNexusProcessed.cpp b/Framework/DataHandling/src/SaveNexusProcessed.cpp index e061fa88be10eb4b312fe80c3f304e89d533da5e..4aec25790e64d87499a75c68321f1775da1f34d7 100644 --- a/Framework/DataHandling/src/SaveNexusProcessed.cpp +++ b/Framework/DataHandling/src/SaveNexusProcessed.cpp @@ -187,13 +187,13 @@ void SaveNexusProcessed::getWSIndexList( } indices.reserve(1 + spec_max - spec_min); for (int i = spec_min; i <= spec_max; i++) - indices.push_back(i); + indices.emplace_back(i); if (list) { for (auto s : spec_list) { if (s < 0) continue; if (s < spec_min || s > spec_max) - indices.push_back(s); + indices.emplace_back(s); } } } else if (list) { @@ -202,7 +202,7 @@ void SaveNexusProcessed::getWSIndexList( for (auto s : spec_list) { if (s < 0) continue; - indices.push_back(s); + indices.emplace_back(s); if (s > spec_max) spec_max = s; if (s < spec_min) @@ -213,7 +213,7 @@ void SaveNexusProcessed::getWSIndexList( spec_max = numberOfHist - 1; indices.reserve(1 + spec_max - spec_min); for (int i = spec_min; i <= spec_max; i++) - indices.push_back(i); + indices.emplace_back(i); } } @@ -464,11 +464,11 @@ void SaveNexusProcessed::execEvent(Mantid::NeXus::NexusFileIO *nexusFile, size_t index = 0; for (int wi = 0; wi < static_cast<int>(m_eventWorkspace->getNumberHistograms()); wi++) { - indices.push_back(index); + indices.emplace_back(index); // Track the total # of events index += m_eventWorkspace->getSpectrum(wi).getNumberEvents(); } - indices.push_back(index); + indices.emplace_back(index); // Initialize all the arrays int64_t num = index; @@ -679,7 +679,7 @@ void SaveNexusProcessed::saveSpectraDetectorMapNexus( detPos[i] = 0.; dims.front() = static_cast<int>(nDetectors); - dims.push_back(3); + dims.emplace_back(3); file->writeCompData("detector_positions", detPos, dims, compression, dims); } catch (...) { g_log.error("Unknown error caught when saving detector positions."); diff --git a/Framework/DataHandling/src/SaveParameterFile.cpp b/Framework/DataHandling/src/SaveParameterFile.cpp index 84cf8da23d1ee08c51a71d83bb3a0df124da1609..b51a56122485f9a91cf91fdc333a4137b948ef5a 100644 --- a/Framework/DataHandling/src/SaveParameterFile.cpp +++ b/Framework/DataHandling/src/SaveParameterFile.cpp @@ -112,11 +112,11 @@ void SaveParameterFile::exec() { V3D pos; std::istringstream pValueSS(pValue); pos.readPrinted(pValueSS); - toSave[cID].push_back(boost::make_tuple( + toSave[cID].emplace_back(boost::make_tuple( "x", "double", boost::lexical_cast<std::string>(pos.X()))); - toSave[cID].push_back(boost::make_tuple( + toSave[cID].emplace_back(boost::make_tuple( "y", "double", boost::lexical_cast<std::string>(pos.Y()))); - toSave[cID].push_back(boost::make_tuple( + toSave[cID].emplace_back(boost::make_tuple( "z", "double", boost::lexical_cast<std::string>(pos.Z()))); } } else if (pName == "rot") { @@ -124,11 +124,11 @@ void SaveParameterFile::exec() { V3D rot; std::istringstream pValueSS(pValue); rot.readPrinted(pValueSS); - toSave[cID].push_back(boost::make_tuple( + toSave[cID].emplace_back(boost::make_tuple( "rotx", "double", boost::lexical_cast<std::string>(rot.X()))); - toSave[cID].push_back(boost::make_tuple( + toSave[cID].emplace_back(boost::make_tuple( "roty", "double", boost::lexical_cast<std::string>(rot.Y()))); - toSave[cID].push_back(boost::make_tuple( + toSave[cID].emplace_back(boost::make_tuple( "rotz", "double", boost::lexical_cast<std::string>(rot.Z()))); } } @@ -148,10 +148,10 @@ void SaveParameterFile::exec() { fpValue << " unit=\"" << fitParam.getFormulaUnit() << "\""; fpValue << " result-unit=\"" << fitParam.getResultUnit() << "\""; fpValue << "/>"; - toSave[cID].push_back( + toSave[cID].emplace_back( boost::make_tuple(fpName, "fitting", fpValue.str())); } else - toSave[cID].push_back(boost::make_tuple(pName, pType, pValue)); + toSave[cID].emplace_back(boost::make_tuple(pName, pType, pValue)); } } diff --git a/Framework/DataHandling/src/SaveSESANS.cpp b/Framework/DataHandling/src/SaveSESANS.cpp index 923a9ca29a7c6bdc2e49c2ca4913e7a8074d4e12..8351e59d6e9a626709b6bc26a6e6e26fb64e6c39 100644 --- a/Framework/DataHandling/src/SaveSESANS.cpp +++ b/Framework/DataHandling/src/SaveSESANS.cpp @@ -227,7 +227,8 @@ SaveSESANS::calculateError(const HistogramData::HistogramE &eValues, // Error is calculated as e / (y * wavelength^2) for (size_t i = 0; i < eValues.size(); i++) { - error.push_back(eValues[i] / (yValues[i] * wavelength[i] * wavelength[i])); + error.emplace_back(eValues[i] / + (yValues[i] * wavelength[i] * wavelength[i])); } return error; } diff --git a/Framework/DataHandling/src/SaveSPE.cpp b/Framework/DataHandling/src/SaveSPE.cpp index e9a896aea41f78936abd3f2f067482aa52716e53..12822e5f60c9085346e084e4d6453be07715e0b5 100644 --- a/Framework/DataHandling/src/SaveSPE.cpp +++ b/Framework/DataHandling/src/SaveSPE.cpp @@ -241,7 +241,7 @@ void SaveSPE::writeHists(const API::MatrixWorkspace_const_sptr WS, } } else { // if the detector isn't in the instrument definition file, write // mask values and prepare to log what happened - spuriousSpectra.push_back(i); + spuriousSpectra.emplace_back(i); writeMaskFlags(outFile); } // make regular progress reports and check for canceling the algorithm diff --git a/Framework/DataHandling/src/SaveTBL.cpp b/Framework/DataHandling/src/SaveTBL.cpp index 8a5c11cbfd06b41c494035c293993a047f71a03a..3eea11cf3617681350d2eba1a0a54bdb68ddd81e 100644 --- a/Framework/DataHandling/src/SaveTBL.cpp +++ b/Framework/DataHandling/src/SaveTBL.cpp @@ -51,10 +51,10 @@ void SaveTBL::findGroups(ITableWorkspace_sptr ws) { TableRow row = ws->getRow(i); if (row.cell<int>(ws->columnCount() - 2) != 0) { // it was part of a group - m_stichgroups[row.cell<int>(ws->columnCount() - 2)].push_back(i); + m_stichgroups[row.cell<int>(ws->columnCount() - 2)].emplace_back(i); } else { // it wasn't part of a group - m_nogroup.push_back(i); + m_nogroup.emplace_back(i); } } } diff --git a/Framework/DataHandling/src/SaveVTK.cpp b/Framework/DataHandling/src/SaveVTK.cpp index 1af9d1f187ee2c9646e7a8f874d5b1707cddb363..651987feb6815d8275713c6dbdf35872429e191a 100644 --- a/Framework/DataHandling/src/SaveVTK.cpp +++ b/Framework/DataHandling/src/SaveVTK.cpp @@ -116,17 +116,17 @@ void SaveVTK::exec() { } if (xMax && X[i + 1] > m_Xmax) { - xValue.push_back(X[i]); + xValue.emplace_back(X[i]); break; } - xValue.push_back(X[i]); + xValue.emplace_back(X[i]); if (i == static_cast<int>(nVals) - 1) { - xValue.push_back(X[i + 1]); + xValue.emplace_back(X[i + 1]); } - yValue.push_back(Y[i]); - errors.push_back(E[i]); + yValue.emplace_back(Y[i]); + errors.emplace_back(E[i]); } // sanity check assert((int)xValue.size() == (int)yValue.size() + 1); diff --git a/Framework/DataHandling/src/SetScalingPSD.cpp b/Framework/DataHandling/src/SetScalingPSD.cpp index 97e17bc0dc823abdfb89d374df22f2f4c0fba3cf..630ccee41611ef5bb458dc5b75625415cfec4092 100644 --- a/Framework/DataHandling/src/SetScalingPSD.cpp +++ b/Framework/DataHandling/src/SetScalingPSD.cpp @@ -142,7 +142,7 @@ bool SetScalingPSD::processScalingFile(const std::string &scalingFile, Kernel::V3D truPos; // use abs as correction file has -ve l2 for first few detectors truPos.spherical(fabs(l2), theta, phi); - truepos.push_back(truPos); + truepos.emplace_back(truPos); try { // detIndex is what Mantid usually calls detectorID size_t index = detectorInfo.indexOf(detIndex); @@ -323,8 +323,8 @@ void SetScalingPSD::getDetPositionsFromRaw(std::string rawfile, Kernel::V3D point; for (int i = 0; i < numDetector; ++i) { point.spherical(r[i], angle[i], phi[i]); - pos.push_back(point); - detID.push_back(rawDetID[i]); + pos.emplace_back(point); + detID.emplace_back(rawDetID[i]); } } diff --git a/Framework/DataHandling/src/SortTableWorkspace.cpp b/Framework/DataHandling/src/SortTableWorkspace.cpp index 78d20068bd47a6be4cb9865c765f699f7d33328e..ddfedf5c9c1b2502d85d01ed9f30f9c9a5d978a4 100644 --- a/Framework/DataHandling/src/SortTableWorkspace.cpp +++ b/Framework/DataHandling/src/SortTableWorkspace.cpp @@ -65,7 +65,7 @@ void SortTableWorkspace::exec() { // by default sort all columns in ascending order if (ascending.empty()) { - ascending.push_back(1); + ascending.emplace_back(1); } // if "Ascending" contains a single value - it's common for all columns. diff --git a/Framework/DataHandling/src/XmlHandler.cpp b/Framework/DataHandling/src/XmlHandler.cpp index 4741c174fa3422335c35e93720165414587293e3..596a14f7528f82b837d5ae3dad7bee0cb7ada064 100644 --- a/Framework/DataHandling/src/XmlHandler.cpp +++ b/Framework/DataHandling/src/XmlHandler.cpp @@ -101,7 +101,7 @@ std::vector<std::string> XmlHandler::get_subnodes(const std::string &xpath) { while (pNode) { if (pNode->childNodes()->length() == 1) { - subnodes.push_back(pNode->nodeName()); + subnodes.emplace_back(pNode->nodeName()); } pNode = it.nextNode(); } diff --git a/Framework/DataHandling/test/DownloadInstrumentTest.h b/Framework/DataHandling/test/DownloadInstrumentTest.h index e853e4493aa314187847d0cda393948728bd1906..66206743f8bed206559d0aafa3adce49239b0a34 100644 --- a/Framework/DataHandling/test/DownloadInstrumentTest.h +++ b/Framework/DataHandling/test/DownloadInstrumentTest.h @@ -109,7 +109,7 @@ public: void createDirectory(Poco::Path path) { Poco::File file(path); if (file.createDirectory()) { - m_directoriesToRemove.push_back(file); + m_directoriesToRemove.emplace_back(file); } } diff --git a/Framework/DataHandling/test/FindDetectorsParTest.h b/Framework/DataHandling/test/FindDetectorsParTest.h index 607dab78f0cebe2e7de98b223c624a27f4af7426..6104ecd863cf9b2204b468391a1442ac863f4526 100644 --- a/Framework/DataHandling/test/FindDetectorsParTest.h +++ b/Framework/DataHandling/test/FindDetectorsParTest.h @@ -477,7 +477,7 @@ private: auto *tempUnmanagedDet = detectors[i].release(); spInst->add(tempUnmanagedDet); spInst->markAsDetector(tempUnmanagedDet); - detectorIDs.push_back(tempUnmanagedDet->getID()); + detectorIDs.emplace_back(tempUnmanagedDet->getID()); } inputWS->getSpectrum(0).setSpectrumNo(1); inputWS->getSpectrum(0).clearDetectorIDs(); diff --git a/Framework/DataHandling/test/GroupDetectors2Test.h b/Framework/DataHandling/test/GroupDetectors2Test.h index 4bd0caf48e04be94896a830d13acf0ab2bdcd5f4..a40e8df5c0a779fb0c5eedd3e6556376e2efd9c4 100644 --- a/Framework/DataHandling/test/GroupDetectors2Test.h +++ b/Framework/DataHandling/test/GroupDetectors2Test.h @@ -1147,7 +1147,7 @@ private: std::vector<double> timeRanges; for (size_t i = 0; i < NHIST; ++i) { - timeRanges.push_back(double(i + 1)); + timeRanges.emplace_back(double(i + 1)); } builder.setTimeRanges(Mantid::Types::Core::DateAndTime(0), timeRanges); diff --git a/Framework/DataHandling/test/LoadEventNexusTest.h b/Framework/DataHandling/test/LoadEventNexusTest.h index 1ec0e9c625630f581ad0302944f4ed9a6aa689e2..250c2b7c65b5631daf1a6e1878f42079927c615f 100644 --- a/Framework/DataHandling/test/LoadEventNexusTest.h +++ b/Framework/DataHandling/test/LoadEventNexusTest.h @@ -474,10 +474,10 @@ public: void test_partial_spectra_loading() { std::string wsName = "test_partial_spectra_loading_SpectrumList"; std::vector<int32_t> specList; - specList.push_back(13); - specList.push_back(16); - specList.push_back(21); - specList.push_back(28); + specList.emplace_back(13); + specList.emplace_back(16); + specList.emplace_back(21); + specList.emplace_back(28); // A) test SpectrumList LoadEventNexus ld; @@ -535,7 +535,7 @@ public: const size_t sMin = 20; const size_t sMax = 22; specList.clear(); - specList.push_back(17); + specList.emplace_back(17); LoadEventNexus ldLMM; ldLMM.initialize(); @@ -576,7 +576,7 @@ public: std::string wsName2 = "test_partial_spectra_loading_SpectrumListISIS2"; std::string filename = "OFFSPEC00036416.nxs"; std::vector<int32_t> specList; - specList.push_back(45); + specList.emplace_back(45); LoadEventNexus ld; ld.initialize(); @@ -975,7 +975,7 @@ public: } for (size_t index = 0; index < ws->getNumberHistograms(); ++index) { if (isFirstChildWorkspace) { - specids.push_back(ws->getSpectrum(index).getSpectrumNo()); + specids.emplace_back(ws->getSpectrum(index).getSpectrumNo()); } else { TSM_ASSERT_EQUALS( "The spectrNo should be the same for all child workspaces.", diff --git a/Framework/DataHandling/test/LoadMaskTest.h b/Framework/DataHandling/test/LoadMaskTest.h index 1527d77f1499876b03c1a07f222b3e47478e86c6..d9d860485b4017fdb17368d8b6ccadf301118311 100644 --- a/Framework/DataHandling/test/LoadMaskTest.h +++ b/Framework/DataHandling/test/LoadMaskTest.h @@ -80,9 +80,9 @@ public: // 1. Generate masking files std::vector<int> banks1; std::vector<int> detids; - detids.push_back(26284); - detids.push_back(27250); - detids.push_back(28268); + detids.emplace_back(26284); + detids.emplace_back(27250); + detids.emplace_back(28268); auto maskDetFile = genMaskingFile("maskingdet.xml", detids, banks1); // 2. Run @@ -179,14 +179,14 @@ public: void test_ISISFormat() { // 1. Generate masking files std::vector<specnum_t> singlespectra; - singlespectra.push_back(35); - singlespectra.push_back(1001); - singlespectra.push_back(2001); + singlespectra.emplace_back(35); + singlespectra.emplace_back(1001); + singlespectra.emplace_back(2001); std::vector<specnum_t> pairspectra; - pairspectra.push_back(1002); - pairspectra.push_back(1005); - pairspectra.push_back(37); - pairspectra.push_back(40); + pairspectra.emplace_back(1002); + pairspectra.emplace_back(1005); + pairspectra.emplace_back(37); + pairspectra.emplace_back(40); auto isisMaskFile = genISISMaskingFile("isismask.msk", singlespectra, pairspectra); @@ -330,13 +330,13 @@ public: if (source_masked) { const auto &detector = spectrumInfoSource.detector(i); const auto detectorId = detector.getID(); - maskSourceDet.push_back(detectorId); + maskSourceDet.emplace_back(detectorId); } bool targ_masked = (maskWs->getSpectrum(i).y()[0] > 0.5); if (targ_masked) { const auto &detector = spectrumInfoTarget.detector(i); const auto detectorId = detector.getID(); - maskTargDet.push_back(detectorId); + maskTargDet.emplace_back(detectorId); } } std::sort(maskSourceDet.begin(), maskSourceDet.end()); @@ -397,17 +397,17 @@ public: void test_Banks() { // 0. Generate masking files std::vector<int> banks1; - banks1.push_back(21); - banks1.push_back(22); - banks1.push_back(2200); + banks1.emplace_back(21); + banks1.emplace_back(22); + banks1.emplace_back(2200); std::vector<int> detids; auto maskFile1 = genMaskingFile("masking01.xml", detids, banks1); std::vector<int> banks2; - banks2.push_back(23); - banks2.push_back(26); - banks2.push_back(27); - banks2.push_back(28); + banks2.emplace_back(23); + banks2.emplace_back(26); + banks2.emplace_back(27); + banks2.emplace_back(28); auto maskFile2 = genMaskingFile("masking02.xml", detids, banks2); // 1. Generate Mask Workspace diff --git a/Framework/DataHandling/test/LoadMuonNexus1Test.h b/Framework/DataHandling/test/LoadMuonNexus1Test.h index 92ebd9b254bbc33d37c558604620a625c521c390..975b99ef501485200b2cee9ffbf1558b6276689c 100644 --- a/Framework/DataHandling/test/LoadMuonNexus1Test.h +++ b/Framework/DataHandling/test/LoadMuonNexus1Test.h @@ -437,11 +437,11 @@ public: // Check grouping std::vector<int> testVec; for (int i = 5; i < 11; i++) - testVec.push_back(i); + testVec.emplace_back(i); TS_ASSERT_EQUALS(groupingTable->cell<std::vector<int>>(0, 0), testVec); testVec.clear(); - testVec.push_back(29); - testVec.push_back(31); + testVec.emplace_back(29); + testVec.emplace_back(31); TS_ASSERT_EQUALS(groupingTable->cell<std::vector<int>>(1, 0), testVec); AnalysisDataService::Instance().remove(groupingWSName); } diff --git a/Framework/DataHandling/test/LoadNXcanSASTest.h b/Framework/DataHandling/test/LoadNXcanSASTest.h index 8edfc0e2d5f131ee5c9faf041351150df2296622..fd8baad407b2c4c1315925acfc0beea9098ec6c3 100644 --- a/Framework/DataHandling/test/LoadNXcanSASTest.h +++ b/Framework/DataHandling/test/LoadNXcanSASTest.h @@ -39,8 +39,8 @@ public: // Arrange NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.hasDx = true; @@ -67,8 +67,8 @@ public: // Arrange NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.hasDx = false; @@ -95,8 +95,8 @@ public: // Arrange NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.hasDx = false; @@ -155,8 +155,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.is2dData = true; @@ -185,8 +185,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.is2dData = true; @@ -228,8 +228,8 @@ public: // Arrange NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.hasDx = true; @@ -556,8 +556,8 @@ private: void setup_1D() { removeFile(parameters1D.filename); - parameters1D.detectors.push_back("front-detector"); - parameters1D.detectors.push_back("rear-detector"); + parameters1D.detectors.emplace_back("front-detector"); + parameters1D.detectors.emplace_back("rear-detector"); parameters1D.invalidDetectors = false; parameters1D.hasDx = true; @@ -581,8 +581,8 @@ private: void setup_2D() { removeFile(parameters2D.filename); - parameters2D.detectors.push_back("front-detector"); - parameters2D.detectors.push_back("rear-detector"); + parameters2D.detectors.emplace_back("front-detector"); + parameters2D.detectors.emplace_back("rear-detector"); parameters2D.invalidDetectors = false; parameters2D.is2dData = true; diff --git a/Framework/DataHandling/test/LoadNexusProcessed2Test.h b/Framework/DataHandling/test/LoadNexusProcessed2Test.h index 216a853c6d3010f5cec3286c04a1cd94598cd177..e061ed2fba0e39b2535363d0664b25bc539afc6f 100644 --- a/Framework/DataHandling/test/LoadNexusProcessed2Test.h +++ b/Framework/DataHandling/test/LoadNexusProcessed2Test.h @@ -133,8 +133,8 @@ public: std::vector<SpectrumNumber> spectrumNumbers; size_t i = wsIn->getNumberHistograms() - 1; for (size_t j = 0; j < wsIn->getNumberHistograms(); --i, ++j) { - specDefinitions.push_back(SpectrumDefinition(i)); - spectrumNumbers.push_back(SpectrumNumber(static_cast<int>(j))); + specDefinitions.emplace_back(SpectrumDefinition(i)); + spectrumNumbers.emplace_back(SpectrumNumber(static_cast<int>(j))); } IndexInfo info(spectrumNumbers); info.setSpectrumDefinitions(specDefinitions); @@ -191,8 +191,8 @@ public: std::vector<SpectrumNumber> spectrumNumbers; // We add a single detector index 0 to a single spectrum with number (1). No // other mappings provided! - specDefinitions.push_back(SpectrumDefinition(0)); - spectrumNumbers.push_back(SpectrumNumber(1)); + specDefinitions.emplace_back(SpectrumDefinition(0)); + spectrumNumbers.emplace_back(SpectrumNumber(1)); IndexInfo info(spectrumNumbers); info.setSpectrumDefinitions(specDefinitions); wsIn->setIndexInfo(info); @@ -253,8 +253,8 @@ public: SpectrumDefinition def; def.add(i); def.add(i - 1); - specDefinitions.push_back(def); - spectrumNumbers.push_back(SpectrumNumber(static_cast<int>(j))); + specDefinitions.emplace_back(def); + spectrumNumbers.emplace_back(SpectrumNumber(static_cast<int>(j))); } IndexInfo info(spectrumNumbers); info.setSpectrumDefinitions(specDefinitions); diff --git a/Framework/DataHandling/test/LoadNexusProcessedTest.h b/Framework/DataHandling/test/LoadNexusProcessedTest.h index 711b8bdbd5c2f78f96c6945b5f119c2a6072f86f..39dbbc8f813cd1221c30f50d8f406aaa3500ca76 100644 --- a/Framework/DataHandling/test/LoadNexusProcessedTest.h +++ b/Framework/DataHandling/test/LoadNexusProcessedTest.h @@ -834,10 +834,10 @@ public: table->addColumn("vector_double", "DoubleVectorColumn"); std::vector<double> d1, d2, d3; - d1.push_back(0.5); - d2.push_back(1.0); - d2.push_back(2.5); - d3.push_back(4.0); + d1.emplace_back(0.5); + d2.emplace_back(1.0); + d2.emplace_back(2.5); + d3.emplace_back(4.0); std::vector<int> i1(Strings::parseRange("1")); std::vector<int> i2(Strings::parseRange("2,3,")); @@ -1242,16 +1242,16 @@ private: return; std::vector<std::vector<int>> groups(6); - groups[0].push_back(9); - groups[0].push_back(12); - groups[1].push_back(5); - groups[1].push_back(10); - groups[2].push_back(20); - groups[2].push_back(21); - groups[3].push_back(10); - groups[4].push_back(50); - groups[5].push_back(15); - groups[5].push_back(20); + groups[0].emplace_back(9); + groups[0].emplace_back(12); + groups[1].emplace_back(5); + groups[1].emplace_back(10); + groups[2].emplace_back(20); + groups[2].emplace_back(21); + groups[3].emplace_back(10); + groups[4].emplace_back(50); + groups[5].emplace_back(15); + groups[5].emplace_back(20); EventWorkspace_sptr ws = WorkspaceCreationHelper::createGroupedEventWorkspace(groups, 30, 1.0); @@ -1305,8 +1305,8 @@ private: inputWs->setPointStandardDeviations(0, dx1); inputWs->setPointStandardDeviations(1, dx2); if (legacyXErrors) { - inputWs->dataDx(0).push_back(1); - inputWs->dataDx(1).push_back(1); + inputWs->dataDx(0).emplace_back(1); + inputWs->dataDx(1).emplace_back(1); } } if (numericAxis) { diff --git a/Framework/DataHandling/test/LoadSpiceXML2DDetTest.h b/Framework/DataHandling/test/LoadSpiceXML2DDetTest.h index f197cd17a209261fb979651de730b60190cedb7d..34dfa080d1788e79a6e1e75dadb2a15c79d5123e 100644 --- a/Framework/DataHandling/test/LoadSpiceXML2DDetTest.h +++ b/Framework/DataHandling/test/LoadSpiceXML2DDetTest.h @@ -612,8 +612,8 @@ public: TS_ASSERT_THROWS_NOTHING( loader.setProperty("OutputWorkspace", "Exp0335_S0038F")); std::vector<size_t> geometryvec; - geometryvec.push_back(0); - geometryvec.push_back(0); + geometryvec.emplace_back(0); + geometryvec.emplace_back(0); loader.setProperty("DetectorGeometry", geometryvec); loader.setProperty("LoadInstrument", true); loader.setProperty("ShiftedDetectorDistance", 0.); @@ -697,8 +697,8 @@ public: TS_ASSERT_THROWS_NOTHING( loader.setProperty("OutputWorkspace", "Exp0335_S0038F")); std::vector<size_t> geometryvec; - geometryvec.push_back(0); - geometryvec.push_back(0); + geometryvec.emplace_back(0); + geometryvec.emplace_back(0); loader.setProperty("LoadInstrument", false); loader.execute(); diff --git a/Framework/DataHandling/test/RemoveLogsTest.h b/Framework/DataHandling/test/RemoveLogsTest.h index 173c1883739c14a0e0f1cc66777a2d92ae624b8c..52a674bfc9d7e52353b09c59df310c5e2b0458f1 100644 --- a/Framework/DataHandling/test/RemoveLogsTest.h +++ b/Framework/DataHandling/test/RemoveLogsTest.h @@ -134,10 +134,10 @@ private: std::vector<double> dbl1, dbl2; DateAndTime startTime("2010-01-01T00:00:00"); for (int i = 0; i < 100; ++i) { - times.push_back(startTime + i * 10.0); - index.push_back(i); - dbl1.push_back(i * 0.1); - dbl2.push_back(6.0); + times.emplace_back(startTime + i * 10.0); + index.emplace_back(i); + dbl1.emplace_back(i * 0.1); + dbl2.emplace_back(6.0); } auto scan_index = new TimeSeriesProperty<int>("scan_index"); diff --git a/Framework/DataHandling/test/RenameLogTest.h b/Framework/DataHandling/test/RenameLogTest.h index 6137ce80812000ef7ad1995bf6e590d764624516..79da18f9978f9603a79f09b1a6a9769593f5bd61 100644 --- a/Framework/DataHandling/test/RenameLogTest.h +++ b/Framework/DataHandling/test/RenameLogTest.h @@ -113,8 +113,8 @@ private: Types::Core::DateAndTime time(t1_ns); p1->addValue(time, v1); - m_rawTimes.push_back(time); - m_rawValues.push_back(v1); + m_rawTimes.emplace_back(time); + m_rawValues.emplace_back(v1); t1_ns += dt_ns; v1 = -v1; diff --git a/Framework/DataHandling/test/SaveAscii2Test.h b/Framework/DataHandling/test/SaveAscii2Test.h index b08d342f686199fc59d75a2e240cd3c7fa299d7f..9d972f7534fd70849e307d194cafa413d0ef1864 100644 --- a/Framework/DataHandling/test/SaveAscii2Test.h +++ b/Framework/DataHandling/test/SaveAscii2Test.h @@ -75,7 +75,7 @@ public: boost::split(binstr, binlines, boost::is_any_of(",")); for (const auto &i : binstr) { - bins.push_back(boost::lexical_cast<double>(i)); + bins.emplace_back(boost::lexical_cast<double>(i)); } TS_ASSERT_EQUALS(bins[0], 0); TS_ASSERT_EQUALS(bins[1], 2); @@ -85,7 +85,7 @@ public: bins.clear(); boost::split(binstr, binlines, boost::is_any_of(",")); for (const auto &i : binstr) { - bins.push_back(boost::lexical_cast<double>(i)); + bins.emplace_back(boost::lexical_cast<double>(i)); } TS_ASSERT_EQUALS(bins[0], 1.66667); TS_ASSERT_EQUALS(bins[1], 8.66667); @@ -172,7 +172,7 @@ public: boost::split(binstr, binlines, boost::is_any_of(",")); for (const auto &i : binstr) { - bins.push_back(boost::lexical_cast<double>(i)); + bins.emplace_back(boost::lexical_cast<double>(i)); } TS_ASSERT_EQUALS(bins[0], 0); TS_ASSERT_EQUALS(bins[1], 2); @@ -182,7 +182,7 @@ public: bins.clear(); boost::split(binstr, binlines, boost::is_any_of(",")); for (const auto &i : binstr) { - bins.push_back(boost::lexical_cast<double>(i)); + bins.emplace_back(boost::lexical_cast<double>(i)); } TS_ASSERT_EQUALS(bins[0], 1.66667); TS_ASSERT_EQUALS(bins[1], 8.66667); @@ -631,7 +631,7 @@ public: boost::split(binstr, binlines, boost::is_any_of(",")); for (const auto &i : binstr) { - bins.push_back(boost::lexical_cast<double>(i)); + bins.emplace_back(boost::lexical_cast<double>(i)); } TS_ASSERT_EQUALS(bins[0], 0); TS_ASSERT_EQUALS(bins[1], 4); @@ -641,7 +641,7 @@ public: bins.clear(); boost::split(binstr, binlines, boost::is_any_of(",")); for (const auto &i : binstr) { - bins.push_back(boost::lexical_cast<double>(i)); + bins.emplace_back(boost::lexical_cast<double>(i)); } TS_ASSERT_EQUALS(bins[0], 1.66667); TS_ASSERT_EQUALS(bins[1], 17.3333); diff --git a/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h b/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h index 3aa0a2de758e3cb084b0d1c33099cf187e24bded..9a2c58bbff3beab8cd894cdb5ce23717a6bd5a26 100644 --- a/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h +++ b/Framework/DataHandling/test/SaveGSASInstrumentFileTest.h @@ -70,9 +70,9 @@ public: TS_ASSERT(Poco::File(filename).exists()); vector<size_t> veclineindextoread; - veclineindextoread.push_back(5); - veclineindextoread.push_back(20); - veclineindextoread.push_back(304); + veclineindextoread.emplace_back(5); + veclineindextoread.emplace_back(20); + veclineindextoread.emplace_back(304); vector<string> veclines; readLines(filename, veclineindextoread, veclines); @@ -165,9 +165,9 @@ public: string filename("test3bank.iparm"); vector<size_t> veclineindextoread; - veclineindextoread.push_back(52); - veclineindextoread.push_back(499); - veclineindextoread.push_back(906); + veclineindextoread.emplace_back(52); + veclineindextoread.emplace_back(499); + veclineindextoread.emplace_back(906); vector<string> veclines; readLines(filename, veclineindextoread, veclines); @@ -198,61 +198,61 @@ public: vector<double> parvalues; parnames.emplace_back("BANK"); - parvalues.push_back(1.); + parvalues.emplace_back(1.); parnames.emplace_back("Alph0"); - parvalues.push_back(0.5); + parvalues.emplace_back(0.5); parnames.emplace_back("Alph0t"); - parvalues.push_back(65.14); + parvalues.emplace_back(65.14); parnames.emplace_back("Alph1"); - parvalues.push_back(8.15); + parvalues.emplace_back(8.15); parnames.emplace_back("Alph1t"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Beta0"); - parvalues.push_back(3.201); + parvalues.emplace_back(3.201); parnames.emplace_back("Beta0t"); - parvalues.push_back(78.412); + parvalues.emplace_back(78.412); parnames.emplace_back("Beta1"); - parvalues.push_back(7.674); + parvalues.emplace_back(7.674); parnames.emplace_back("Beta1t"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Dtt1"); - parvalues.push_back(22780.57); + parvalues.emplace_back(22780.57); parnames.emplace_back("Dtt1t"); - parvalues.push_back(22790.129); + parvalues.emplace_back(22790.129); parnames.emplace_back("Dtt2"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Dtt2t"); - parvalues.push_back(0.3); + parvalues.emplace_back(0.3); parnames.emplace_back("Gam0"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Gam1"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Gam2"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Sig0"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Sig1"); - parvalues.push_back(sqrt(10.0)); + parvalues.emplace_back(sqrt(10.0)); parnames.emplace_back("Sig2"); - parvalues.push_back(sqrt(403.30)); + parvalues.emplace_back(sqrt(403.30)); parnames.emplace_back("Tcross"); - parvalues.push_back(0.3560); + parvalues.emplace_back(0.3560); parnames.emplace_back("Width"); - parvalues.push_back(1.2141); + parvalues.emplace_back(1.2141); parnames.emplace_back("Zero"); - parvalues.push_back(0); + parvalues.emplace_back(0); parnames.emplace_back("Zerot"); - parvalues.push_back(-70.60); + parvalues.emplace_back(-70.60); parnames.emplace_back("step"); - parvalues.push_back(5); + parvalues.emplace_back(5); parnames.emplace_back("tof-max"); - parvalues.push_back(46760); + parvalues.emplace_back(46760); parnames.emplace_back("tof-min"); - parvalues.push_back(2278.06); + parvalues.emplace_back(2278.06); parnames.emplace_back("twotheta"); - parvalues.push_back(90.807); + parvalues.emplace_back(90.807); parnames.emplace_back("CWL"); - parvalues.push_back(0.533); + parvalues.emplace_back(0.533); for (size_t i = 0; i < parnames.size(); ++i) { TableRow row = tablews->appendRow(); diff --git a/Framework/DataHandling/test/SaveGSSTest.h b/Framework/DataHandling/test/SaveGSSTest.h index cb90f4e175e30e499cf52c9ebb6c4d63119f5ee5..d555f6862480d7dbb91bc31d52d5a225264c75c7 100644 --- a/Framework/DataHandling/test/SaveGSSTest.h +++ b/Framework/DataHandling/test/SaveGSSTest.h @@ -137,14 +137,14 @@ public: // define user specified arbitrary header std::vector<std::string> user_header; - user_header.push_back("user line 1"); - user_header.push_back("user line 2"); - user_header.push_back("user line 3"); + user_header.emplace_back("user line 1"); + user_header.emplace_back("user line 2"); + user_header.emplace_back("user line 3"); // define user specified arbitrary bank header std::vector<std::string> user_bank_headers; - user_bank_headers.push_back("Bank 1 some information"); - user_bank_headers.push_back("Bank 2 some information different"); + user_bank_headers.emplace_back("Bank 1 some information"); + user_bank_headers.emplace_back("Bank 2 some information different"); // SLOG XYE precision std::vector<int> slog_xye_precision(3, 1); diff --git a/Framework/DataHandling/test/SaveILLCosmosAsciiTest.h b/Framework/DataHandling/test/SaveILLCosmosAsciiTest.h index 1a477559dbcbf8d810d68630162c024b5c9a3e32..71418abceb7a87937910f90819c4de89fba554d3 100644 --- a/Framework/DataHandling/test/SaveILLCosmosAsciiTest.h +++ b/Framework/DataHandling/test/SaveILLCosmosAsciiTest.h @@ -32,8 +32,8 @@ public: m_filename = "SaveILLCosmosAsciiTestFile.txt"; m_name = "SaveILLCosmosAsciiWS"; for (int i = 1; i < m_points + 1; ++i) { - m_data.push_back(i); - m_zeros.push_back(0.); + m_data.emplace_back(i); + m_zeros.emplace_back(0.); } } ~SaveILLCosmosAsciiTest() override {} diff --git a/Framework/DataHandling/test/SaveNXcanSASTest.h b/Framework/DataHandling/test/SaveNXcanSASTest.h index 3f4f50f5ab045d2605d00a7839c6c7f03b90edca..849c03ad294200f320d747e0964ba1b134c6ff37 100644 --- a/Framework/DataHandling/test/SaveNXcanSASTest.h +++ b/Framework/DataHandling/test/SaveNXcanSASTest.h @@ -85,8 +85,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.sampleDirectRun = "5"; parameters.canDirectRun = "6"; @@ -121,8 +121,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.sampleDirectRun = "5"; parameters.canDirectRun = "6"; @@ -158,8 +158,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.sampleDirectRun = "5"; parameters.canDirectRun = "6"; @@ -204,8 +204,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; auto ws = provide1DWorkspace(parameters); @@ -228,8 +228,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("wrong-detector1"); - parameters.detectors.push_back("wrong-detector2"); + parameters.detectors.emplace_back("wrong-detector1"); + parameters.detectors.emplace_back("wrong-detector2"); parameters.invalidDetectors = true; auto ws = provide1DWorkspace(parameters); @@ -254,8 +254,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.hasDx = false; @@ -280,8 +280,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.hasDx = true; @@ -324,8 +324,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.is2dData = true; @@ -350,8 +350,8 @@ public: NXcanSASTestParameters parameters; removeFile(parameters.filename); - parameters.detectors.push_back("front-detector"); - parameters.detectors.push_back("rear-detector"); + parameters.detectors.emplace_back("front-detector"); + parameters.detectors.emplace_back("rear-detector"); parameters.invalidDetectors = false; parameters.is2dData = true; diff --git a/Framework/DataHandling/test/SaveNexusESSTest.h b/Framework/DataHandling/test/SaveNexusESSTest.h index c751317cbd1f6fe91c89cb8975a29cca32b9537f..94771441e27ad14edce666ec1c3717f3b65b44b7 100644 --- a/Framework/DataHandling/test/SaveNexusESSTest.h +++ b/Framework/DataHandling/test/SaveNexusESSTest.h @@ -180,8 +180,8 @@ public: std::vector<SpectrumNumber> spectrumNumbers; size_t i = wsIn->getNumberHistograms() - 1; for (size_t j = 0; j < wsIn->getNumberHistograms(); --i, ++j) { - specDefinitions.push_back(SpectrumDefinition(i)); - spectrumNumbers.push_back(SpectrumNumber(static_cast<int>(j))); + specDefinitions.emplace_back(SpectrumDefinition(i)); + spectrumNumbers.emplace_back(SpectrumNumber(static_cast<int>(j))); } IndexInfo info(spectrumNumbers); info.setSpectrumDefinitions(specDefinitions); diff --git a/Framework/DataHandling/test/SaveNexusProcessedTest.h b/Framework/DataHandling/test/SaveNexusProcessedTest.h index d02e0d51c87a3cb3b56c944e3adec7f889c6fedd..903e54a0629e6bb781b41ca6ce1a31065f770801 100644 --- a/Framework/DataHandling/test/SaveNexusProcessedTest.h +++ b/Framework/DataHandling/test/SaveNexusProcessedTest.h @@ -234,14 +234,14 @@ public: bool clearfiles, bool PreserveEvents = true, bool CompressNexus = false) { std::vector<std::vector<int>> groups(5); - groups[0].push_back(10); - groups[0].push_back(11); - groups[0].push_back(12); - groups[1].push_back(20); - groups[2].push_back(30); - groups[2].push_back(31); - groups[3].push_back(40); - groups[4].push_back(50); + groups[0].emplace_back(10); + groups[0].emplace_back(11); + groups[0].emplace_back(12); + groups[1].emplace_back(20); + groups[2].emplace_back(30); + groups[2].emplace_back(31); + groups[3].emplace_back(40); + groups[4].emplace_back(50); EventWorkspace_sptr WS = WorkspaceCreationHelper::createGroupedEventWorkspace(groups, 100, 1.0, @@ -424,10 +424,10 @@ public: table->addColumn("vector_double", "DoubleVectorColumn"); std::vector<double> d1, d2, d3; - d1.push_back(0.5); - d2.push_back(1.0); - d2.push_back(2.5); - d3.push_back(4.0); + d1.emplace_back(0.5); + d2.emplace_back(1.0); + d2.emplace_back(2.5); + d3.emplace_back(4.0); // Add some rows of different sizes TableRow row1 = table->appendRow(); diff --git a/Framework/DataObjects/inc/MantidDataObjects/EventList.h b/Framework/DataObjects/inc/MantidDataObjects/EventList.h index b987dcf74cbfa19781ba3d73f1f9a9e31f428a1b..03646bc2326c50a0e18d9e15bd110d4407455a75 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/EventList.h +++ b/Framework/DataObjects/inc/MantidDataObjects/EventList.h @@ -105,7 +105,7 @@ public: * @param event :: TofEvent to add at the end of the list. * */ inline void addEventQuickly(const Types::Event::TofEvent &event) { - this->events.push_back(event); + this->events.emplace_back(event); this->order = UNSORTED; } @@ -115,7 +115,7 @@ public: * @param event :: WeightedEvent to add at the end of the list. * */ inline void addEventQuickly(const WeightedEvent &event) { - this->weightedEvents.push_back(event); + this->weightedEvents.emplace_back(event); this->order = UNSORTED; } @@ -125,7 +125,7 @@ public: * @param event :: WeightedEventNoTime to add at the end of the list. * */ inline void addEventQuickly(const WeightedEventNoTime &event) { - this->weightedEventsNoTime.push_back(event); + this->weightedEventsNoTime.emplace_back(event); this->order = UNSORTED; } diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc index f248a48d617d2bf98e912a4b5ab49fb30f4029ae..06cf030da192ce9aa7c39cf6b2a0d27f0e28b189 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDBox.tcc @@ -205,11 +205,11 @@ TMDE(size_t MDBox)::getNumMDBoxes() const { return 1; } /// Fill a vector with all the boxes up to a certain depth TMDE(void MDBox)::getBoxes(std::vector<MDBoxBase<MDE, nd> *> &boxes, size_t /*maxDepth*/, bool /*leafOnly*/) { - boxes.push_back(this); + boxes.emplace_back(this); } TMDE(void MDBox)::getBoxes(std::vector<API::IMDNode *> &boxes, size_t /*maxDepth*/, bool /*leafOnly*/) { - boxes.push_back(this); + boxes.emplace_back(this); } //----------------------------------------------------------------------------------------------- @@ -217,12 +217,12 @@ TMDE(void MDBox)::getBoxes(std::vector<API::IMDNode *> &boxes, TMDE(void MDBox)::getBoxes( std::vector<MDBoxBase<MDE, nd> *> &boxes, size_t /*maxDepth*/, bool /*leafOnly*/, Mantid::Geometry::MDImplicitFunction * /*function*/) { - boxes.push_back(this); + boxes.emplace_back(this); } TMDE(void MDBox)::getBoxes( std::vector<API::IMDNode *> &boxes, size_t /*maxDepth*/, bool /*leafOnly*/, Mantid::Geometry::MDImplicitFunction * /*function*/) { - boxes.push_back(this); + boxes.emplace_back(this); } //----------------------------------------------------------------------------------------------- @@ -799,8 +799,8 @@ TMDE(void MDBox)::buildAndAddEvent(const signal_t Signal, const std::vector<coord_t> &point, uint16_t runIndex, uint32_t detectorId) { std::lock_guard<std::mutex> _lock(this->m_dataMutex); - this->data.push_back(IF<MDE, nd>::BUILD_EVENT(Signal, errorSq, &point[0], - runIndex, detectorId)); + this->data.emplace_back(IF<MDE, nd>::BUILD_EVENT(Signal, errorSq, &point[0], + runIndex, detectorId)); } //----------------------------------------------------------------------------------------------- @@ -819,8 +819,8 @@ TMDE(void MDBox)::buildAndAddEventUnsafe(const signal_t Signal, const std::vector<coord_t> &point, uint16_t runIndex, uint32_t detectorId) { - this->data.push_back(IF<MDE, nd>::BUILD_EVENT(Signal, errorSq, &point[0], - runIndex, detectorId)); + this->data.emplace_back(IF<MDE, nd>::BUILD_EVENT(Signal, errorSq, &point[0], + runIndex, detectorId)); } //----------------------------------------------------------------------------------------------- @@ -830,7 +830,7 @@ TMDE(void MDBox)::buildAndAddEventUnsafe(const signal_t Signal, * */ TMDE(size_t MDBox)::addEvent(const MDE &Evnt) { std::lock_guard<std::mutex> _lock(this->m_dataMutex); - this->data.push_back(Evnt); + this->data.emplace_back(Evnt); return 1; } @@ -843,7 +843,7 @@ TMDE(size_t MDBox)::addEvent(const MDE &Evnt) { * @return Always returns 1 * */ TMDE(size_t MDBox)::addEventUnsafe(const MDE &Evnt) { - this->data.push_back(Evnt); + this->data.emplace_back(Evnt); return 1; } diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc index ef261e7e3f979eaa14d359baac25d155bfe3e6a2..f7f55e09ae2dab9f12d8f1dc47159a8efcb7863d 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDBoxBase.tcc @@ -127,7 +127,7 @@ TMDE(std::vector<Mantid::Kernel::VMD> MDBoxBase)::getVertexes() const { } // (for each dimension) // Create the coordinate object and add it to the vector - out.push_back(Mantid::Kernel::VMD(nd, coords)); + out.emplace_back(Mantid::Kernel::VMD(nd, coords)); } return out; diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc index 3ff300ba973cfa9c0159e05371e33c6b81cdd8f5..32f9600358ccdb1db7f581ab6710907045a8b1c4 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc @@ -235,8 +235,8 @@ TMDE(std::vector<coord_t> MDEventWorkspace)::estimateResolution() const { finestSplit *= m_BoxController->getSplitInto(d); Geometry::IMDDimension_const_sptr dim = this->getDimension(d); // Calculate the bin size at the smallest split amount - out.push_back((dim->getMaximum() - dim->getMinimum()) / - static_cast<coord_t>(finestSplit)); + out.emplace_back((dim->getMaximum() - dim->getMinimum()) / + static_cast<coord_t>(finestSplit)); } return out; } @@ -276,7 +276,8 @@ TMDE(std::vector<std::unique_ptr<Mantid::API::IMDIterator>> size_t end = ((i + 1) * numElements) / numCores; if (end > numElements) end = numElements; - out.push_back(std::make_unique<MDBoxIterator<MDE, nd>>(boxes, begin, end)); + out.emplace_back( + std::make_unique<MDBoxIterator<MDE, nd>>(boxes, begin, end)); } return out; } @@ -421,7 +422,7 @@ TMDE(std::vector<std::string> MDEventWorkspace)::getBoxControllerStats() const { 1024; mess << m_BoxController->getTotalNumMDBoxes() << " MDBoxes (" << mem << " kB)"; - out.push_back(mess.str()); + out.emplace_back(mess.str()); mess.str(""); mem = (this->m_BoxController->getTotalNumMDGridBoxes() * @@ -429,11 +430,11 @@ TMDE(std::vector<std::string> MDEventWorkspace)::getBoxControllerStats() const { 1024; mess << m_BoxController->getTotalNumMDGridBoxes() << " MDGridBoxes (" << mem << " kB)"; - out.push_back(mess.str()); + out.emplace_back(mess.str()); mess.str(""); // mess << "Avg recursion depth: " << m_BoxController->getAverageDepth(); - // out.push_back(mess.str()); mess.str(""); + // out.emplace_back(mess.str()); mess.str(""); // // mess << "Recursion Coverage %: "; // const std::vector<size_t> & num = m_BoxController->getNumMDBoxes(); @@ -446,7 +447,7 @@ TMDE(std::vector<std::string> MDEventWorkspace)::getBoxControllerStats() const { // std::fixed; // mess << std::setprecision(2) << pct; // } - // out.push_back(mess.str()); mess.str(""); + // out.emplace_back(mess.str()); mess.str(""); if (m_BoxController->isFileBacked()) { mess << "File backed: "; @@ -457,7 +458,7 @@ TMDE(std::vector<std::string> MDEventWorkspace)::getBoxControllerStats() const { sizeof(MDE)) / (1024 * 1024); mess << "Write buffer: " << used << " of " << avail << " MB. "; - out.push_back(mess.str()); + out.emplace_back(mess.str()); mess.str(""); mess << "File"; @@ -465,11 +466,11 @@ TMDE(std::vector<std::string> MDEventWorkspace)::getBoxControllerStats() const { mess << " (needs updating)"; mess << ": " << this->m_BoxController->getFileIO()->getFileName(); - out.push_back(mess.str()); + out.emplace_back(mess.str()); mess.str(""); } else { mess << "Not file backed."; - out.push_back(mess.str()); + out.emplace_back(mess.str()); mess.str(""); } @@ -498,7 +499,7 @@ TMDE(Mantid::API::ITableWorkspace_sptr MDEventWorkspace)::makeBoxTable( boxes_filtered.reserve(boxes.size()); for (const auto box : boxes) { - boxes_filtered.push_back(dynamic_cast<MDBoxBase<MDE, nd> *>(box)); + boxes_filtered.emplace_back(dynamic_cast<MDBoxBase<MDE, nd> *>(box)); } // Now sort by ID @@ -822,14 +823,14 @@ TMDE(API::IMDWorkspace::LinePlot MDEventWorkspace) // If the box is not masked then record the signal and error here if (!box->getIsMasked()) { - line.x.push_back(line_pos); + line.x.emplace_back(line_pos); signal_t signal = this->getNormalizedSignal(box, normalize); if (std::isinf(signal)) { // The plotting library (qwt) doesn't like infs. signal = std::numeric_limits<signal_t>::quiet_NaN(); } - line.y.push_back(signal); - line.e.push_back(this->getNormalizedError(box, normalize)); + line.y.emplace_back(signal); + line.e.emplace_back(this->getNormalizedError(box, normalize)); } } } diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc index b1feafa76775fee7bca44bef8855b4453a286b66..9e52f7ceabfd04efa842d5aaedf57a34b32dee7a 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDGridBox.tcc @@ -160,7 +160,7 @@ void MDGridBox<MDE, nd>::fillBoxShell(const size_t tot, } splitBox->setInverseVolume( ChildInverseVolume); // Set the cached inverse volume - m_Children.push_back(splitBox); + m_Children.emplace_back(splitBox); // Increment the indices, rolling back as needed indices[0]++; @@ -206,11 +206,11 @@ TMDE(MDGridBox)::MDGridBox(const MDGridBox<MDE, nd> &other, if (otherMDBox) { auto newBox = new MDBox<MDE, nd>(*otherMDBox, otherBC); newBox->setParent(this); - m_Children.push_back(newBox); + m_Children.emplace_back(newBox); } else if (otherMDGridBox) { auto newBox = new MDGridBox<MDE, nd>(*otherMDGridBox, otherBC); newBox->setParent(this); - m_Children.push_back(newBox); + m_Children.emplace_back(newBox); } else { throw std::runtime_error( "MDGridBox::copy_ctor(): an unexpected child box type was found."); @@ -335,7 +335,7 @@ TMDE(void MDGridBox)::setChildren(const std::vector<API::IMDNode *> &otherBoxes, auto it_end = otherBoxes.begin() + indexEnd; // Set the parent of each new child box. for (; it != it_end; it++) { - m_Children.push_back(dynamic_cast<MDBoxBase<MDE, nd> *>(*it)); + m_Children.emplace_back(dynamic_cast<MDBoxBase<MDE, nd> *>(*it)); m_Children.back()->setParent(this); } numBoxes = m_Children.size(); @@ -435,7 +435,7 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes, size_t maxDepth, bool leafOnly) { // Add this box, unless we only want the leaves if (!leafOnly) - outBoxes.push_back(this); + outBoxes.emplace_back(this); if (this->getDepth() < maxDepth) { for (API::IMDNode *child : m_Children) { @@ -446,7 +446,7 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes, // Oh, we reached the max depth and want only leaves. // ... so we consider this box to be a leaf too. if (leafOnly) - outBoxes.push_back(this); + outBoxes.emplace_back(this); } } @@ -472,7 +472,7 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes, Mantid::Geometry::MDImplicitFunction *function) { // Add this box, unless we only want the leaves if (!leafOnly) - outBoxes.push_back(this); + outBoxes.emplace_back(this); if (this->getDepth() < maxDepth) { // OK, let's look for children that are either touching or completely @@ -637,7 +637,7 @@ TMDE(void MDGridBox)::getBoxes(std::vector<API::IMDNode *> &outBoxes, // Oh, we reached the max depth and want only leaves. // ... so we consider this box to be a leaf too. if (leafOnly) - outBoxes.push_back(this); + outBoxes.emplace_back(this); } } //----------------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h b/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h index 6fce674e3bd06b639da99013ffcb377d85611655..3c300d4fb1609717bde54b223c3a735bc84fc9d1 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h +++ b/Framework/DataObjects/inc/MantidDataObjects/TableColumn.h @@ -495,7 +495,7 @@ void TableColumn<Type>::sortIndex( if (m_data[*i] != m_data[*(i - 1)]) { auto p = std::make_pair( eqStart, static_cast<size_t>(std::distance(indexVec.begin(), i))); - equalRanges.push_back(p); + equalRanges.emplace_back(p); same = false; } } @@ -505,7 +505,7 @@ void TableColumn<Type>::sortIndex( if (same) { auto p = std::make_pair( eqStart, static_cast<size_t>(std::distance(indexVec.begin(), iEnd))); - equalRanges.push_back(p); + equalRanges.emplace_back(p); } } diff --git a/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h b/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h index 7895152631a0904535c179ed5e3c621fb342e9d4..646d144d80e2b25ef66be5578ec0e551b32d5fc4 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h +++ b/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h @@ -68,7 +68,7 @@ public: for (const auto &element : elements) { try { - newValues.push_back(boost::lexical_cast<Type>(element)); + newValues.emplace_back(boost::lexical_cast<Type>(element)); } catch (boost::bad_lexical_cast &) { throw std::invalid_argument("Unable to convert one of the elements: " + element); diff --git a/Framework/DataObjects/src/AffineMatrixParameterParser.cpp b/Framework/DataObjects/src/AffineMatrixParameterParser.cpp index 7b0c6004a5327e3ce3c472d6b1baedeca8d05e34..c3abb1a7637ba42eb142c2ab9a9cd24f2b695f7e 100644 --- a/Framework/DataObjects/src/AffineMatrixParameterParser.cpp +++ b/Framework/DataObjects/src/AffineMatrixParameterParser.cpp @@ -48,7 +48,7 @@ AffineMatrixParameter *AffineMatrixParameterParser::createParameter( col_it = vecStrCols.begin(); while (col_it != vecStrCols.end()) { coord_t val = static_cast<coord_t>(std::stof(col_it->c_str())); - elements.push_back(val); + elements.emplace_back(val); ++col_it; } ++row_it; diff --git a/Framework/DataObjects/src/BoxControllerNeXusIO.cpp b/Framework/DataObjects/src/BoxControllerNeXusIO.cpp index cbd3213a5320f513ab9dc7af20a3c9eddb16d809..1530f6bea4d0558ea9511184ae0952d660c2cf2c 100644 --- a/Framework/DataObjects/src/BoxControllerNeXusIO.cpp +++ b/Framework/DataObjects/src/BoxControllerNeXusIO.cpp @@ -38,7 +38,7 @@ BoxControllerNeXusIO::BoxControllerNeXusIO(API::BoxController *const bc) m_BlockSize[1] = 4 + m_bc->getNDims(); for (auto &EventHeader : EventHeaders) { - m_EventsTypeHeaders.push_back(EventHeader); + m_EventsTypeHeaders.emplace_back(EventHeader); } m_EventsTypesSupported.resize(2); @@ -405,7 +405,7 @@ template <typename FROM, typename TO> void convertFormats(const std::vector<FROM> &inData, std::vector<TO> &outData) { outData.reserve(inData.size()); for (size_t i = 0; i < inData.size(); i++) { - outData.push_back(static_cast<TO>(inData[i])); + outData.emplace_back(static_cast<TO>(inData[i])); } } /** Load float data block from the opened NeXus file. diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index 6704ce6fcff334843c3b4d3e72df1399268a32e1..622245b2a9ad2e0fddf4da8b70ca2d02f0f4a984 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -355,7 +355,7 @@ EventList &EventList::operator+=(const TofEvent &event) { switch (this->eventType) { case TOF: // Simply push the events - this->events.push_back(event); + this->events.emplace_back(event); break; case WEIGHTED: @@ -420,7 +420,7 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) { * */ EventList &EventList::operator+=(const WeightedEvent &event) { this->switchTo(WEIGHTED); - this->weightedEvents.push_back(event); + this->weightedEvents.emplace_back(event); this->order = UNSORTED; return *this; } @@ -1690,8 +1690,8 @@ inline void EventList::compressFatEventsHelper( // Track the average tof totalTof += it->m_tof * norm; // Accumulate the pulse times - pulsetimes.push_back(it->m_pulsetime); - pulsetimeWeights.push_back(norm); + pulsetimes.emplace_back(it->m_pulsetime); + pulsetimeWeights.emplace_back(norm); } else { // We exceeded the tolerance if (!pulsetimes.empty()) { @@ -1715,9 +1715,9 @@ inline void EventList::compressFatEventsHelper( lastTof = it->m_tof; lastPulseBin = eventPulseBin; pulsetimes.clear(); - pulsetimes.push_back(it->m_pulsetime); + pulsetimes.emplace_back(it->m_pulsetime); pulsetimeWeights.clear(); - pulsetimeWeights.push_back(norm); + pulsetimeWeights.emplace_back(norm); } } @@ -2819,7 +2819,7 @@ void EventList::getTofsHelper(const std::vector<T> &events, std::vector<double> &tofs) { tofs.clear(); for (auto itev = events.cbegin(); itev != events.cend(); ++itev) - tofs.push_back(itev->m_tof); + tofs.emplace_back(itev->m_tof); } /** Fill a vector with the list of TOFs @@ -3793,7 +3793,7 @@ void EventList::filterByPulseTimeHelper(std::vector<T> &events, while ((itev != itev_end) && (itev->m_pulsetime < stop)) { // Add the copy to the output - output.push_back(*itev); + output.emplace_back(*itev); ++itev; } } @@ -3824,7 +3824,7 @@ void EventList::filterByTimeAtSampleHelper(std::vector<T> &events, (calculateCorrectedFullTime(*itev, tofFactor, tofOffset) < stop.totalNanoseconds())) { // Add the copy to the output - output.push_back(*itev); + output.emplace_back(*itev); ++itev; } } diff --git a/Framework/DataObjects/src/EventWorkspace.cpp b/Framework/DataObjects/src/EventWorkspace.cpp index 56bfdaeda38a2ec6d00c00a1ca0277d96fba10a3..d72a508cad6a177b5b4186c21de331e5bf545092 100644 --- a/Framework/DataObjects/src/EventWorkspace.cpp +++ b/Framework/DataObjects/src/EventWorkspace.cpp @@ -55,7 +55,7 @@ EventWorkspace::EventWorkspace(const EventWorkspace &other) auto newel = std::make_unique<EventList>(*el); // Make sure to update the MRU to point to THIS event workspace. newel->setMRU(this->mru.get()); - this->data.push_back(std::move(newel)); + this->data.emplace_back(std::move(newel)); } } diff --git a/Framework/DataObjects/src/FakeMD.cpp b/Framework/DataObjects/src/FakeMD.cpp index f649f45ccd4e527fee7100253cb47a20bfed59ca..fc020653d2a5c60e2662cf837ae64c64325fc4b4 100644 --- a/Framework/DataObjects/src/FakeMD.cpp +++ b/Framework/DataObjects/src/FakeMD.cpp @@ -168,8 +168,8 @@ void FakeMD::addFakeUniformData(typename MDEventWorkspace<MDE, nd>::sptr ws) { if (m_uniformParams.size() == 1) { if (randomEvents) { for (size_t d = 0; d < nd; ++d) { - m_uniformParams.push_back(ws->getDimension(d)->getMinimum()); - m_uniformParams.push_back(ws->getDimension(d)->getMaximum()); + m_uniformParams.emplace_back(ws->getDimension(d)->getMinimum()); + m_uniformParams.emplace_back(ws->getDimension(d)->getMaximum()); } } else // regular events { @@ -188,12 +188,13 @@ void FakeMD::addFakeUniformData(typename MDEventWorkspace<MDE, nd>::sptr ws) { double delta0 = std::pow(dV, 1. / double(nd)); for (size_t d = 0; d < nd; ++d) { double min = ws->getDimension(d)->getMinimum(); - m_uniformParams.push_back(min * (1 + FLT_EPSILON) - min + FLT_EPSILON); + m_uniformParams.emplace_back(min * (1 + FLT_EPSILON) - min + + FLT_EPSILON); double extent = ws->getDimension(d)->getMaximum() - min; auto nStrides = size_t(extent / delta0); if (nStrides < 1) nStrides = 1; - m_uniformParams.push_back(extent / static_cast<double>(nStrides)); + m_uniformParams.emplace_back(extent / static_cast<double>(nStrides)); } } } diff --git a/Framework/DataObjects/src/MDBoxFlatTree.cpp b/Framework/DataObjects/src/MDBoxFlatTree.cpp index d95870bad98fda09bb24037805884e2a20edc2dc..39cbc17a62ebadbf39b0094a6c8d40332f45130a 100644 --- a/Framework/DataObjects/src/MDBoxFlatTree.cpp +++ b/Framework/DataObjects/src/MDBoxFlatTree.cpp @@ -420,7 +420,7 @@ void MDBoxFlatTree::loadExperimentInfos( if (num < std::numeric_limits<uint16_t>::max() - 1) { // dublicated experiment info names are impossible due to the // structure of the nexus file but missing -- can be found. - ExperimentBlockNum.push_back(num); + ExperimentBlockNum.emplace_back(num); } } catch (boost::bad_lexical_cast &) { /* ignore */ } diff --git a/Framework/DataObjects/src/MDHistoWorkspace.cpp b/Framework/DataObjects/src/MDHistoWorkspace.cpp index 9eba974687285a23f53630c300efbc9968c044fd..f8bc34aabb42d6688667c582597123fec200833c 100644 --- a/Framework/DataObjects/src/MDHistoWorkspace.cpp +++ b/Framework/DataObjects/src/MDHistoWorkspace.cpp @@ -50,13 +50,13 @@ MDHistoWorkspace::MDHistoWorkspace( m_coordSystem(None), m_displayNormalization(displayNormalization) { std::vector<Mantid::Geometry::MDHistoDimension_sptr> dimensions; if (dimX) - dimensions.push_back(std::move(dimX)); + dimensions.emplace_back(std::move(dimX)); if (dimY) - dimensions.push_back(std::move(dimY)); + dimensions.emplace_back(std::move(dimY)); if (dimZ) - dimensions.push_back(std::move(dimZ)); + dimensions.emplace_back(std::move(dimZ)); if (dimT) - dimensions.push_back(std::move(dimT)); + dimensions.emplace_back(std::move(dimT)); this->init(dimensions); } @@ -457,7 +457,7 @@ MDHistoWorkspace::createIterators( if (function) clonedFunction = new Mantid::Geometry::MDImplicitFunction(*function); - out.push_back(std::make_unique<MDHistoWorkspaceIterator>( + out.emplace_back(std::make_unique<MDHistoWorkspaceIterator>( this, clonedFunction, begin, end)); } return out; @@ -579,7 +579,7 @@ IMDWorkspace::LinePlot MDHistoWorkspace::getLinePoints( // Require x.size() = y.size()+1 if recording bin boundaries if (!bin_centres) - line.x.push_back(length); + line.x.emplace_back(length); return line; } else { @@ -590,7 +590,7 @@ IMDWorkspace::LinePlot MDHistoWorkspace::getLinePoints( coord_t lastLinePos = *it; VMD lastPos = start + (dir * lastLinePos); if (!bin_centres) { - line.x.push_back(lastLinePos); + line.x.emplace_back(lastLinePos); } ++it; @@ -612,9 +612,9 @@ IMDWorkspace::LinePlot MDHistoWorkspace::getLinePoints( this->getIsMaskedAt(linearIndex))) { auto bin_centrePos = static_cast<coord_t>((linePos + lastLinePos) * 0.5); - line.x.push_back(bin_centrePos); + line.x.emplace_back(bin_centrePos); } else if (!bin_centres) - line.x.push_back(linePos); + line.x.emplace_back(linePos); if (linearIndex < m_length) { @@ -626,15 +626,15 @@ IMDWorkspace::LinePlot MDHistoWorkspace::getLinePoints( signal = std::numeric_limits<signal_t>::quiet_NaN(); } if (!bin_centres || !this->getIsMaskedAt(linearIndex)) { - line.y.push_back(signal); - line.e.push_back(this->getErrorAt(linearIndex) * normalizer); + line.y.emplace_back(signal); + line.e.emplace_back(this->getErrorAt(linearIndex) * normalizer); } // Save the position for next bin lastPos = pos; } else { // Invalid index. This shouldn't happen - line.y.push_back(std::numeric_limits<signal_t>::quiet_NaN()); - line.e.push_back(std::numeric_limits<signal_t>::quiet_NaN()); + line.y.emplace_back(std::numeric_limits<signal_t>::quiet_NaN()); + line.e.emplace_back(std::numeric_limits<signal_t>::quiet_NaN()); } lastLinePos = linePos; diff --git a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp index 7dcb9b7fd57b1365d9a45e392639e9b6ef417249..f1d8a5427c76c89a48a7c3fbbf1129c733886f11 100644 --- a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp +++ b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp @@ -542,7 +542,7 @@ MDHistoWorkspaceIterator::findNeighbourIndexesFaceTouching() const { if (neighbour_index < m_ws->getNPoints() && Utils::isNeighbourOfSubject(m_nd, neighbour_index, m_index, m_indexMaker, m_indexMax, widths)) { - neighbourIndexes.push_back(neighbour_index); + neighbourIndexes.emplace_back(neighbour_index); } } return neighbourIndexes; @@ -600,7 +600,7 @@ std::vector<int64_t> MDHistoWorkspaceIterator::createPermutations( for (int i = 0; i < widths[0]; ++i) { // for width = 3 : -1, 0, 1 // for width = 5 : -2, -1, 0, 1, 2 - permutationsVertexTouching.push_back(centreIndex - i); + permutationsVertexTouching.emplace_back(centreIndex - i); } // Figure out what possible indexes deltas to generate indexes that are next @@ -612,10 +612,10 @@ std::vector<int64_t> MDHistoWorkspaceIterator::createPermutations( size_t nEntries = permutationsVertexTouching.size(); for (int k = 1; k <= widths[j] / 2; ++k) { for (size_t m = 0; m < nEntries; m++) { - permutationsVertexTouching.push_back((offset * k) + - permutationsVertexTouching[m]); - permutationsVertexTouching.push_back((offset * k * (-1)) + - permutationsVertexTouching[m]); + permutationsVertexTouching.emplace_back( + (offset * k) + permutationsVertexTouching[m]); + permutationsVertexTouching.emplace_back( + (offset * k * (-1)) + permutationsVertexTouching[m]); } } } @@ -703,9 +703,9 @@ MDHistoWorkspaceIterator::findNeighbourIndexesByWidth1D( std::vector<int> widths; for (size_t dimension = 0; dimension < m_nd; ++dimension) { if (static_cast<int>(dimension) == width_dimension) { - widths.push_back(width); + widths.emplace_back(width); } else { - widths.push_back(1); + widths.emplace_back(1); } } diff --git a/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp b/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp index e1088c636863c0f300b65bddab1bf2c787497868..066237eaac58149ad504e820a08fbce66d696e7d 100644 --- a/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp +++ b/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp @@ -36,20 +36,20 @@ PeakShapeEllipsoidFactory::create(const std::string &source) const { static_cast<SpecialCoordinateSystem>(root["frame"].asInt())); std::vector<double> abcRadii, abcRadiiBackgroundInner, abcRadiiBackgroundOuter; - abcRadii.push_back(root["radius0"].asDouble()); - abcRadii.push_back(root["radius1"].asDouble()); - abcRadii.push_back(root["radius2"].asDouble()); - abcRadiiBackgroundInner.push_back( + abcRadii.emplace_back(root["radius0"].asDouble()); + abcRadii.emplace_back(root["radius1"].asDouble()); + abcRadii.emplace_back(root["radius2"].asDouble()); + abcRadiiBackgroundInner.emplace_back( root["background_inner_radius0"].asDouble()); - abcRadiiBackgroundInner.push_back( + abcRadiiBackgroundInner.emplace_back( root["background_inner_radius1"].asDouble()); - abcRadiiBackgroundInner.push_back( + abcRadiiBackgroundInner.emplace_back( root["background_inner_radius2"].asDouble()); - abcRadiiBackgroundOuter.push_back( + abcRadiiBackgroundOuter.emplace_back( root["background_outer_radius0"].asDouble()); - abcRadiiBackgroundOuter.push_back( + abcRadiiBackgroundOuter.emplace_back( root["background_outer_radius1"].asDouble()); - abcRadiiBackgroundOuter.push_back( + abcRadiiBackgroundOuter.emplace_back( root["background_outer_radius2"].asDouble()); std::vector<V3D> directions(3); diff --git a/Framework/DataObjects/src/PeaksWorkspace.cpp b/Framework/DataObjects/src/PeaksWorkspace.cpp index 1cf592671caa6c79ae791e18b6e9bca93306a282..02635eb60ec3b8646cbc31dcf1456ee3840c0689 100644 --- a/Framework/DataObjects/src/PeaksWorkspace.cpp +++ b/Framework/DataObjects/src/PeaksWorkspace.cpp @@ -338,7 +338,7 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const { std::ostringstream oss; oss << std::setw(12) << std::fixed << std::setprecision(3) << (qFrame.norm()); std::pair<std::string, std::string> QMag("|Q|", oss.str()); - Result.push_back(QMag); + Result.emplace_back(QMag); oss.str(""); oss.clear(); @@ -348,7 +348,7 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const { std::pair<std::string, std::string> dspc("d-spacing", oss.str()); oss.str(""); oss.clear(); - Result.push_back(dspc); + Result.emplace_back(dspc); int seqNum = -1; bool hasOneRunNumber = true; @@ -398,14 +398,14 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const { { std::pair<std::string, std::string> QlabStr( "Qlab", boost::lexical_cast<std::string>(Qlab)); - Result.push_back(QlabStr); + Result.emplace_back(QlabStr); } if (!labCoords || seqNum >= 0) { std::pair<std::string, std::string> QsampStr( "QSample", boost::lexical_cast<std::string>(Qsamp)); - Result.push_back(QsampStr); + Result.emplace_back(QsampStr); } try { @@ -422,13 +422,13 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const { std::pair<std::string, std::string> HKL( "HKL", boost::lexical_cast<std::string>(hkl)); - Result.push_back(HKL); + Result.emplace_back(HKL); } if (hasOneRunNumber) { std::pair<std::string, std::string> runn("RunNumber", " " + std::to_string(runNum)); - Result.push_back(runn); + Result.emplace_back(runn); } //------- Now get phi, chi and omega ---------------- @@ -438,16 +438,16 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const { std::pair<std::string, std::string> GRead( "Goniometer Angles", boost::lexical_cast<std::string>(PhiChiOmega)); - Result.push_back(GRead); + Result.emplace_back(GRead); std::pair<std::string, std::string> SeqNum( "Seq Num,1st=1", " " + std::to_string(seqNum + 1)); - Result.push_back(SeqNum); + Result.emplace_back(SeqNum); oss << std::setw(12) << std::fixed << std::setprecision(3) << (peak->getWavelength()); std::pair<std::string, std::string> wl("Wavelength", oss.str()); - Result.push_back(wl); + Result.emplace_back(wl); oss.str(""); oss.clear(); @@ -455,38 +455,38 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const { std::pair<std::string, std::string> detpos( "Position(x,y,z)", boost::lexical_cast<std::string>(peak->getDetPos())); - Result.push_back(detpos); + Result.emplace_back(detpos); oss << std::setw(15) << std::fixed << std::setprecision(3) << (peak->getTOF()); std::pair<std::string, std::string> tof("TOF", oss.str()); - Result.push_back(tof); + Result.emplace_back(tof); oss.str(""); oss.clear(); oss << std::setw(12) << std::fixed << std::setprecision(3) << (peak->getFinalEnergy()); std::pair<std::string, std::string> Energy("Energy", oss.str()); - Result.push_back(Energy); + Result.emplace_back(Energy); oss.str(""); oss.clear(); std::pair<std::string, std::string> row( "Row", " " + std::to_string(peak->getRow())); - Result.push_back(row); + Result.emplace_back(row); std::pair<std::string, std::string> col( "Col", " " + std::to_string(peak->getCol())); - Result.push_back(col); + Result.emplace_back(col); std::pair<std::string, std::string> bank("Bank", " " + peak->getBankName()); - Result.push_back(bank); + Result.emplace_back(bank); oss << std::setw(12) << std::fixed << std::setprecision(3) << (peak->getScattering()); std::pair<std::string, std::string> scat("Scattering Angle", oss.str()); - Result.push_back(scat); + Result.emplace_back(scat); } } catch (...) // Impossible position @@ -549,7 +549,7 @@ int PeaksWorkspace::peakInfoNumber(const Kernel::V3D &qFrame, std::ostringstream oss; oss << std::setw(12) << std::fixed << std::setprecision(3) << (qFrame.norm()); std::pair<std::string, std::string> QMag("|Q|", oss.str()); - Result.push_back(QMag); + Result.emplace_back(QMag); oss.str(""); oss.clear(); @@ -559,7 +559,7 @@ int PeaksWorkspace::peakInfoNumber(const Kernel::V3D &qFrame, std::pair<std::string, std::string> dspc("d-spacing", oss.str()); oss.str(""); oss.clear(); - Result.push_back(dspc); + Result.emplace_back(dspc); int seqNum = -1; double minDist = 10000000; @@ -666,10 +666,10 @@ void PeaksWorkspace::initColumns() { **/ void PeaksWorkspace::addPeakColumn(const std::string &name) { // Create the PeakColumn. - columns.push_back(boost::shared_ptr<DataObjects::PeakColumn>( + columns.emplace_back(boost::shared_ptr<DataObjects::PeakColumn>( new DataObjects::PeakColumn(this->peaks, name))); // Cache the names - columnNames.push_back(name); + columnNames.emplace_back(name); } //--------------------------------------------------------------------------------------------- @@ -900,8 +900,8 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const { // Goniometer Matrix Column std::vector<int> array_dims; - array_dims.push_back(static_cast<int>(peaks.size())); - array_dims.push_back(9); + array_dims.emplace_back(static_cast<int>(peaks.size())); + array_dims.emplace_back(9); file->writeData("column_15", goniometerMatrix, array_dims); file->openData("column_15"); file->putAttr("name", "Goniometer Matrix"); @@ -911,8 +911,8 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const { // Shape std::vector<int64_t> dims; - dims.push_back(np); - dims.push_back(static_cast<int>(maxShapeJSONLength)); + dims.emplace_back(np); + dims.emplace_back(static_cast<int>(maxShapeJSONLength)); const std::string name = "column_16"; file->makeData(name, NeXus::CHAR, dims, false); file->openData(name); diff --git a/Framework/DataObjects/src/ReflectometryTransform.cpp b/Framework/DataObjects/src/ReflectometryTransform.cpp index ce6c750fde7453b5f10ce1a7d041cf84ed94d8e2..a3231deedb7a1e9f798e555afd6e4eed80886e51 100644 --- a/Framework/DataObjects/src/ReflectometryTransform.cpp +++ b/Framework/DataObjects/src/ReflectometryTransform.cpp @@ -500,9 +500,9 @@ MatrixWorkspace_sptr ReflectometryTransform::executeNormPoly( zBinsVec.begin(); if (qIndex != 0 && qIndex < static_cast<int>(zBinsVec.size())) { // Add this spectra-detector pair to the mapping - specNumberMapping.push_back( + specNumberMapping.emplace_back( outWS->getSpectrum(qIndex - 1).getSpectrumNo()); - detIDMapping.push_back(detector.getID()); + detIDMapping.emplace_back(detector.getID()); } // Debugging if (dumpVertexes) { diff --git a/Framework/DataObjects/src/ScanningWorkspaceBuilder.cpp b/Framework/DataObjects/src/ScanningWorkspaceBuilder.cpp index 84fb1bab9447371ab53e4d4ffb71da195bc89fb9..ea06bfc17c26afc8e18f173b2adb18efad6ede81 100644 --- a/Framework/DataObjects/src/ScanningWorkspaceBuilder.cpp +++ b/Framework/DataObjects/src/ScanningWorkspaceBuilder.cpp @@ -94,7 +94,7 @@ void ScanningWorkspaceBuilder::setTimeRanges( for (size_t i = 1; i < m_nTimeIndexes; ++i) { const auto newStartTime = timeRanges[i - 1].second; const auto endTime = newStartTime + durations[i]; - timeRanges.push_back( + timeRanges.emplace_back( std::pair<Types::Core::DateAndTime, Types::Core::DateAndTime>( newStartTime, endTime)); } diff --git a/Framework/DataObjects/src/TableWorkspace.cpp b/Framework/DataObjects/src/TableWorkspace.cpp index 9e6141422de0a6853d0e16e8c118c3b6feb99b49..8ef5f95a072d02a56286181110542c83a846e920 100644 --- a/Framework/DataObjects/src/TableWorkspace.cpp +++ b/Framework/DataObjects/src/TableWorkspace.cpp @@ -83,7 +83,7 @@ API::Column_sptr TableWorkspace::addColumn(const std::string &type, } try { c = API::ColumnFactory::Instance().create(type); - m_columns.push_back(c); + m_columns.emplace_back(c); c->setName(name); resizeColumn(c.get(), rowCount()); } catch (Kernel::Exception::NotFoundError &e) { @@ -209,7 +209,7 @@ void TableWorkspace::addColumn(boost::shared_ptr<API::Column> column) { throw std::invalid_argument(ss.str()); } else { modified(); - m_columns.push_back(column); + m_columns.emplace_back(column); } } diff --git a/Framework/DataObjects/test/BoxControllerNeXusIOTest.h b/Framework/DataObjects/test/BoxControllerNeXusIOTest.h index e5b69f1c3829e1f6c442556e25520729b9c6c1fa..e14784903f3f376b1b1da304ce383f9c147c87ed 100644 --- a/Framework/DataObjects/test/BoxControllerNeXusIOTest.h +++ b/Framework/DataObjects/test/BoxControllerNeXusIOTest.h @@ -129,7 +129,7 @@ public: std::vector<uint64_t> freeSpaceVectorToSet; for (uint64_t i = 0; i < 20; i++) { - freeSpaceVectorToSet.push_back(i); + freeSpaceVectorToSet.emplace_back(i); } pSaver->setFreeSpaceVector(freeSpaceVectorToSet); diff --git a/Framework/DataObjects/test/EventListTest.h b/Framework/DataObjects/test/EventListTest.h index 0bbd462005208237a452d5e4a085cd7c88d724f1..b3776d6398564d650b10c34267a6960e3231f5c4 100644 --- a/Framework/DataObjects/test/EventListTest.h +++ b/Framework/DataObjects/test/EventListTest.h @@ -58,9 +58,9 @@ public: void setUp() override { // Make a little event list with 3 events vector<TofEvent> mylist; - mylist.push_back(TofEvent(100, 200)); - mylist.push_back(TofEvent(3.5, 400)); - mylist.push_back(TofEvent(50, 60)); + mylist.emplace_back(TofEvent(100, 200)); + mylist.emplace_back(TofEvent(3.5, 400)); + mylist.emplace_back(TofEvent(50, 60)); el = EventList(mylist); } @@ -205,7 +205,7 @@ public: el2 += mylist; TS_ASSERT_EQUALS(events.size(), 3); TS_ASSERT_EQUALS(events.capacity(), 3); - mylist.push_back(TofEvent(88, 88)); + mylist.emplace_back(TofEvent(88, 88)); el2 += mylist; TS_ASSERT_EQUALS(events.size(), 7); TS_ASSERT_EQUALS(events.capacity(), 7); @@ -235,13 +235,13 @@ public: // events) // { // typename std::vector<T> mylist; - // mylist.push_back(T(45)); - // mylist.push_back(T(89)); - // mylist.push_back(T(34)); + // mylist.emplace_back(T(45)); + // mylist.emplace_back(T(89)); + // mylist.emplace_back(T(34)); // el2 += mylist; // TS_ASSERT_EQUALS(events.size(), 3); // TS_ASSERT_EQUALS(events.capacity(), 3); - // mylist.push_back(TofEvent(88,88)); + // mylist.emplace_back(TofEvent(88,88)); // el2 += mylist; // TS_ASSERT_EQUALS(events.size(), 7); // TS_ASSERT_EQUALS(events.capacity(), 7); @@ -529,8 +529,8 @@ public: double step = BIN_DELTA * 10; X = this->makeX(step, NUMBINS / 10 + 1); for (std::size_t i = 0; i < X.size() - 1; i++) { - Y.push_back(static_cast<double>(i + 1)); - E.push_back(sqrt(static_cast<double>(i + 1))); + Y.emplace_back(static_cast<double>(i + 1)); + E.emplace_back(sqrt(static_cast<double>(i + 1))); } // Go through each possible EventType as the input @@ -612,15 +612,15 @@ public: // one tenth of the # of bins double step = BIN_DELTA * 10; for (double tof = step; tof < BIN_DELTA * (NUMBINS + 1); tof += step) { - X.push_back(tof); + X.emplace_back(tof); } for (std::size_t i = 0; i < X.size() - 1; i++) { // Have one zero bin in there if (i == 6) - Y.push_back(0.0); + Y.emplace_back(0.0); else - Y.push_back(2.0); - E.push_back(0.5); + Y.emplace_back(2.0); + E.emplace_back(0.5); } // Go through each possible EventType as the input @@ -847,7 +847,7 @@ public: double tof; // in ns for (tof = 0; tof < BIN_DELTA * (NUMBINS + 1); tof += BIN_DELTA) { // bins of 10 microsec - shared_x.push_back(tof); + shared_x.emplace_back(tof); } el.setX(make_cow<HistogramX>(shared_x)); // Do we have the same data in X? @@ -870,7 +870,7 @@ public: double tof; // in ns for (tof = 0; tof < 16e3 * 1e3; tof += 1e4) { // bins of 10 microsec - shared_x.push_back(tof); + shared_x.emplace_back(tof); } el.setX(make_cow<HistogramX>(shared_x)); // Do we have the same data in X? @@ -939,7 +939,7 @@ public: MantidVec shared_x; for (int pulse_time = 0; pulse_time < BIN_DELTA * (NUMBINS + 1); pulse_time += BIN_DELTA) { - shared_x.push_back(pulse_time); + shared_x.emplace_back(pulse_time); } eList.setX(make_cow<HistogramX>(shared_x)); @@ -973,7 +973,7 @@ public: MantidVec shared_x; for (int pulse_time = 0; pulse_time < BIN_DELTA * (NUMBINS + 1); pulse_time += BIN_DELTA) { - shared_x.push_back(pulse_time); + shared_x.emplace_back(pulse_time); } eList.setX(make_cow<HistogramX>(shared_x)); @@ -997,7 +997,7 @@ public: MantidVec shared_x; for (int time_at_sample = 0; time_at_sample < BIN_DELTA * (NUMBINS + 1); time_at_sample += BIN_DELTA) { - shared_x.push_back(time_at_sample); + shared_x.emplace_back(time_at_sample); } eList.setX(make_cow<HistogramX>(shared_x)); @@ -1056,9 +1056,10 @@ public: */ for (int time_at_sample = 100; time_at_sample < MAX_TOF; time_at_sample += BIN_DELTA) { - shared_x.push_back(time_at_sample * 1e3); // Have x-axis in nanoseconds. - // Tof values are stored as - // microseconds. + shared_x.emplace_back(time_at_sample * + 1e3); // Have x-axis in nanoseconds. + // Tof values are stored as + // microseconds. } el.setX(make_cow<HistogramX>(shared_x)); @@ -1163,7 +1164,7 @@ public: MantidVec shared_x; for (double tof = BIN_DELTA * 10; tof < BIN_DELTA * (NUMBINS + 1); tof += BIN_DELTA) - shared_x.push_back(tof); + shared_x.emplace_back(tof); el.setX(make_cow<HistogramX>(shared_x)); // Get them back @@ -1187,7 +1188,7 @@ public: MantidVec shared_x; for (double tof = BIN_DELTA * 10; tof < BIN_DELTA * (NUMBINS + 1); tof += BIN_DELTA) - shared_x.push_back(tof); + shared_x.emplace_back(tof); el.setX(make_cow<HistogramX>(shared_x)); const EventList el3(el); // need to copy to a const method in order to // access the data directly. @@ -1223,7 +1224,7 @@ public: MantidVec some_other_x; double tof; // in ns for (tof = 0; tof < BIN_DELTA * (NUMBINS + 1); tof += BIN_DELTA * 2) - some_other_x.push_back(tof); + some_other_x.emplace_back(tof); const EventList el3(el); // need to copy to a const method in order to // access the data directly. @@ -1242,10 +1243,10 @@ public: // void test_histogram_static_function() // { // std::vector<WeightedEvent> events; - // events.push_back(WeightedEvent(1.0, 0, 2.0, 16.0) ); + // events.emplace_back(WeightedEvent(1.0, 0, 2.0, 16.0) ); // MantidVec X, Y, E; - // X.push_back(0.0); - // X.push_back(10.0); + // X.emplace_back(0.0); + // X.emplace_back(10.0); // EventList::histogramForWeightsHelper(events, X, Y, E); // TS_ASSERT_EQUALS(Y.size(), 1 ); // TS_ASSERT_DELTA(Y[0], 2.0, 1e-5 ); @@ -1849,9 +1850,11 @@ public: for (int i = 1; i < 10; i++) { // Reject the odd hundreds pulse times (100-199, 300-399, etc). if ((i % 2) == 0) - split.push_back(SplittingInterval(i * 1000000, (i + 1) * 1000000, i)); + split.emplace_back( + SplittingInterval(i * 1000000, (i + 1) * 1000000, i)); else - split.push_back(SplittingInterval(i * 1000000, (i + 1) * 1000000, -1)); + split.emplace_back( + SplittingInterval(i * 1000000, (i + 1) * 1000000, -1)); } // Do the splitting @@ -1936,12 +1939,12 @@ public: std::vector<EventList *> outputs; for (size_t i = 0; i < 10; i++) - outputs.push_back(new EventList()); + outputs.emplace_back(new EventList()); TimeSplitterType split; // Slices of 100 for (int i = 0; i < 10; i++) - split.push_back(SplittingInterval(i * 100, (i + 1) * 100, i)); + split.emplace_back(SplittingInterval(i * 100, (i + 1) * 100, i)); if (curType == WEIGHTED_NOTIME) { // Error cause no time @@ -1977,8 +1980,8 @@ public: std::vector<EventList *> outputs(1, new EventList()); TimeSplitterType split; - split.push_back(SplittingInterval(100, 200, 0)); - split.push_back(SplittingInterval(150, 250, 0)); + split.emplace_back(SplittingInterval(100, 200, 0)); + split.emplace_back(SplittingInterval(150, 250, 0)); // Do the splitting el.splitByTime(split, outputs); @@ -1995,9 +1998,9 @@ public: el *= 3.0; TimeSplitterType split; - split.push_back(SplittingInterval(100, 200, 0)); - split.push_back(SplittingInterval(150, 250, 0)); - split.push_back(SplittingInterval(300, 350, 0)); + split.emplace_back(SplittingInterval(100, 200, 0)); + split.emplace_back(SplittingInterval(150, 250, 0)); + split.emplace_back(SplittingInterval(300, 350, 0)); // Do the splitting el.filterInPlace(split); @@ -2027,7 +2030,7 @@ public: el.switchTo(WEIGHTED); TimeSplitterType split; - split.push_back(SplittingInterval(1500, 1700, 0)); + split.emplace_back(SplittingInterval(1500, 1700, 0)); // Do the splitting el.filterInPlace(split); @@ -2043,7 +2046,7 @@ public: el *= 3.0; TimeSplitterType split; - split.push_back(SplittingInterval(-10, 1700, 0)); + split.emplace_back(SplittingInterval(-10, 1700, 0)); // Do the splitting el.filterInPlace(split); @@ -2674,7 +2677,7 @@ public: MantidVec makeX(double step, int numbins = 10) { MantidVec X; for (double tof = step; tof < step * numbins; tof += step) { - X.push_back(tof); + X.emplace_back(tof); } return X; } @@ -2873,10 +2876,10 @@ public: // A vector for histogramming, 100,000 steps of 1.0 for (double i = 0; i < 100000; i += 1.0) - fineX.push_back(i); + fineX.emplace_back(i); // Coarse vector, 1000 bins. for (double i = 0; i < 100000; i += 100) - coarseX.push_back(i); + coarseX.emplace_back(i); // Create FrameworkManager such that the effect of config option // `MultiThreaded.MaxCores` is visible: The FrameworkManager sets the TBB diff --git a/Framework/DataObjects/test/EventWorkspaceTest.h b/Framework/DataObjects/test/EventWorkspaceTest.h index 6cc033531ac0eda7d8b78108fdaa7a98c07d3a01..02003ebef886aacb8e5d96cf8fd4478ce85cb9fd 100644 --- a/Framework/DataObjects/test/EventWorkspaceTest.h +++ b/Framework/DataObjects/test/EventWorkspaceTest.h @@ -654,7 +654,7 @@ public: // Vector with 10 bins, 10 wide MantidVec X; for (size_t j = 0; j < 11; j++) - X.push_back(static_cast<double>(j) * 10.0); + X.emplace_back(static_cast<double>(j) * 10.0); ew1->setX(i, make_cow<HistogramX>(X)); // Now it should be 20 in that spot diff --git a/Framework/DataObjects/test/MDBoxBaseTest.h b/Framework/DataObjects/test/MDBoxBaseTest.h index 85c7d194ea4631ca269a4c358e4c62520a259e86..4515dab6b774e5bd9d38e71ee46886b03af4cd17 100644 --- a/Framework/DataObjects/test/MDBoxBaseTest.h +++ b/Framework/DataObjects/test/MDBoxBaseTest.h @@ -421,7 +421,7 @@ public: // // 10 to 1 in reverse order // for (uint64_t i=0; i<10; i++) // { - // boxes.push_back(new MDBoxBaseTester<MDLeanEvent<1>,1>(10-i)); + // boxes.emplace_back(new MDBoxBaseTester<MDLeanEvent<1>,1>(10-i)); // } // TODO: // Kernel::ISaveable::sortObjByFilePos(boxes); diff --git a/Framework/DataObjects/test/MDBoxFlatTreeTest.h b/Framework/DataObjects/test/MDBoxFlatTreeTest.h index 3fde6195a08df76a834cb5c21e2c5193affef8e4..3f7b600ac0ef8631ee93409eecb76a185be79de0 100644 --- a/Framework/DataObjects/test/MDBoxFlatTreeTest.h +++ b/Framework/DataObjects/test/MDBoxFlatTreeTest.h @@ -97,7 +97,7 @@ public: std::vector<size_t> gridIndices; for (size_t i = 0; i < Boxes.size(); ++i) { if (!Boxes[i]->isBox()) - gridIndices.push_back(i); + gridIndices.emplace_back(i); } for (auto gridIndex : gridIndices) { delete Boxes[gridIndex]; diff --git a/Framework/DataObjects/test/MDBoxIteratorTest.h b/Framework/DataObjects/test/MDBoxIteratorTest.h index 4e4f04f39cdaeac3dd64a59dddea89b011ce21ce..be1ba96181662277e199b61a1e0ec668164761a6 100644 --- a/Framework/DataObjects/test/MDBoxIteratorTest.h +++ b/Framework/DataObjects/test/MDBoxIteratorTest.h @@ -682,10 +682,10 @@ public: std::vector<MDBoxBase<MDLeanEvent<3>, 3> *> boxes; // Iterate and fill the vector as you go. - boxes.push_back(it.getBox()); + boxes.emplace_back(it.getBox()); while (it.next()) { box = it.getBox(); - boxes.push_back(box); + boxes.emplace_back(box); } TS_ASSERT(box); size_t expected = 125 * 125 * 125 + 125 * 125 + 125 + 1; diff --git a/Framework/DataObjects/test/MDBoxTest.h b/Framework/DataObjects/test/MDBoxTest.h index 5997ec3b9da018e9bf7629a31f61548795a6e72e..49893a611fbacfe83d57969a4a74bbe6fb2f237f 100644 --- a/Framework/DataObjects/test/MDBoxTest.h +++ b/Framework/DataObjects/test/MDBoxTest.h @@ -159,9 +159,9 @@ public: std::vector<MDLeanEvent<2>> vec; ev.setCenter(0, 2.0); ev.setCenter(1, 3.0); - vec.push_back(ev); - vec.push_back(ev); - vec.push_back(ev); + vec.emplace_back(ev); + vec.emplace_back(ev); + vec.emplace_back(ev); b.addEvents(vec); b.refreshCache(); @@ -231,7 +231,7 @@ public: // ev.setCenter(0, 2.0); // ev.setCenter(1, 3.0); // for (size_t i=0; i<10; i++) - // vec.push_back(ev); + // vec.emplace_back(ev); // b.addEvents(vec, 5, 8); // b.refreshCache(); @@ -394,7 +394,7 @@ public: MDLeanEvent<3> ev(1.2, 3.4); std::vector<MDLeanEvent<3>> vec; for (size_t i = 0; i < 12; i++) - vec.push_back(ev); + vec.emplace_back(ev); b3.addEvents(vec); TS_ASSERT(b3.getBoxController() == sc.get()); diff --git a/Framework/DataObjects/test/MDEventTest.h b/Framework/DataObjects/test/MDEventTest.h index 0af05444d2687d437d98d041be672476f0cd1415..89599374ef7b46fe4b0c76c2bd656a35b941c323 100644 --- a/Framework/DataObjects/test/MDEventTest.h +++ b/Framework/DataObjects/test/MDEventTest.h @@ -271,7 +271,7 @@ public: uint16_t detectorId = 45678; Mantid::coord_t center[3] = {1.25, 2.5, 3.5}; for (size_t i = 0; i < num; i++) - events3.push_back( + events3.emplace_back( MDEvent<3>(signal, error, runIndex, detectorId, center)); } @@ -282,7 +282,7 @@ public: uint16_t detectorId = 45678; Mantid::coord_t center[4] = {1.25, 2.5, 3.5, 4.75}; for (size_t i = 0; i < num; i++) - events4.push_back( + events4.emplace_back( MDEvent<4>(signal, error, runIndex, detectorId, center)); } @@ -291,7 +291,7 @@ public: float error(2.5); Mantid::coord_t center[3] = {1.25, 2.5, 3.5}; for (size_t i = 0; i < num; i++) - lean_events3.push_back(MDLeanEvent<3>(signal, error, center)); + lean_events3.emplace_back(MDLeanEvent<3>(signal, error, center)); } void test_create_MDLeanEvent4() { @@ -299,7 +299,7 @@ public: float error(2.5); Mantid::coord_t center[4] = {1.25, 2.5, 3.5, 4.75}; for (size_t i = 0; i < num; i++) - lean_events4.push_back(MDLeanEvent<4>(signal, error, center)); + lean_events4.emplace_back(MDLeanEvent<4>(signal, error, center)); } void test_serialize_deserializeLean() { diff --git a/Framework/DataObjects/test/MDEventWorkspaceTest.h b/Framework/DataObjects/test/MDEventWorkspaceTest.h index bb81ad1b14dcffb9240b454821fd3e164361f01f..aac5b398a2728f7abc4dbbf6a999a152159268a1 100644 --- a/Framework/DataObjects/test/MDEventWorkspaceTest.h +++ b/Framework/DataObjects/test/MDEventWorkspaceTest.h @@ -408,12 +408,12 @@ public: std::vector<coord_t> min; std::vector<coord_t> max; - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(1.5); - max.push_back(1.5); - max.push_back(1.5); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(1.5); + max.emplace_back(1.5); + max.emplace_back(1.5); // Create a function to mask some of the workspace. auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -502,7 +502,7 @@ public: for (double x = 4.0005; x < 7; x += 1.0) for (double y = 4.0005; y < 7; y += 1.0) { double centers[2] = {x, y}; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); } // So it doesn't split ws->getBoxController()->setSplitThreshold(1000); @@ -570,12 +570,12 @@ public: std::vector<coord_t> min; std::vector<coord_t> max; - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(10); - max.push_back(10); - max.push_back(10); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(10); + max.emplace_back(10); + max.emplace_back(10); // Create an function that encompases 1/4 of the total bins. auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -593,12 +593,12 @@ public: std::vector<coord_t> max; // Make the box lay over a non-intersecting region of space. - min.push_back(-1); - min.push_back(-1); - min.push_back(-1); - max.push_back(-0.01f); - max.push_back(-0.01f); - max.push_back(-0.01f); + min.emplace_back(-1); + min.emplace_back(-1); + min.emplace_back(-1); + max.emplace_back(-0.01f); + max.emplace_back(-0.01f); + max.emplace_back(-0.01f); // Create an function that encompases 1/4 of the total bins. auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -611,12 +611,12 @@ public: std::vector<coord_t> max; // Make the box that covers half the bins in the workspace. - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(10); - max.push_back(10); - max.push_back(4.99f); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(10); + max.emplace_back(10); + max.emplace_back(4.99f); // Create an function that encompases 1/4 of the total bins. auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -628,12 +628,12 @@ public: // Create a function that masks everything. std::vector<coord_t> min; std::vector<coord_t> max; - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(10); - max.push_back(10); - max.push_back(10); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(10); + max.emplace_back(10); + max.emplace_back(10); auto function = std::make_unique<MDBoxImplicitFunction>(min, max); MDEventWorkspace3Lean::sptr ws = diff --git a/Framework/DataObjects/test/MDGridBoxTest.h b/Framework/DataObjects/test/MDGridBoxTest.h index 107b3314773838760a01634c9f5f13af322f7db8..edee42b835635c3158eb29a037036d1df6c4fd8b 100644 --- a/Framework/DataObjects/test/MDGridBoxTest.h +++ b/Framework/DataObjects/test/MDGridBoxTest.h @@ -286,7 +286,7 @@ public: BoxController *const bcc = g->getBoxController(); std::vector<API::IMDNode *> boxes; for (size_t i = 0; i < 15; i++) - boxes.push_back(MDEventsTestHelper::makeMDBox1(10, bcc)); + boxes.emplace_back(MDEventsTestHelper::makeMDBox1(10, bcc)); TS_ASSERT_THROWS_NOTHING(g->setChildren(boxes, 2, 12)); TS_ASSERT_EQUALS(g->getNumChildren(), 10); @@ -818,7 +818,7 @@ public: for (double x = 0.5; x < 10; x += 1.0) for (double y = 0.5; y < 10; y += 1.0) { coord_t centers[2] = {static_cast<coord_t>(x), static_cast<coord_t>(y)}; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); } size_t numbad = 0; @@ -848,7 +848,7 @@ public: for (double x = -5.0; x < 20; x += 20.0) for (double y = -5.0; y < 20; y += 20.0) { double centers[2] = {x, y}; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); } // Get the right totals again b->refreshCache(nullptr); @@ -872,15 +872,15 @@ public: auto b = MDEventsTestHelper::makeMDGridBox<2>(); std::vector<MDLeanEvent<2>> events; coord_t centers[2] = {0.0f, 0.0f}; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); centers[1] = 10.0f; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); centers[0] = 10.0f; centers[1] = 0.0f; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); centers[0] = 10.0f; centers[1] = 10.0f; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); size_t numbad(-1); TS_ASSERT_THROWS_NOTHING(numbad = b->addEvents(events)); @@ -911,7 +911,7 @@ public: // for (double y=0.5; y < 10; y += 1.0) // { // double centers[2] = {x,y}; - // events.push_back( MDLeanEvent<2>(2.0, 2.0, centers) ); + // events.emplace_back( MDLeanEvent<2>(2.0, 2.0, centers) ); // } // size_t numbad = 0; @@ -939,7 +939,7 @@ public: for (double x = 0.5; x < 10; x += 1.0) for (double y = 0.5; y < 10; y += 1.0) { double centers[2] = {x, y}; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); } TS_ASSERT_THROWS_NOTHING(b->addEvents(events);); } @@ -1001,7 +1001,7 @@ public: for (size_t i = 0; i < num_repeat; i++) { // Make an event in the middle of each box double centers[2] = {1e-10, 1e-10}; - events.push_back(MDLeanEvent<2>(2.0, 2.0, centers)); + events.emplace_back(MDLeanEvent<2>(2.0, 2.0, centers)); } TS_ASSERT_THROWS_NOTHING(b0->addEvents(events);); @@ -1482,8 +1482,8 @@ public: .Times(1) .WillOnce(Return(false)); // Not masked - boxes.push_back(a); - boxes.push_back(b); + boxes.emplace_back(a); + boxes.emplace_back(b); auto bc = boost::make_shared<BoxController>(1); std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> extentsVector(1); @@ -1507,8 +1507,8 @@ public: EXPECT_CALL(*b, getIsMasked()) .Times(0); // Not masked, but will never be called. - boxes.push_back(a); - boxes.push_back(b); + boxes.emplace_back(a); + boxes.emplace_back(b); auto bc = boost::make_shared<BoxController>(1); std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> extentsVector(1); @@ -1532,8 +1532,8 @@ public: .WillOnce(Return(false)); // NOT MASKED EXPECT_CALL(*b, getIsMasked()).Times(1).WillOnce(Return(true)); // MASKED - boxes.push_back(a); - boxes.push_back(b); + boxes.emplace_back(a); + boxes.emplace_back(b); auto bc = boost::make_shared<BoxController>(1); std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> extentsVector(1); @@ -1556,8 +1556,8 @@ public: EXPECT_CALL(*a, mask()).Times(1); EXPECT_CALL(*b, mask()).Times(1); - boxes.push_back(a); - boxes.push_back(b); + boxes.emplace_back(a); + boxes.emplace_back(b); auto bc = boost::make_shared<BoxController>(1); std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> extentsVector(1); @@ -1580,8 +1580,8 @@ public: EXPECT_CALL(*a, unmask()).Times(1); EXPECT_CALL(*b, unmask()).Times(1); - boxes.push_back(a); - boxes.push_back(b); + boxes.emplace_back(a); + boxes.emplace_back(b); auto bc = boost::make_shared<BoxController>(1); std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> extentsVector(1); @@ -1633,7 +1633,7 @@ public: for (double ¢er : centers) center = flat(rng); // Create and add the event. - events.push_back(MDLeanEvent<3>(1.0, 1.0, centers)); + events.emplace_back(MDLeanEvent<3>(1.0, 1.0, centers)); } box3b->addEvents(events); diff --git a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h index 9f7942d76b539fb32de01e5381261f50392892b0..2eb342ac3d87309f8e26c213bec0cd08fa0c74eb 100644 --- a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h +++ b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h @@ -107,8 +107,8 @@ public: std::vector<coord_t> normal_vector; std::vector<coord_t> bound_vector; - normal_vector.push_back(1.); - bound_vector.push_back(3.); + normal_vector.emplace_back(1.); + bound_vector.emplace_back(3.); MDImplicitFunction *function = new MDImplicitFunction(); function->addPlane(MDPlane(normal_vector, bound_vector)); @@ -930,8 +930,8 @@ public: void test_neighbours_2d_vertex_touching_by_width_vector() { const size_t nd = 2; std::vector<int> widthVector; - widthVector.push_back(5); - widthVector.push_back(3); + widthVector.emplace_back(5); + widthVector.emplace_back(3); MDHistoWorkspace_sptr ws = MDEventsTestHelper::makeFakeMDHistoWorkspace(1.0, nd, 4); diff --git a/Framework/DataObjects/test/MDHistoWorkspaceTest.h b/Framework/DataObjects/test/MDHistoWorkspaceTest.h index 9d982b41f06c64c21b3fcad0a42fd7c1e2baa375..88f393ec266d59cc4595f060c088250841d48e99 100644 --- a/Framework/DataObjects/test/MDHistoWorkspaceTest.h +++ b/Framework/DataObjects/test/MDHistoWorkspaceTest.h @@ -221,7 +221,7 @@ public: std::vector<MDHistoDimension_sptr> dimensions; Mantid::Geometry::GeneralFrame frame("m", "m"); for (size_t i = 0; i < 7; i++) { - dimensions.push_back(MDHistoDimension_sptr( + dimensions.emplace_back(MDHistoDimension_sptr( new MDHistoDimension("Dim", "Dim", frame, -10, 10, 3))); } @@ -561,10 +561,10 @@ public: std::vector<coord_t> min; std::vector<coord_t> max; - min.push_back(0); - min.push_back(0); - max.push_back(5); - max.push_back(5); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(5); + max.emplace_back(5); // Mask part of the workspace auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -982,12 +982,12 @@ public: std::vector<coord_t> max; // Make the box that covers the whole workspace. - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(10); - max.push_back(10); - max.push_back(10); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(10); + max.emplace_back(10); + max.emplace_back(10); // Create an function that encompases ALL of the total bins. auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -1114,12 +1114,12 @@ public: std::vector<coord_t> max; // Make the box that covers half the bins in the workspace. - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(10); - max.push_back(10); - max.push_back(10); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(10); + max.emplace_back(10); + max.emplace_back(10); // Create an function that encompases ALL of the total bins. auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -1131,12 +1131,12 @@ public: std::vector<coord_t> max; // Make the box that covers half the bins in the workspace. - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(10); - max.push_back(10); - max.push_back(4.99f); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(10); + max.emplace_back(10); + max.emplace_back(4.99f); // Create an function that encompases 1/2 of the total bins. auto function = std::make_unique<MDBoxImplicitFunction>(min, max); @@ -1147,12 +1147,12 @@ public: // Create a function that masks everything. std::vector<coord_t> min; std::vector<coord_t> max; - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(10); - max.push_back(10); - max.push_back(10); + min.emplace_back(0); + min.emplace_back(0); + min.emplace_back(0); + max.emplace_back(10); + max.emplace_back(10); + max.emplace_back(10); auto function = std::make_unique<MDBoxImplicitFunction>(min, max); MDEventWorkspace3Lean::sptr ws = diff --git a/Framework/DataObjects/test/PeakShapeEllipsoidTest.h b/Framework/DataObjects/test/PeakShapeEllipsoidTest.h index 644f80f14a78a0e074b4c2da4460884935cb2ffa..ed148e15aa14d21dc6af32a058eca1f186adbe5d 100644 --- a/Framework/DataObjects/test/PeakShapeEllipsoidTest.h +++ b/Framework/DataObjects/test/PeakShapeEllipsoidTest.h @@ -206,13 +206,13 @@ public: frame, algorithmName, algorithmVersion); Mantid::Kernel::Matrix<double> matrix(3, 2); std::vector<double> column1; - column1.push_back(1.0); - column1.push_back(1.0); - column1.push_back(1.0); + column1.emplace_back(1.0); + column1.emplace_back(1.0); + column1.emplace_back(1.0); std::vector<double> column2; - column2.push_back(1.0); - column2.push_back(1.0); - column2.push_back(1.0); + column2.emplace_back(1.0); + column2.emplace_back(1.0); + column2.emplace_back(1.0); matrix.setColumn(0, column1); matrix.setColumn(1, column2); @@ -238,18 +238,18 @@ public: // 90 degree rotation around the z axis Mantid::Kernel::Matrix<double> matrix(3, 3); std::vector<double> column1; - column1.push_back(0.0); - column1.push_back(1.0); - column1.push_back(0.0); + column1.emplace_back(0.0); + column1.emplace_back(1.0); + column1.emplace_back(0.0); std::vector<double> column2; - column2.push_back(-1.0); - column2.push_back(0.0); - column2.push_back(0.0); + column2.emplace_back(-1.0); + column2.emplace_back(0.0); + column2.emplace_back(0.0); std::vector<double> column3; - column3.push_back(0.0); - column3.push_back(0.0); - column3.push_back(1.0); + column3.emplace_back(0.0); + column3.emplace_back(0.0); + column3.emplace_back(1.0); matrix.setColumn(0, column1); matrix.setColumn(1, column2); diff --git a/Framework/DataObjects/test/PeaksWorkspaceTest.h b/Framework/DataObjects/test/PeaksWorkspaceTest.h index 93501531dab7ee5e45c9fa20aae78ee9efb0ddf2..d6bbace757ec2227b4e9513ab10644950859bb07 100644 --- a/Framework/DataObjects/test/PeaksWorkspaceTest.h +++ b/Framework/DataObjects/test/PeaksWorkspaceTest.h @@ -111,8 +111,8 @@ public: std::vector<std::pair<std::string, bool>> criteria; // Sort by detector ID then descending wavelength - criteria.push_back(std::pair<std::string, bool>("detid", true)); - criteria.push_back(std::pair<std::string, bool>("wavelength", false)); + criteria.emplace_back(std::pair<std::string, bool>("detid", true)); + criteria.emplace_back(std::pair<std::string, bool>("wavelength", false)); pw->sort(criteria); TS_ASSERT_EQUALS(pw->getPeak(0).getDetectorID(), 1); TS_ASSERT_DELTA(pw->getPeak(0).getWavelength(), 5.0, 1e-5); @@ -125,8 +125,8 @@ public: // Sort by wavelength ascending then detID criteria.clear(); - criteria.push_back(std::pair<std::string, bool>("wavelength", true)); - criteria.push_back(std::pair<std::string, bool>("detid", true)); + criteria.emplace_back(std::pair<std::string, bool>("wavelength", true)); + criteria.emplace_back(std::pair<std::string, bool>("detid", true)); pw->sort(criteria); TS_ASSERT_EQUALS(pw->getPeak(0).getDetectorID(), 1); TS_ASSERT_DELTA(pw->getPeak(0).getWavelength(), 3.0, 1e-5); diff --git a/Framework/DataObjects/test/ScanningWorkspaceBuilderTest.h b/Framework/DataObjects/test/ScanningWorkspaceBuilderTest.h index 8c71477a9da1b6ce1f8927338abd272c1de35c8c..e7b55d9ebf18c6bffd3918f40e83f8da7ce23a3e 100644 --- a/Framework/DataObjects/test/ScanningWorkspaceBuilderTest.h +++ b/Framework/DataObjects/test/ScanningWorkspaceBuilderTest.h @@ -566,9 +566,9 @@ private: for (size_t i = 0; i < nDetectors; ++i) { std::vector<V3D> timePositions; for (size_t j = 0; j < nTimeIndexes; ++j) { - timePositions.push_back(V3D(double(i), double(j), 1.0)); + timePositions.emplace_back(V3D(double(i), double(j), 1.0)); } - positions.push_back(timePositions); + positions.emplace_back(timePositions); } } @@ -576,15 +576,15 @@ private: for (size_t i = 0; i < nDetectors; ++i) { std::vector<Quat> timeRotations; for (size_t j = 0; j < nTimeIndexes; ++j) { - timeRotations.push_back(Quat(double(i), double(j), 1.0, 2.0)); + timeRotations.emplace_back(Quat(double(i), double(j), 1.0, 2.0)); } - rotations.push_back(timeRotations); + rotations.emplace_back(timeRotations); } } void initialiseRelativeRotations(size_t nTimeIndexes) { for (size_t i = 0; i < nTimeIndexes; ++i) { - relativeRotations.push_back(double(i) * 30.0); + relativeRotations.emplace_back(double(i) * 30.0); } } @@ -621,7 +621,7 @@ public: std::vector<std::pair<DateAndTime, DateAndTime>> timeRanges; for (size_t i = 0; i < nTimeIndexes; ++i) { - timeRanges.push_back(std::pair<DateAndTime, DateAndTime>( + timeRanges.emplace_back(std::pair<DateAndTime, DateAndTime>( DateAndTime(i * 2), DateAndTime(i * 2 + 1))); } diff --git a/Framework/DataObjects/test/SplittersWorkspaceTest.h b/Framework/DataObjects/test/SplittersWorkspaceTest.h index b66d2acf48c971d664fe3dd54846f79bb22e43c6..88801cf541f0a80eeedd18f8901772b5ebc090c1 100644 --- a/Framework/DataObjects/test/SplittersWorkspaceTest.h +++ b/Framework/DataObjects/test/SplittersWorkspaceTest.h @@ -77,9 +77,9 @@ public: Types::Core::DateAndTime(50000), 2); std::vector<Kernel::SplittingInterval> splitters; - splitters.push_back(s1); - splitters.push_back(s2); - splitters.push_back(s3); + splitters.emplace_back(s1); + splitters.emplace_back(s2); + splitters.emplace_back(s3); TS_ASSERT_THROWS_NOTHING(splitterws.addSplitter(s1)); TS_ASSERT_THROWS_NOTHING(splitterws.addSplitter(s2)); diff --git a/Framework/DataObjects/test/VectorColumnTest.h b/Framework/DataObjects/test/VectorColumnTest.h index 3f127fd71f360bbd3e7c84c75a1895efcec78068..53e4b3754abebf0462cd14e3a2e52453ff834875 100644 --- a/Framework/DataObjects/test/VectorColumnTest.h +++ b/Framework/DataObjects/test/VectorColumnTest.h @@ -43,23 +43,23 @@ public: // Simple case TS_ASSERT_THROWS_NOTHING(col.read(0, "1,2,3")); std::vector<int> v1; - v1.push_back(1); - v1.push_back(2); - v1.push_back(3); + v1.emplace_back(1); + v1.emplace_back(2); + v1.emplace_back(3); TS_ASSERT_EQUALS(col.cell<std::vector<int>>(0), v1); // Check if trimming works TS_ASSERT_THROWS_NOTHING(col.read(1, " 4, 5, 6")); std::vector<int> v2; - v2.push_back(4); - v2.push_back(5); - v2.push_back(6); + v2.emplace_back(4); + v2.emplace_back(5); + v2.emplace_back(6); TS_ASSERT_EQUALS(col.cell<std::vector<int>>(1), v2); // Single element TS_ASSERT_THROWS_NOTHING(col.read(2, "7")); std::vector<int> v3; - v3.push_back(7); + v3.emplace_back(7); TS_ASSERT_EQUALS(col.cell<std::vector<int>>(2), v3); // Empty string @@ -79,11 +79,11 @@ public: // Simple case std::vector<int> v1; - v1.push_back(11); - v1.push_back(22); - v1.push_back(33); - v1.push_back(44); - v1.push_back(55); + v1.emplace_back(11); + v1.emplace_back(22); + v1.emplace_back(33); + v1.emplace_back(44); + v1.emplace_back(55); col.cell<std::vector<int>>(0) = v1; std::ostringstream s1; TS_ASSERT_THROWS_NOTHING(col.print(0, s1)); @@ -91,7 +91,7 @@ public: // Single element std::vector<int> v2; - v2.push_back(9876); + v2.emplace_back(9876); col.cell<std::vector<int>>(1) = v2; std::ostringstream s2; TS_ASSERT_THROWS_NOTHING(col.print(1, s2)); diff --git a/Framework/DataObjects/test/Workspace2DTest.h b/Framework/DataObjects/test/Workspace2DTest.h index 38a40903c8d442235f08e28c5ff68644a89c01f2..fcd8778d7189b0d53cf2cc092affb06e91a10ed4 100644 --- a/Framework/DataObjects/test/Workspace2DTest.h +++ b/Framework/DataObjects/test/Workspace2DTest.h @@ -181,9 +181,9 @@ public: void test_generateHistogram() { Workspace2D_sptr ws = create2DWorkspaceBinned(2, 5); MantidVec X, Y, E; - X.push_back(0.0); - X.push_back(0.5); - X.push_back(1.0); + X.emplace_back(0.0); + X.emplace_back(0.5); + X.emplace_back(1.0); TS_ASSERT_THROWS_ANYTHING(ws->generateHistogram(2, X, Y, E);); TS_ASSERT_THROWS_NOTHING(ws->generateHistogram(0, X, Y, E);); TS_ASSERT_EQUALS(Y.size(), 2); diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h b/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h index 9f15b2d5c45be1cfd4b6bb9b77a163ce13b96092..c43ccfe1c0ea23e9611b916ca78caf36b52e26b5 100644 --- a/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h +++ b/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h @@ -41,7 +41,7 @@ namespace Geometry { ... hkl = V3D(h, k, l) if(isOk(hkl)) { - hkls.push_back(hkl); + hkls.emplace_back(hkl); } ... @@ -51,7 +51,7 @@ namespace Geometry { HKLGenerator generator(V3D(hmin, kmin, lmin), V3D(hmax, kmax, lmax)); for(auto hkl = generator.begin(); hkl != generator.end(); ++hkl) { - hkls.push_back(*hkl); + hkls.emplace_back(*hkl); } Or even shorter, using std::copy: diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/MatrixVectorPairParser.h b/Framework/Geometry/inc/MantidGeometry/Crystal/MatrixVectorPairParser.h index ef389b25e35551603d52cc282273bd0d9d7d98bf..a8822c85c1aa3c0cf09b837431704395acd02966 100644 --- a/Framework/Geometry/inc/MantidGeometry/Crystal/MatrixVectorPairParser.h +++ b/Framework/Geometry/inc/MantidGeometry/Crystal/MatrixVectorPairParser.h @@ -43,9 +43,9 @@ public: std::vector<T> typedMatrixElements; for (const auto &rb : m_matrixRows) { - typedMatrixElements.push_back(boost::rational_cast<T>((rb).x())); - typedMatrixElements.push_back(boost::rational_cast<T>((rb).y())); - typedMatrixElements.push_back(boost::rational_cast<T>((rb).z())); + typedMatrixElements.emplace_back(boost::rational_cast<T>((rb).x())); + typedMatrixElements.emplace_back(boost::rational_cast<T>((rb).y())); + typedMatrixElements.emplace_back(boost::rational_cast<T>((rb).z())); } Kernel::Matrix<T> mat(typedMatrixElements); diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/SpaceGroupFactory.h b/Framework/Geometry/inc/MantidGeometry/Crystal/SpaceGroupFactory.h index 11476625d0d46d71709842cdd7de5ad1ebdbc002..6f66028ca36b1ac1780ff1182b404a96d5485ba8 100644 --- a/Framework/Geometry/inc/MantidGeometry/Crystal/SpaceGroupFactory.h +++ b/Framework/Geometry/inc/MantidGeometry/Crystal/SpaceGroupFactory.h @@ -224,7 +224,7 @@ public: subscribeUsingGenerator<TransformationSpaceGroupGenerator>( number, transformedSymbol, std::string(hmSymbol).append("|").append(transformation)); - transformedSpaceGroupSymbols.push_back(transformedSymbol); + transformedSpaceGroupSymbols.emplace_back(transformedSymbol); } } } diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h b/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h index 99d205f9ea7e67ed1ee735f0817414e4759528bb..f975e090486884b9cb12e062357b2e47691f4188 100644 --- a/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h +++ b/Framework/Geometry/inc/MantidGeometry/Instrument/ParameterMap.h @@ -241,7 +241,7 @@ public: if (compName == it->first->getName()) { boost::shared_ptr<Parameter> param = get(it->first, name); if (param) - retval.push_back(param->value<T>()); + retval.emplace_back(param->value<T>()); } } return retval; diff --git a/Framework/Geometry/src/ComponentParser.cpp b/Framework/Geometry/src/ComponentParser.cpp index 3cd6413d37709441b1ba071117fe39bc231a8bec..9548736b871bc829d432b380006c71dccb8f051d 100644 --- a/Framework/Geometry/src/ComponentParser.cpp +++ b/Framework/Geometry/src/ComponentParser.cpp @@ -51,7 +51,7 @@ void ComponentParser::startElement(const Poco::XML::XMLString & /*uri*/, // A new component was created if (newComp) { - m_current.push_back(newComp); + m_current.emplace_back(newComp); // Read the attributes into the new component newComp->readXMLAttributes(attr); } diff --git a/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp b/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp index 58809739318da2c928d1b3385ae1d37a2b2ec747..6d130dc118989e48604380ec0c903cd94cc8ff9a 100644 --- a/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp +++ b/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp @@ -160,7 +160,7 @@ void CompositeBraggScatterer::addScattererImplementation( } BraggScatterer_sptr localScatterer = scatterer->clone(); - m_scatterers.push_back(localScatterer); + m_scatterers.emplace_back(localScatterer); } /** diff --git a/Framework/Geometry/src/Crystal/CyclicGroup.cpp b/Framework/Geometry/src/Crystal/CyclicGroup.cpp index cd2385b74e1cd9941ddd6c9957d5e83f85c5fdc2..34d8a9ace1659f8d59a696c49e7df66fb2f66476 100644 --- a/Framework/Geometry/src/Crystal/CyclicGroup.cpp +++ b/Framework/Geometry/src/Crystal/CyclicGroup.cpp @@ -29,7 +29,7 @@ CyclicGroup::generateAllOperations(const SymmetryOperation &operation) const { std::vector<SymmetryOperation> symOps(1, operation); symOps.reserve(operation.order()); for (size_t i = 1; i < operation.order(); ++i) { - symOps.push_back(operation * symOps.back()); + symOps.emplace_back(operation * symOps.back()); } return symOps; diff --git a/Framework/Geometry/src/Crystal/IndexingUtils.cpp b/Framework/Geometry/src/Crystal/IndexingUtils.cpp index 0425ff10c328188c43532b0d11c1f71009fcc3db..de6612f3ef4eb17281dae33b922737b076743deb 100644 --- a/Framework/Geometry/src/Crystal/IndexingUtils.cpp +++ b/Framework/Geometry/src/Crystal/IndexingUtils.cpp @@ -142,7 +142,7 @@ double IndexingUtils::Find_UB(DblMatrix &UB, const std::vector<V3D> &q_vectors, if (i != mid_ind) { V3D shifted_vec(shifted_qs[i]); shifted_vec -= mid_vec; - sorted_qs.push_back(shifted_vec); + sorted_qs.emplace_back(shifted_vec); } } } else { @@ -159,7 +159,7 @@ double IndexingUtils::Find_UB(DblMatrix &UB, const std::vector<V3D> &q_vectors, some_qs.reserve(q_vectors.size()); for (size_t i = 0; i < num_initial; i++) - some_qs.push_back(sorted_qs[i]); + some_qs.emplace_back(sorted_qs[i]); ScanFor_UB(UB, some_qs, lattice, degrees_per_step, required_tolerance); @@ -180,7 +180,7 @@ double IndexingUtils::Find_UB(DblMatrix &UB, const std::vector<V3D> &q_vectors, num_initial = sorted_qs.size(); for (size_t i = some_qs.size(); i < num_initial; i++) - some_qs.push_back(sorted_qs[i]); + some_qs.emplace_back(sorted_qs[i]); for (int counter = 0; counter < iterations; counter++) { try { GetIndexedPeaks(UB, some_qs, required_tolerance, miller_ind, indexed_qs, @@ -339,7 +339,7 @@ double IndexingUtils::Find_UB(DblMatrix &UB, const std::vector<V3D> &q_vectors, if (i != mid_ind) { V3D shifted_vec(shifted_qs[i]); shifted_vec -= mid_vec; - sorted_qs.push_back(shifted_vec); + sorted_qs.emplace_back(shifted_vec); } } } else { @@ -356,7 +356,7 @@ double IndexingUtils::Find_UB(DblMatrix &UB, const std::vector<V3D> &q_vectors, some_qs.reserve(q_vectors.size()); for (size_t i = 0; i < num_initial; i++) - some_qs.push_back(sorted_qs[i]); + some_qs.emplace_back(sorted_qs[i]); std::vector<V3D> directions; ScanFor_Directions(directions, some_qs, min_d, max_d, required_tolerance, degrees_per_step); @@ -390,7 +390,7 @@ double IndexingUtils::Find_UB(DblMatrix &UB, const std::vector<V3D> &q_vectors, num_initial = sorted_qs.size(); for (size_t i = some_qs.size(); i < num_initial; i++) - some_qs.push_back(sorted_qs[i]); + some_qs.emplace_back(sorted_qs[i]); GetIndexedPeaks(UB, some_qs, required_tolerance, miller_ind, indexed_qs, fit_error); @@ -1290,9 +1290,9 @@ double IndexingUtils::ScanFor_UB(DblMatrix &UB, max_indexed = num_indexed; } if (num_indexed == max_indexed) { - selected_a_dirs.push_back(a_dir_temp); - selected_b_dirs.push_back(b_dir_temp); - selected_c_dirs.push_back(c_dir_temp); + selected_a_dirs.emplace_back(a_dir_temp); + selected_b_dirs.emplace_back(b_dir_temp); + selected_c_dirs.emplace_back(c_dir_temp); } } } @@ -1452,7 +1452,7 @@ size_t IndexingUtils::ScanFor_Directions(std::vector<V3D> &directions, } } if (!duplicate) { - directions.push_back(current_dir); + directions.emplace_back(current_dir); } } } @@ -1555,7 +1555,7 @@ size_t IndexingUtils::FFTScanFor_Directions(std::vector<V3D> &directions, std::vector<V3D> temp_dirs; for (size_t i = 0; i < max_fft_val.size(); i++) { if (max_fft_val[i] >= threshold) { - temp_dirs.push_back(full_list[i]); + temp_dirs.emplace_back(full_list[i]); } } // now scan through temp_dirs and use the @@ -1576,7 +1576,7 @@ size_t IndexingUtils::FFTScanFor_Directions(std::vector<V3D> &directions, double d_val = 1 / q_val; if (d_val >= 0.8 * min_d && d_val <= 1.2 * max_d) { temp = temp_dir * d_val; - temp_dirs_2.push_back(temp); + temp_dirs_2.emplace_back(temp); } } } @@ -1599,7 +1599,7 @@ size_t IndexingUtils::FFTScanFor_Directions(std::vector<V3D> &directions, current_dir = dir_num; num_indexed = NumberIndexed_1D(current_dir, q_vectors, required_tolerance); if (num_indexed >= 0.50 * max_indexed) - temp_dirs.push_back(current_dir); + temp_dirs.emplace_back(current_dir); } // refine directions and again find the // max number indexed, for the optimized @@ -1634,7 +1634,7 @@ size_t IndexingUtils::FFTScanFor_Directions(std::vector<V3D> &directions, current_dir = temp_dir; double length = current_dir.norm(); if (length >= 0.8 * min_d && length <= 1.2 * max_d) - temp_dirs_2.push_back(current_dir); + temp_dirs_2.emplace_back(current_dir); } // only keep directions that index at // least 75% of the max number of peaks @@ -1643,7 +1643,7 @@ size_t IndexingUtils::FFTScanFor_Directions(std::vector<V3D> &directions, current_dir = dir_num; num_indexed = NumberIndexed_1D(current_dir, q_vectors, required_tolerance); if (num_indexed > max_indexed * 0.75) - temp_dirs.push_back(current_dir); + temp_dirs.emplace_back(current_dir); } std::sort(temp_dirs.begin(), temp_dirs.end(), V3D::compareMagnitude); @@ -2048,7 +2048,7 @@ void IndexingUtils::DiscardDuplicates(std::vector<V3D> &new_list, if (current_length > 0) // skip any zero vectors { temp.clear(); - temp.push_back(current_dir); + temp.emplace_back(current_dir); check_index = dir_num; new_dir = false; while (check_index < directions.size() && !new_dir) { @@ -2062,7 +2062,7 @@ void IndexingUtils::DiscardDuplicates(std::vector<V3D> &new_list, if ((std::isnan)(angle)) angle = 0; if ((angle < ang_tol) || (angle > (180.0 - ang_tol))) { - temp.push_back(next_dir); + temp.emplace_back(next_dir); directions[check_index] = zero_vec; // mark off this direction } // since it was duplicate @@ -2091,7 +2091,7 @@ void IndexingUtils::DiscardDuplicates(std::vector<V3D> &new_list, if (max_indexed > 0) // don't bother to add any direction { // that doesn't index anything - new_list.push_back(temp[max_i]); + new_list.emplace_back(temp[max_i]); } } } @@ -2537,8 +2537,8 @@ int IndexingUtils::GetIndexedPeaks_1D(const V3D &direction, double error = fabs(proj_value - nearest_int); if (error < required_tolerance) { fit_error += error * error; - indexed_qs.push_back(q_vector); - index_vals.push_back(boost::numeric_cast<int>(nearest_int)); + indexed_qs.emplace_back(q_vector); + index_vals.emplace_back(boost::numeric_cast<int>(nearest_int)); num_indexed++; } } @@ -2616,10 +2616,10 @@ int IndexingUtils::GetIndexedPeaks_3D( fit_error += h_error * h_error + k_error * k_error + l_error * l_error; - indexed_qs.push_back(q_vector); + indexed_qs.emplace_back(q_vector); V3D miller_ind(h_int, k_int, l_int); - miller_indices.push_back(miller_ind); + miller_indices.emplace_back(miller_ind); num_indexed++; } @@ -2687,10 +2687,10 @@ int IndexingUtils::GetIndexedPeaks(const DblMatrix &UB, fit_error += error * error; } - indexed_qs.push_back(q_vector); + indexed_qs.emplace_back(q_vector); V3D miller_ind(round(hkl[0]), round(hkl[1]), round(hkl[2])); - miller_indices.push_back(miller_ind); + miller_indices.emplace_back(miller_ind); num_indexed++; } @@ -2817,7 +2817,7 @@ std::vector<V3D> IndexingUtils::MakeCircleDirections(int n_steps, V3D vec(vector_at_angle); rotation_2.setAngleAxis(i * angle_step, axis); rotation_2.rotate(vec); - directions.push_back(vec); + directions.emplace_back(vec); } return directions; @@ -2916,16 +2916,16 @@ bool IndexingUtils::GetLatticeParameters(const DblMatrix &UB, o_lattice.setUB(UB); lattice_par.clear(); - lattice_par.push_back(o_lattice.a()); - lattice_par.push_back(o_lattice.b()); - lattice_par.push_back(o_lattice.c()); + lattice_par.emplace_back(o_lattice.a()); + lattice_par.emplace_back(o_lattice.b()); + lattice_par.emplace_back(o_lattice.c()); - lattice_par.push_back(o_lattice.alpha()); - lattice_par.push_back(o_lattice.beta()); - lattice_par.push_back(o_lattice.gamma()); + lattice_par.emplace_back(o_lattice.alpha()); + lattice_par.emplace_back(o_lattice.beta()); + lattice_par.emplace_back(o_lattice.gamma()); - lattice_par.push_back(o_lattice.volume()); // keep volume > 0 even if - // cell is left handed + lattice_par.emplace_back(o_lattice.volume()); // keep volume > 0 even if + // cell is left handed return true; } diff --git a/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp b/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp index af7fa375180b23a38c0bbc41aa8bbba200b492f3..9f55e2d77029a1c97c92eb6f5fa799d1a0e1a986 100644 --- a/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp +++ b/Framework/Geometry/src/Crystal/IsotropicAtomBraggScatterer.cpp @@ -204,14 +204,14 @@ IsotropicAtomBraggScattererParser::getCleanScattererTokens( std::vector<std::string> cleanTokens; // Element - cleanTokens.push_back(tokens[0]); + cleanTokens.emplace_back(tokens[0]); // X, Y, Z cleanTokens.emplace_back("[" + tokens[1] + "," + tokens[2] + "," + tokens[3] + "]"); for (size_t i = 4; i < tokens.size(); ++i) { - cleanTokens.push_back(tokens[i]); + cleanTokens.emplace_back(tokens[i]); } return cleanTokens; diff --git a/Framework/Geometry/src/Crystal/NiggliCell.cpp b/Framework/Geometry/src/Crystal/NiggliCell.cpp index 573a78717d7dc037a6726bdc51639fabc63cd24b..4aa713e6253ca907977cf877d71133f70a2bd201 100644 --- a/Framework/Geometry/src/Crystal/NiggliCell.cpp +++ b/Framework/Geometry/src/Crystal/NiggliCell.cpp @@ -212,7 +212,7 @@ bool NiggliCell::MakeNiggliUB(const DblMatrix &UB, DblMatrix &newUB) { V3D sum(v1); sum += v2; sum += v3; - directions.push_back(sum); + directions.emplace_back(sum); } } } @@ -249,7 +249,7 @@ bool NiggliCell::MakeNiggliUB(const DblMatrix &UB, DblMatrix &newUB) { if (vol > min_vol && HasNiggliAngles(a, b, c, 0.01)) { Matrix<double> new_tran(3, 3, false); OrientedLattice::GetUB(new_tran, a, b, c); - UB_list.push_back(new_tran); + UB_list.emplace_back(new_tran); } } } @@ -273,7 +273,7 @@ bool NiggliCell::MakeNiggliUB(const DblMatrix &UB, DblMatrix &newUB) { double total_length; std::vector<DblMatrix> short_list; - short_list.push_back(UB_list[0]); + short_list.emplace_back(UB_list[0]); OrientedLattice::GetABC(short_list[0], a, b, c); total_length = a.norm() + b.norm() + c.norm(); @@ -283,7 +283,7 @@ bool NiggliCell::MakeNiggliUB(const DblMatrix &UB, DblMatrix &newUB) { OrientedLattice::GetABC(UB_list[i], v1, v2, v3); double next_length = v1.norm() + v2.norm() + v3.norm(); if (fabs(next_length - total_length) / total_length < length_tol) - short_list.push_back(UB_list[i]); + short_list.emplace_back(UB_list[i]); else got_short_list = true; i++; diff --git a/Framework/Geometry/src/Crystal/PointGroupFactory.cpp b/Framework/Geometry/src/Crystal/PointGroupFactory.cpp index 22769d50b8dff70bf147e991fe4bd62d33574d86..1ac29008371db555e1c22b1296a73278e8859535 100644 --- a/Framework/Geometry/src/Crystal/PointGroupFactory.cpp +++ b/Framework/Geometry/src/Crystal/PointGroupFactory.cpp @@ -80,7 +80,7 @@ std::vector<std::string> PointGroupFactoryImpl::getPointGroupSymbols( PointGroup_sptr pointGroup = getPrototype(generator.first); if (pointGroup->crystalSystem() == crystalSystem) { - pointGroups.push_back(generator.first); + pointGroups.emplace_back(generator.first); } } diff --git a/Framework/Geometry/src/Crystal/ReflectionGenerator.cpp b/Framework/Geometry/src/Crystal/ReflectionGenerator.cpp index 417481b5748d657a81cc99cd0b50725019d7408c..cb496eb7b7a02381e7f00c94fc4ef40f640cfb23 100644 --- a/Framework/Geometry/src/Crystal/ReflectionGenerator.cpp +++ b/Framework/Geometry/src/Crystal/ReflectionGenerator.cpp @@ -118,7 +118,7 @@ std::vector<V3D> ReflectionGenerator::getUniqueHKLs( for (auto hkl = generator.begin(); hkl != generator.end(); ++hkl) { if (filter->isAllowed(*hkl)) { - hkls.push_back(pg->getReflectionFamily(*hkl)); + hkls.emplace_back(pg->getReflectionFamily(*hkl)); } } diff --git a/Framework/Geometry/src/Crystal/ScalarUtils.cpp b/Framework/Geometry/src/Crystal/ScalarUtils.cpp index 7c01024ad0600fd3aaa6b8a55a35013ee3317d1a..967506cb6144c93d4af8295289fec9ccb654d025 100644 --- a/Framework/Geometry/src/Crystal/ScalarUtils.cpp +++ b/Framework/Geometry/src/Crystal/ScalarUtils.cpp @@ -100,7 +100,7 @@ std::vector<ConventionalCell> ScalarUtils::GetCells(const DblMatrix &UB, if (best_only) { ConventionalCell info = GetCellBestError(temp, true); temp.clear(); - temp.push_back(info); + temp.emplace_back(info); } for (auto &k : temp) AddIfBest(result, k); @@ -147,7 +147,7 @@ ScalarUtils::GetCells(const DblMatrix &UB, const std::string &cell_type, UB_list = GetRelatedUBs(UB, length_factor, angle_tolerance); } else { // Get exact form requested and not permutations - UB_list.push_back(UB); + UB_list.emplace_back(UB); } for (auto &k : UB_list) { @@ -199,7 +199,7 @@ ScalarUtils::GetCellsUBOnly(const DblMatrix &UB, const std::string &cell_type, if (rcell.GetCentering() == centering && rcell.GetCellType() == cell_type) { ConventionalCell cell_info(UB, i, allowPermutations); - result.push_back(cell_info); + result.emplace_back(cell_info); } } @@ -239,7 +239,7 @@ ConventionalCell ScalarUtils::GetCellForForm(const DblMatrix &UB, UB_list = GetRelatedUBs(UB, length_factor, angle_tolerance); } else { // Get exact form requested and not permutations - UB_list.push_back(UB); + UB_list.emplace_back(UB); } for (auto &UB : UB_list) { IndexingUtils::GetLatticeParameters(UB, l_params); @@ -419,7 +419,7 @@ std::vector<DblMatrix> ScalarUtils::GetRelatedUBs(const DblMatrix &UB, { // experimental error Matrix<double> temp_UB(3, 3, false); OrientedLattice::GetUB(temp_UB, a, b, c); - result.push_back(temp_UB); + result.emplace_back(temp_UB); } } } @@ -458,5 +458,5 @@ void ScalarUtils::AddIfBest(std::vector<ConventionalCell> &list, } if (!done) // if never found, add to end of list - list.push_back(info); + list.emplace_back(info); } diff --git a/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp b/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp index 08a16b8d40fdab631ab76eee052bac79486cc3e2..bed1ee7352db121b63ec4393d36571a472929615 100644 --- a/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp +++ b/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp @@ -269,7 +269,7 @@ SpaceGroupFactoryImpl::subscribedSpaceGroupSymbols(size_t number) const { auto keyPair = m_numberMap.equal_range(number); for (auto it = keyPair.first; it != keyPair.second; ++it) { - symbols.push_back(it->second); + symbols.emplace_back(it->second); } return symbols; @@ -282,7 +282,7 @@ std::vector<size_t> SpaceGroupFactoryImpl::subscribedSpaceGroupNumbers() const { for (auto it = m_numberMap.begin(); it != m_numberMap.end(); it = m_numberMap.upper_bound(it->first)) { - numbers.push_back(it->first); + numbers.emplace_back(it->first); } return numbers; @@ -300,7 +300,7 @@ std::vector<std::string> SpaceGroupFactoryImpl::subscribedSpaceGroupSymbols( auto keyPair = m_pointGroupMap.equal_range(pointGroupSymbol); for (auto it = keyPair.first; it != keyPair.second; ++it) { - symbols.push_back(it->second); + symbols.emplace_back(it->second); } return symbols; diff --git a/Framework/Geometry/src/Crystal/StructureFactorCalculatorSummation.cpp b/Framework/Geometry/src/Crystal/StructureFactorCalculatorSummation.cpp index 05c0005dade4b2175747ad28f040a11a5b75a9f2..58cdf39d18da9963df9dd4b2e22649aa3dc6f933 100644 --- a/Framework/Geometry/src/Crystal/StructureFactorCalculatorSummation.cpp +++ b/Framework/Geometry/src/Crystal/StructureFactorCalculatorSummation.cpp @@ -65,7 +65,7 @@ void StructureFactorCalculatorSummation::updateUnitCellScatterers( BraggScatterer_sptr clone = current->clone(); clone->setProperty("Position", getV3DasString(position)); - braggScatterers.push_back(clone); + braggScatterers.emplace_back(clone); } } } diff --git a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp index 0759cb3dcd47abc53daa2d6d43509fb37a9dd9da..d6079244c57a0c917205e28864c6e6f7aef748da 100644 --- a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp @@ -361,7 +361,7 @@ bool SymmetryElementFactoryImpl::isSubscribed( void SymmetryElementFactoryImpl::subscribe( const AbstractSymmetryElementGenerator_sptr &generator, const std::string &generatorClassName) { - m_generators.push_back(generator); + m_generators.emplace_back(generator); m_generatorNames.insert(generatorClassName); } diff --git a/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp b/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp index 514dce89df13ae22f829f0a83644758892ab4a47..f87308c82e53873d42bc52d040cab1fed5cfd18b 100644 --- a/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp @@ -125,7 +125,7 @@ std::string SymmetryOperationSymbolParser::getNormalizedIdentifier( } } - components.push_back(currentComponent.str()); + components.emplace_back(currentComponent.str()); } return boost::join(components, ","); diff --git a/Framework/Geometry/src/Crystal/V3R.cpp b/Framework/Geometry/src/Crystal/V3R.cpp index 26070d991133a53e237aba914120d56218aecf88..9924cea8cd16d4ddc5e115e7c85a6b392f3fc2f2 100644 --- a/Framework/Geometry/src/Crystal/V3R.cpp +++ b/Framework/Geometry/src/Crystal/V3R.cpp @@ -314,9 +314,9 @@ V3R V3R::getPositiveVector() const { /// Returns an std::vector<double> with approximations of the components. V3R::operator std::vector<double>() const { std::vector<double> vector; - vector.push_back(boost::rational_cast<double>(m_x)); - vector.push_back(boost::rational_cast<double>(m_y)); - vector.push_back(boost::rational_cast<double>(m_z)); + vector.emplace_back(boost::rational_cast<double>(m_x)); + vector.emplace_back(boost::rational_cast<double>(m_y)); + vector.emplace_back(boost::rational_cast<double>(m_z)); return vector; } diff --git a/Framework/Geometry/src/Instrument.cpp b/Framework/Geometry/src/Instrument.cpp index 837bfd16b5f23b8b56b82a7beb78dd4f5c4451a4..9068d133340f54d1e3685a370b31313b703cc1e3 100644 --- a/Framework/Geometry/src/Instrument.cpp +++ b/Framework/Geometry/src/Instrument.cpp @@ -216,12 +216,12 @@ std::vector<detid_t> Instrument::getDetectorIDs(bool skipMonitors) const { const auto &in_dets = m_instr->m_detectorCache; for (const auto &in_det : in_dets) if (!skipMonitors || !std::get<2>(in_det)) - out.push_back(std::get<0>(in_det)); + out.emplace_back(std::get<0>(in_det)); } else { const auto &in_dets = m_detectorCache; for (const auto &in_det : in_dets) if (!skipMonitors || !std::get<2>(in_det)) - out.push_back(std::get<0>(in_det)); + out.emplace_back(std::get<0>(in_det)); } return out; } @@ -293,7 +293,7 @@ void Instrument::getDetectorsInBank(std::vector<IDetector_const_sptr> &dets, IDetector_const_sptr det = boost::dynamic_pointer_cast<const IDetector>(*it); if (det) { - dets.push_back(det); + dets.emplace_back(det); } } } @@ -411,12 +411,12 @@ Instrument::getAllComponentsWithName(const std::string &cname) const { std::vector<boost::shared_ptr<const IComponent>> retVec; // Check the instrument name first if (this->getName() == cname) { - retVec.push_back(node); + retVec.emplace_back(node); } // Same algorithm as used in getComponentByName() but searching the full tree std::deque<boost::shared_ptr<const IComponent>> nodeQueue; // Need to be able to enter the while loop - nodeQueue.push_back(node); + nodeQueue.emplace_back(node); while (!nodeQueue.empty()) { node = nodeQueue.front(); nodeQueue.pop_front(); @@ -429,9 +429,9 @@ Instrument::getAllComponentsWithName(const std::string &cname) const { for (int i = 0; i < nchildren; ++i) { boost::shared_ptr<const IComponent> comp = (*asmb)[i]; if (comp->getName() == cname) { - retVec.push_back(comp); + retVec.emplace_back(comp); } else { - nodeQueue.push_back(comp); + nodeQueue.emplace_back(comp); } } } // while-end @@ -553,7 +553,7 @@ Instrument::getDetectors(const std::vector<detid_t> &det_ids) const { dets_ptr.reserve(det_ids.size()); std::vector<detid_t>::const_iterator it; for (it = det_ids.begin(); it != det_ids.end(); ++it) { - dets_ptr.push_back(this->getDetector(*it)); + dets_ptr.emplace_back(this->getDetector(*it)); } return dets_ptr; } @@ -568,7 +568,7 @@ Instrument::getDetectors(const std::set<detid_t> &det_ids) const { dets_ptr.reserve(det_ids.size()); std::set<detid_t>::const_iterator it; for (it = det_ids.begin(); it != det_ids.end(); ++it) { - dets_ptr.push_back(this->getDetector(*it)); + dets_ptr.emplace_back(this->getDetector(*it)); } return dets_ptr; } @@ -742,7 +742,7 @@ std::vector<detid_t> Instrument::getMonitors() const { std::vector<detid_t> mons; for (const auto &item : m_detectorCache) if (std::get<2>(item)) - mons.push_back(std::get<0>(item)); + mons.emplace_back(std::get<0>(item)); return mons; } @@ -830,9 +830,9 @@ void Instrument::appendPlottable( auto *d = dynamic_cast<Detector *>(c); auto *o = dynamic_cast<ObjComponent *>(c); if (d) - lst.push_back(IObjComponent_const_sptr(d, NoDeleting())); + lst.emplace_back(IObjComponent_const_sptr(d, NoDeleting())); else if (o) - lst.push_back(IObjComponent_const_sptr(o, NoDeleting())); + lst.emplace_back(IObjComponent_const_sptr(o, NoDeleting())); else g_log.error() << "Unknown comp type\n"; } @@ -960,7 +960,7 @@ void Instrument::saveNexus(::NeXus::File *file, std::vector<detid_t> monitorIDs; for (size_t i = 0; i < detmonIDs.size(); i++) { if (isMonitorViaIndex(i)) - monitorIDs.push_back(detmonIDs[i]); + monitorIDs.emplace_back(detmonIDs[i]); } // Add Monitors group diff --git a/Framework/Geometry/src/Instrument/CompAssembly.cpp b/Framework/Geometry/src/Instrument/CompAssembly.cpp index bd08fca863e5ff1ae48b137d7796f15d3d1e856c..35bca9aece06b2749e16abf14ab4934b15aea48c 100644 --- a/Framework/Geometry/src/Instrument/CompAssembly.cpp +++ b/Framework/Geometry/src/Instrument/CompAssembly.cpp @@ -99,7 +99,7 @@ int CompAssembly::add(IComponent *comp) { if (comp) { comp->setParent(this); - m_children.push_back(comp); + m_children.emplace_back(comp); } return static_cast<int>(m_children.size()); } @@ -120,7 +120,7 @@ int CompAssembly::addCopy(IComponent *comp) { if (comp) { IComponent *newcomp = comp->clone(); newcomp->setParent(this); - m_children.push_back(newcomp); + m_children.emplace_back(newcomp); } return static_cast<int>(m_children.size()); } @@ -143,7 +143,7 @@ int CompAssembly::addCopy(IComponent *comp, const std::string &n) { IComponent *newcomp = comp->clone(); newcomp->setParent(this); newcomp->setName(n); - m_children.push_back(newcomp); + m_children.emplace_back(newcomp); } return static_cast<int>(m_children.size()); } @@ -235,7 +235,7 @@ void CompAssembly::getChildren(std::vector<IComponent_const_sptr> &outVector, for (int i = 0; i < this->nelements(); i++) { boost::shared_ptr<IComponent> comp = this->getChild(i); if (comp) { - outVector.push_back(comp); + outVector.emplace_back(comp); // Look deeper, on option. if (recursive) { boost::shared_ptr<ICompAssembly> assemb = @@ -343,7 +343,7 @@ CompAssembly::getComponentByName(const std::string &cname, int nlevels) const { boost::shared_ptr<const ICompAssembly> compAssembly = boost::dynamic_pointer_cast<const ICompAssembly>(comp); if (bool(compAssembly)) { - nodeQueue.push_back(compAssembly); + nodeQueue.emplace_back(compAssembly); } } } @@ -413,7 +413,7 @@ void CompAssembly::testIntersectionWithChildren( boost::shared_ptr<Geometry::IComponent> comp = this->getChild(i); if (ICompAssembly_sptr childAssembly = boost::dynamic_pointer_cast<ICompAssembly>(comp)) { - searchQueue.push_back(comp); + searchQueue.emplace_back(comp); } // Check the physical object intersection else if (auto *physicalObject = dynamic_cast<IObjComponent *>(comp.get())) { diff --git a/Framework/Geometry/src/Instrument/Component.cpp b/Framework/Geometry/src/Instrument/Component.cpp index 8e88ed812528e00c1cf524a8c62335b02d8b6427..ec8697f6193ad67eebfdad41a4c10be09cda8563 100644 --- a/Framework/Geometry/src/Instrument/Component.cpp +++ b/Framework/Geometry/src/Instrument/Component.cpp @@ -159,7 +159,7 @@ Component::getAncestors() const { boost::shared_ptr<const IComponent> current = this->getParent(); while (current) { - ancs.push_back(current); + ancs.emplace_back(current); current = current->getParent(); } return ancs; diff --git a/Framework/Geometry/src/Instrument/DetectorGroup.cpp b/Framework/Geometry/src/Instrument/DetectorGroup.cpp index 10f539925a66822e2c7f2eabb88b7be3effbb5fd..74c79baaeb2481b6841add62b78bf9d6b6722f10 100644 --- a/Framework/Geometry/src/Instrument/DetectorGroup.cpp +++ b/Framework/Geometry/src/Instrument/DetectorGroup.cpp @@ -172,7 +172,7 @@ std::vector<detid_t> DetectorGroup::getDetectorIDs() const { result.reserve(m_detectors.size()); DetCollection::const_iterator it; for (it = m_detectors.begin(); it != m_detectors.end(); ++it) { - result.push_back((*it).first); + result.emplace_back((*it).first); } return result; } @@ -186,7 +186,7 @@ std::vector<IDetector_const_sptr> DetectorGroup::getDetectors() const { result.reserve(m_detectors.size()); DetCollection::const_iterator it; for (it = m_detectors.begin(); it != m_detectors.end(); ++it) { - result.push_back((*it).second); + result.emplace_back((*it).second); } return result; } diff --git a/Framework/Geometry/src/Instrument/Goniometer.cpp b/Framework/Geometry/src/Instrument/Goniometer.cpp index 80be9bf9ae1675026dc951dc4644a454460df246..c3eccf6e514a504475de410edfc20dfbfe41b52f 100644 --- a/Framework/Geometry/src/Instrument/Goniometer.cpp +++ b/Framework/Geometry/src/Instrument/Goniometer.cpp @@ -151,7 +151,7 @@ void Goniometer::pushAxis(std::string name, double axisx, double axisy, throw std::invalid_argument("Motor name already defined"); } GoniometerAxis a(name, V3D(axisx, axisy, axisz), angle, sense, angUnit); - motors.push_back(a); + motors.emplace_back(a); } recalculateR(); } @@ -320,7 +320,7 @@ void Goniometer::loadNexus(::NeXus::File *file, const std::string &group) { for (int i = 0; i < num_axes; i++) { GoniometerAxis newAxis; newAxis.loadNexus(file, "axis" + Strings::toString(i)); - motors.push_back(newAxis); + motors.emplace_back(newAxis); } file->closeGroup(); // Refresh cached values diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index d8ca1de861b6d5a335137cfc1c6763a22600bd5e..50752df37b4638cb30919b4e1dd6f98990f3b832 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -460,7 +460,7 @@ void InstrumentDefinitionParser:: while (pNode) { if (pNode->nodeName() == "parameter") { auto pParameterElem = dynamic_cast<Element *>(pNode); - m_hasParameterElement.push_back( + m_hasParameterElement.emplace_back( dynamic_cast<Element *>(pParameterElem->parentNode())); } pNode = it.nextNode(); @@ -557,9 +557,9 @@ void InstrumentDefinitionParser::getTypeAndComponentPointers( auto pElem = dynamic_cast<Element *>(pNode); if (pElem) { if (pElem->tagName() == "type") - typeElems.push_back(pElem); + typeElems.emplace_back(pElem); else if (pElem->tagName() == "component") - compElems.push_back(pElem); + compElems.emplace_back(pElem); } } } @@ -1106,7 +1106,7 @@ std::vector<std::string> InstrumentDefinitionParser::buildExcludeList( for (unsigned long i = 0; i < numberExcludeEle; i++) { auto *pExElem = static_cast<Element *>(pNLexclude->item(i)); if (pExElem->hasAttribute("sub-part")) - newExcludeList.push_back(pExElem->getAttribute("sub-part")); + newExcludeList.emplace_back(pExElem->getAttribute("sub-part")); } return newExcludeList; @@ -1377,7 +1377,7 @@ void InstrumentDefinitionParser::createDetectorOrMonitor( // Add all monitors and detectors to 'facing component' container. This is // only used if the // "facing" elements are defined in the instrument definition file - m_facingComponent.push_back(detector); + m_facingComponent.emplace_back(detector); } void InstrumentDefinitionParser::createGridDetector( @@ -1693,9 +1693,9 @@ void InstrumentDefinitionParser::createStructuredDetector( auto *pVertElem = static_cast<Element *>(pNode); if (pVertElem->hasAttribute("x")) - xValues.push_back(attrToDouble(pVertElem, "x")); + xValues.emplace_back(attrToDouble(pVertElem, "x")); if (pVertElem->hasAttribute("y")) - yValues.push_back(attrToDouble(pVertElem, "y")); + yValues.emplace_back(attrToDouble(pVertElem, "y")); } pNode = it.nextNode(); @@ -1904,7 +1904,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE, idList.vec.reserve(steps); for (int i = startID; i != endID + increment; i += increment) { - idList.vec.push_back(i); + idList.vec.emplace_back(i); } } else { // test first if any <id> elements @@ -1928,7 +1928,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE, if (pIDElem->hasAttribute("val")) { int valID = std::stoi(pIDElem->getAttribute("val")); - idList.vec.push_back(valID); + idList.vec.emplace_back(valID); } else if (pIDElem->hasAttribute("start")) { int startID = std::stoi(pIDElem->getAttribute("start")); @@ -1965,7 +1965,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE, idList.vec.reserve(numSteps); for (int i = startID; i != endID + increment; i += increment) { - idList.vec.push_back(i); + idList.vec.emplace_back(i); } } else { throw Kernel::Exception::InstrumentDefinitionError( @@ -2524,7 +2524,7 @@ void InstrumentDefinitionParser::setComponentLinks( "Invalid detector id in component-link tag."); } - sharedIComp.push_back(detector); + sharedIComp.emplace_back(detector); // If the user also supplied a name, make sure it's consistent with // the @@ -2554,7 +2554,7 @@ void InstrumentDefinitionParser::setComponentLinks( } else { // Pathname given. Assume it is unique. boost::shared_ptr<const Geometry::IComponent> shared = instrument->getComponentByName(name); - sharedIComp.push_back(shared); + sharedIComp.emplace_back(shared); } } @@ -2804,7 +2804,7 @@ void InstrumentDefinitionParser::adjust( std::string locationElementName = pLoc->getAttribute("name"); if (std::find(allLocationName.begin(), allLocationName.end(), locationElementName) == allLocationName.end()) - allLocationName.push_back(locationElementName); + allLocationName.emplace_back(locationElementName); else throw Exception::InstrumentDefinitionError( std::string("Names in a <type> element containing ") + diff --git a/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp b/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp index 3964b7d212ebbe5ab9052c466d0e069dd3e84715..a16535d6f20a74ef0e5cf56f9362d904a2708d51 100644 --- a/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp @@ -172,11 +172,11 @@ InstrumentVisitor::registerComponentAssembly(const ICompAssembly &assembly) { } const size_t detectorStop = m_assemblySortedDetectorIndices->size(); const size_t componentIndex = commonRegistration(assembly); - m_componentType->push_back(Beamline::ComponentType::Unstructured); - m_assemblySortedComponentIndices->push_back(componentIndex); + m_componentType->emplace_back(Beamline::ComponentType::Unstructured); + m_assemblySortedComponentIndices->emplace_back(componentIndex); // Unless this is the root component this parent is not correct and will be // updated later in the register call of the parent. - m_parentComponentIndices->push_back(componentIndex); + m_parentComponentIndices->emplace_back(componentIndex); const size_t componentStop = m_assemblySortedComponentIndices->size(); m_detectorRanges->emplace_back(std::make_pair(detectorStart, detectorStop)); @@ -207,15 +207,15 @@ InstrumentVisitor::registerGenericComponent(const IComponent &component) { std::make_pair(0, 0)); // Represents an empty range // Record the ID -> index mapping const size_t componentIndex = commonRegistration(component); - m_componentType->push_back(Beamline::ComponentType::Generic); + m_componentType->emplace_back(Beamline::ComponentType::Generic); const size_t componentStart = m_assemblySortedComponentIndices->size(); m_componentRanges->emplace_back( std::make_pair(componentStart, componentStart + 1)); - m_assemblySortedComponentIndices->push_back(componentIndex); + m_assemblySortedComponentIndices->emplace_back(componentIndex); // Unless this is the root component this parent is not correct and will be // updated later in the register call of the parent. - m_parentComponentIndices->push_back(componentIndex); + m_parentComponentIndices->emplace_back(componentIndex); // Generic components are not assemblies and do not therefore have children. m_children->emplace_back(std::vector<size_t>()); return componentIndex; @@ -236,15 +236,15 @@ size_t InstrumentVisitor::registerInfiniteComponent( std::make_pair(0, 0)); // Represents an empty range // Record the ID -> index mapping const size_t componentIndex = commonRegistration(component); - m_componentType->push_back(Beamline::ComponentType::Infinite); + m_componentType->emplace_back(Beamline::ComponentType::Infinite); const size_t componentStart = m_assemblySortedComponentIndices->size(); m_componentRanges->emplace_back( std::make_pair(componentStart, componentStart + 1)); - m_assemblySortedComponentIndices->push_back(componentIndex); + m_assemblySortedComponentIndices->emplace_back(componentIndex); // Unless this is the root component this parent is not correct and will be // updated later in the register call of the parent. - m_parentComponentIndices->push_back(componentIndex); + m_parentComponentIndices->emplace_back(componentIndex); // Generic components are not assemblies and do not therefore have children. m_children->emplace_back(std::vector<size_t>()); return componentIndex; @@ -349,7 +349,7 @@ size_t InstrumentVisitor::registerDetector(const IDetector &detector) { // Record the ID -> component index mapping (*m_componentIdToIndexMap)[detector.getComponentID()] = detectorIndex; (*m_componentIds)[detectorIndex] = detector.getComponentID(); - m_assemblySortedDetectorIndices->push_back(detectorIndex); + m_assemblySortedDetectorIndices->emplace_back(detectorIndex); (*m_detectorPositions)[detectorIndex] = Kernel::toVector3d(detector.getPos()); (*m_detectorRotations)[detectorIndex] = Kernel::toQuaterniond(detector.getRotation()); @@ -357,14 +357,14 @@ size_t InstrumentVisitor::registerDetector(const IDetector &detector) { (*m_scaleFactors)[detectorIndex] = Kernel::toVector3d(detector.getScaleFactor()); if (m_instrument->isMonitorViaIndex(detectorIndex)) { - m_monitorIndices->push_back(detectorIndex); + m_monitorIndices->emplace_back(detectorIndex); } (*m_names)[detectorIndex] = detector.getName(); clearLegacyParameters(m_pmap, detector); /* Note that positions and rotations for detectors are currently - NOT stored! These go into DetectorInfo at present. push_back works for other - Component types because Detectors are always come first in the resultant + NOT stored! These go into DetectorInfo at present. emplace_back works for + other Component types because Detectors are always come first in the resultant component list forming a contiguous block. */ diff --git a/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp b/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp index f1f67042bd1e9ccc811f728da6f9db1f5fbdefaa..d99c3198f278d379d33790ca0f54ffd5e739d741 100644 --- a/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp +++ b/Framework/Geometry/src/Instrument/ObjCompAssembly.cpp @@ -117,7 +117,7 @@ int ObjCompAssembly::add(IComponent *comp) { "ObjCompAssembly cannot contain components of non-ObjComponent type"); } comp->setParent(this); - group.push_back(c); + group.emplace_back(c); } return static_cast<int>(group.size()); } @@ -143,7 +143,7 @@ int ObjCompAssembly::addCopy(IComponent *comp) { "ObjCompAssembly cannot contain components of non-ObjComponent type"); } newcomp->setParent(this); - group.push_back(c); + group.emplace_back(c); } return static_cast<int>(group.size()); } @@ -171,7 +171,7 @@ int ObjCompAssembly::addCopy(IComponent *comp, const std::string &n) { } newcomp->setParent(this); newcomp->setName(n); - group.push_back(c); + group.emplace_back(c); } return static_cast<int>(group.size()); } @@ -230,7 +230,7 @@ void ObjCompAssembly::getChildren(std::vector<IComponent_const_sptr> &outVector, for (int i = 0; i < this->nelements(); i++) { boost::shared_ptr<IComponent> comp = this->getChild(i); if (comp) { - outVector.push_back(comp); + outVector.emplace_back(comp); // Look deeper, on option. if (recursive) { boost::shared_ptr<ICompAssembly> assemb = @@ -349,7 +349,7 @@ void ObjCompAssembly::testIntersectionWithChildren( boost::shared_ptr<Geometry::IComponent> comp = this->getChild(i); if (ICompAssembly_sptr childAssembly = boost::dynamic_pointer_cast<ICompAssembly>(comp)) { - searchQueue.push_back(comp); + searchQueue.emplace_back(comp); } // Check the physical object intersection else if (auto *physicalObject = dynamic_cast<IObjComponent *>(comp.get())) { diff --git a/Framework/Geometry/src/Instrument/ParameterMap.cpp b/Framework/Geometry/src/Instrument/ParameterMap.cpp index 7e7de9c9263519a55bf8e23f423ca98bff3727c1..de57aa0d6612f2ea91049a7cfb5f89ec01922606 100644 --- a/Framework/Geometry/src/Instrument/ParameterMap.cpp +++ b/Framework/Geometry/src/Instrument/ParameterMap.cpp @@ -1132,7 +1132,7 @@ const std::vector<std::string> &ParameterMap::getParameterFilenames() const { * @param filename the filename to add */ void ParameterMap::addParameterFilename(const std::string &filename) { - m_parameterFileNames.push_back(filename); + m_parameterFileNames.emplace_back(filename); } /// Wrapper for ParameterFactory::create to avoid include in header diff --git a/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp b/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp index eb0a7adb04cb53a4d2973605fdc4009c49f20538..cbdec42f8beffb01010c9a92f4a5d0011aea6828 100644 --- a/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp +++ b/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp @@ -26,7 +26,7 @@ bool CompositeImplicitFunction::addFunction( Mantid::Geometry::MDImplicitFunction_sptr constituentFunction) { bool bSuccess = false; if (constituentFunction.get() != nullptr) { - this->m_Functions.push_back(constituentFunction); + this->m_Functions.emplace_back(constituentFunction); bSuccess = true; } return bSuccess; diff --git a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp index bb217cd0917996af899fc2b9a93b57ab410a4488..d3969aa0349a8c4959e1019481efdfa7875fb4c4 100644 --- a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp +++ b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp @@ -39,7 +39,7 @@ bool MDGeometryBuilderXML<CheckDimensionPolicy>::addOrdinaryDimension( return dimensionId == b->getDimensionId(); }); if (location == m_vecDimensions.cend()) { - m_vecDimensions.push_back(std::move(dimensionToAdd)); + m_vecDimensions.emplace_back(std::move(dimensionToAdd)); bAdded = true; m_changed = true; } diff --git a/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp b/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp index e606b91c374473ff5171eb753c980ca5cd66e62c..e2ce983b2ce2441fe42354ab66974923b44f295a 100644 --- a/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp +++ b/Framework/Geometry/src/MDGeometry/MDImplicitFunction.cpp @@ -28,7 +28,7 @@ void MDImplicitFunction::addPlane(const MDPlane &plane) { "a plane with different number of dimensions " "as the previous ones."); } - m_planes.push_back(plane); + m_planes.emplace_back(plane); m_nd = plane.getNumDims(); m_numPlanes = m_planes.size(); } diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp index b9f4fcbf9ad124cbeb8727d80334b702ce122ab8..2cdb948d156098dc7214e2c7f0621761e002fc25 100644 --- a/Framework/Geometry/src/Math/Acomp.cpp +++ b/Framework/Geometry/src/Math/Acomp.cpp @@ -226,18 +226,18 @@ Complementary subtraction is by making A-B == A*B' gc = Gparts.begin(); for (fc = Fparts.begin(); gc != Gparts.end() && fc != Fparts.end(); ++fc) { while (gc != Gparts.end() && (*gc < *fc)) { - NegParts.push_back(*gc); + NegParts.emplace_back(*gc); ++gc; } if (gc != Gparts.end() && *gc == *fc) // match ++gc; else // ok that didn't work so add to us - Outparts.push_back(*fc); + Outparts.emplace_back(*fc); } // add extra bits from Gparts onto NegParts for (; gc != Gparts.end(); ++gc) - NegParts.push_back(*gc); + NegParts.emplace_back(*gc); // Clear This to put in Outparts. Units.clear(); @@ -524,7 +524,7 @@ adds it to the main Units object. split(flag, S, V); if (V >= static_cast<int>(Index.size())) throw std::runtime_error("Error with addUnit::Index"); - Units.push_back(S * Index[i]); + Units.emplace_back(S * Index[i]); } } std::sort(Units.begin(), Units.end()); @@ -647,7 +647,7 @@ Test that the system that is logically the same: std::map<int, int>::const_iterator mc; for (mc = litMap.begin(); mc != litMap.end(); ++mc) { Base[mc->first] = 1; // Insert and Set to true - keyNumbers.push_back(mc->first); + keyNumbers.emplace_back(mc->first); } BnId State(Base.size(), 0); // zero base @@ -854,7 +854,7 @@ i.e. one pass. std::pair<int, BnId> cVal = vc->makeCombination(*oc); if (cVal.first == 1) // was complementary { - Tmod.push_back(cVal.second); + Tmod.emplace_back(cVal.second); oc->setPI(0); vc->setPI(0); changeCount++; // 1 changed @@ -865,7 +865,7 @@ i.e. one pass. for (vc = Work.begin(); vc != Work.end(); ++vc) if (vc->PIstatus() == 1) - PIComp.push_back(*vc); + PIComp.emplace_back(*vc); Work = Tmod; } while (!Tmod.empty()); @@ -942,7 +942,7 @@ It is set on exit (to the EPI) if (PIactive.end() == px) continue; - EPI.push_back(PIform[*px]); + EPI.emplace_back(PIform[*px]); // remove all minterm that the EPI covered for (ddx = DNFactive.begin(); ddx != DNFactive.end(); ++ddx) if (*ddx >= 0 && Grid[*px][*ddx]) @@ -1009,7 +1009,7 @@ It is set on exit (to the EPI) if (di == Dsize) // SUCCESS!!!!! { for (int iout = 0; iout < Icount; iout++) { - EPI.push_back(PIform[Index[iout]]); + EPI.emplace_back(PIform[Index[iout]]); } DNFobj = EPI; return 1; @@ -1019,7 +1019,7 @@ It is set on exit (to the EPI) // OH well that means every PIactive is a EPI :-( for (px = PIactive.begin(); px != PIactive.end(); ++px) - EPI.push_back(PIform[*px]); + EPI.emplace_back(PIform[*px]); DNFobj = EPI; return 1; } @@ -1035,7 +1035,7 @@ Get the key numbers in the system getAbsLiterals(litMap); std::map<int, int>::const_iterator mc; for (mc = litMap.begin(); mc != litMap.end(); ++mc) - keyNumbers.push_back(mc->first); + keyNumbers.emplace_back(mc->first); return keyNumbers; } @@ -1066,7 +1066,7 @@ DNF objects are output into the function parameters. for (mc = litMap.begin(); mc != litMap.end(); ++mc) { Base[mc->first] = 1; // Set to true - keyNumbers.push_back(mc->first); + keyNumbers.emplace_back(mc->first); } DNFobj.clear(); @@ -1074,7 +1074,7 @@ DNF objects are output into the function parameters. do { State.mapState(keyNumbers, Base); if (isTrue(Base)) { - DNFobj.push_back(State); + DNFobj.emplace_back(State); } } while (++State); @@ -1131,7 +1131,7 @@ component) for (const auto &item : Units) { Acomp Aitem(1); // Intersection (doesn't matter since 1 object) Aitem.addUnitItem(item); - Parts.push_back(Aitem); + Parts.emplace_back(Aitem); } std::copy(Comp.cbegin(), Comp.cend(), std::back_inserter(Parts)); return static_cast<int>(Parts.size()); @@ -1144,7 +1144,7 @@ component) for (auto &obj : DNFobj) { Acomp Aitem(1); // make an intersection and add components Aitem.addUnit(keyNumbers, obj); - Parts.push_back(Aitem); + Parts.emplace_back(Aitem); } } return static_cast<int>(Parts.size()); @@ -1180,7 +1180,7 @@ DNF objects are output into the function parameters. for (mc = litMap.begin(); mc != litMap.end(); ++mc) { mc->second = cnt++; Base[mc->first] = 1; // Set to true - keyNumbers.push_back(mc->first); + keyNumbers.emplace_back(mc->first); } CNFobj.clear(); @@ -1188,7 +1188,7 @@ DNF objects are output into the function parameters. do { State.mapState(keyNumbers, Base); if (!isTrue(Base)) - CNFobj.push_back(State); + CNFobj.emplace_back(State); } while (++State); return 0; @@ -1266,8 +1266,8 @@ Carries out algebraic division for (cc = Flist.begin(); cc != Flist.end(); ++cc) { int itemCnt(0); - U.push_back(Acomp(0)); // intersection Unit - V.push_back(Acomp(0)); // intersection Unit + U.emplace_back(Acomp(0)); // intersection Unit + V.emplace_back(Acomp(0)); // intersection Unit Acomp &Uitem = U.back(); Acomp &Vitem = V.back(); int cell; @@ -1377,9 +1377,9 @@ singles exist and up-promotes them. if (Stype.first + Stype.second == 1) // single unit component. { if (Stype.first == 1) - Units.push_back(AX.itemN(0)); + Units.emplace_back(AX.itemN(0)); else - Comp.push_back(*AX.itemC(0)); + Comp.emplace_back(*AX.itemC(0)); // delete memory and the component. Comp.erase(Comp.begin() + ix, Comp.begin() + ix + 1); ix--; diff --git a/Framework/Geometry/src/Math/ConvexPolygon.cpp b/Framework/Geometry/src/Math/ConvexPolygon.cpp index e550e057836f9b3187d50e4810af4b0260cff899..e94d1cf6a510aa5b0baf1745c94576ef92fe3946 100644 --- a/Framework/Geometry/src/Math/ConvexPolygon.cpp +++ b/Framework/Geometry/src/Math/ConvexPolygon.cpp @@ -54,7 +54,7 @@ void ConvexPolygon::clear() { * @param pt A new point for the shape */ void ConvexPolygon::insert(const V2D &pt) { - m_vertices.push_back(pt); + m_vertices.emplace_back(pt); // Update extrema m_minX = std::min(m_minX, pt.X()); m_maxX = std::max(m_maxX, pt.X()); diff --git a/Framework/Geometry/src/Math/PolyBase.cpp b/Framework/Geometry/src/Math/PolyBase.cpp index 0b667e74b8db36218cdbfe83785234efc781db88..0f529798e2b66ca2060a16b433e33abf4ced7b4f 100644 --- a/Framework/Geometry/src/Math/PolyBase.cpp +++ b/Framework/Geometry/src/Math/PolyBase.cpp @@ -428,7 +428,7 @@ std::vector<double> PolyBase::realRoots(const double epsilon) std::vector<std::complex<double>>::const_iterator vc; for (vc = Croots.begin(); vc != Croots.end(); ++vc) { if (fabs(vc->imag()) < eps) - Out.push_back(vc->real()); + Out.emplace_back(vc->real()); } return Out; } diff --git a/Framework/Geometry/src/Objects/CSGObject.cpp b/Framework/Geometry/src/Objects/CSGObject.cpp index 46c60d718bd1e1b2695e59d0adea369b074a06a8..a95e5bbf80b15d48477e29d8cad01048504ff4e9 100644 --- a/Framework/Geometry/src/Objects/CSGObject.cpp +++ b/Framework/Geometry/src/Objects/CSGObject.cpp @@ -615,7 +615,7 @@ int CSGObject::hasComplement() const { */ int CSGObject::populate(const std::map<int, boost::shared_ptr<Surface>> &Smap) { std::deque<Rule *> Rst; - Rst.push_back(TopRule.get()); + Rst.emplace_back(TopRule.get()); while (!Rst.empty()) { Rule *T1 = Rst.front(); Rst.pop_front(); @@ -637,9 +637,9 @@ int CSGObject::populate(const std::map<int, boost::shared_ptr<Surface>> &Smap) { Rule *TA = T1->leaf(0); Rule *TB = T1->leaf(1); if (TA) - Rst.push_back(TA); + Rst.emplace_back(TA); if (TB) - Rst.push_back(TB); + Rst.emplace_back(TB); } } } @@ -852,7 +852,7 @@ int CSGObject::createSurfaceList(const int outFlag) { } else { const auto *SurX = dynamic_cast<const SurfPoint *>(tmpA); if (SurX) { - m_SurList.push_back(SurX->getKey()); + m_SurList.emplace_back(SurX->getKey()); } } } @@ -925,7 +925,7 @@ void CSGObject::print() const { std::deque<Rule *> Rst; std::vector<int> Cells; int Rcount(0); - Rst.push_back(TopRule.get()); + Rst.emplace_back(TopRule.get()); Rule *TA, *TB; // Temp. for storage while (!Rst.empty()) { @@ -935,14 +935,14 @@ void CSGObject::print() const { Rcount++; auto *KV = dynamic_cast<SurfPoint *>(T1); if (KV) - Cells.push_back(KV->getKeyN()); + Cells.emplace_back(KV->getKeyN()); else { TA = T1->leaf(0); TB = T1->leaf(1); if (TA) - Rst.push_back(TA); + Rst.emplace_back(TA); if (TB) - Rst.push_back(TB); + Rst.emplace_back(TB); } } } @@ -1780,10 +1780,10 @@ void CSGObject::calcBoundingBoxByGeometry() { auto rbb = lbb + (rfb - lfb); // Right-Back-Bottom auto rbt = rbb + (rft - rfb); // Right-Back-Top - vectors.push_back(lbt); - vectors.push_back(rft); - vectors.push_back(rbb); - vectors.push_back(rbt); + vectors.emplace_back(lbt); + vectors.emplace_back(rft); + vectors.emplace_back(rbb); + vectors.emplace_back(rbt); // Unreasonable extents to be replaced by first loop cycle constexpr double huge = 1e10; diff --git a/Framework/Geometry/src/Objects/InstrumentRayTracer.cpp b/Framework/Geometry/src/Objects/InstrumentRayTracer.cpp index 3c3d5a6ffc464b1efc0f084e42740bf69a0fcd33..6ca78303c4193d72ace965caed792d4a9016b530 100644 --- a/Framework/Geometry/src/Objects/InstrumentRayTracer.cpp +++ b/Framework/Geometry/src/Objects/InstrumentRayTracer.cpp @@ -131,7 +131,7 @@ void InstrumentRayTracer::fireRay(Track &testRay) const { std::deque<IComponent_const_sptr> nodeQueue; // Start at the root of the tree - nodeQueue.push_back(m_instrument); + nodeQueue.emplace_back(m_instrument); IComponent_const_sptr node; while (!nodeQueue.empty()) { diff --git a/Framework/Geometry/src/Objects/MeshObject.cpp b/Framework/Geometry/src/Objects/MeshObject.cpp index 162759856cc9a791af0e27fb5e83b86c4949ac84..be1c15a67ee795c9b5cdd47481d66b77fec4796f 100644 --- a/Framework/Geometry/src/Objects/MeshObject.cpp +++ b/Framework/Geometry/src/Objects/MeshObject.cpp @@ -206,8 +206,8 @@ void MeshObject::getIntersections( if (MeshObjectCommon::rayIntersectsTriangle(start, direction, vertex1, vertex2, vertex3, intersection, entryExit)) { - intersectionPoints.push_back(intersection); - entryExitFlags.push_back(entryExit); + intersectionPoints.emplace_back(intersection); + entryExitFlags.emplace_back(entryExit); } } // still need to deal with edge cases diff --git a/Framework/Geometry/src/Objects/Rules.cpp b/Framework/Geometry/src/Objects/Rules.cpp index 0bc53a056bc8a99143467cb3b5466d9e20a21569..8a12a0f3ee5b1dd32ff05b7c272c62df7b1e993d 100644 --- a/Framework/Geometry/src/Objects/Rules.cpp +++ b/Framework/Geometry/src/Objects/Rules.cpp @@ -620,7 +620,7 @@ int Rule::getKeyList(std::vector<int> &IList) const } else { const auto *SurX = dynamic_cast<const SurfPoint *>(tmpA); if (SurX) - IList.push_back(SurX->getKeyN()); + IList.emplace_back(SurX->getKeyN()); else { logger.error() << "Error with surface List\n"; return static_cast<int>(IList.size()); @@ -649,7 +649,7 @@ int Rule::Eliminate() getKeyList(baseKeys); std::vector<int>::const_iterator xv; for (xv = baseKeys.begin(); xv != baseKeys.end(); ++xv) { - baseVal.push_back(0); + baseVal.emplace_back(0); Base[(*xv)] = 1; } @@ -685,7 +685,7 @@ int Rule::Eliminate() } } if (keyChange < 0) // Success !!!!! - deadKeys.push_back(targetKey); + deadKeys.emplace_back(targetKey); } return static_cast<int>(deadKeys.size()); } diff --git a/Framework/Geometry/src/Objects/Track.cpp b/Framework/Geometry/src/Objects/Track.cpp index daab8365d77be7673b48b4568aeadaabdd46304c..e9c983685f65d4b433141b9ddaeb89b7e5f98bd1 100644 --- a/Framework/Geometry/src/Objects/Track.cpp +++ b/Framework/Geometry/src/Objects/Track.cpp @@ -150,7 +150,7 @@ int Track::addLink(const V3D &firstPoint, const V3D &secondPoint, Link newLink(firstPoint, secondPoint, distanceAlongTrack, obj, compID); int index(0); if (m_links.empty()) { - m_links.push_back(newLink); + m_links.emplace_back(newLink); index = 0; } else { auto linkPtr = std::lower_bound(m_links.begin(), m_links.end(), newLink); diff --git a/Framework/Geometry/src/Surfaces/Cylinder.cpp b/Framework/Geometry/src/Surfaces/Cylinder.cpp index 8c6155cc4d08c36e91773b94e2471bb888c85fa9..da369b2769ef65f58e25e9acd08d343f01d7bc62 100644 --- a/Framework/Geometry/src/Surfaces/Cylinder.cpp +++ b/Framework/Geometry/src/Surfaces/Cylinder.cpp @@ -373,8 +373,8 @@ void Cylinder::getBoundingBox(double &xmax, double &ymax, double &zmax, if (Normal[0] != 0) { xminPoint = Centre + Normal * ((xmin - Centre[0]) / Normal[0]); xmaxPoint = Centre + Normal * ((xmax - Centre[0]) / Normal[0]); - listOfPoints.push_back(xminPoint); - listOfPoints.push_back(xmaxPoint); + listOfPoints.emplace_back(xminPoint); + listOfPoints.emplace_back(xmaxPoint); } if (Normal[1] != 0) { @@ -382,16 +382,16 @@ void Cylinder::getBoundingBox(double &xmax, double &ymax, double &zmax, yminPoint = Centre + Normal * ((ymin - Centre[1]) / Normal[1]); // ymax plane ymaxPoint = Centre + Normal * ((ymax - Centre[1]) / Normal[1]); - listOfPoints.push_back(yminPoint); - listOfPoints.push_back(ymaxPoint); + listOfPoints.emplace_back(yminPoint); + listOfPoints.emplace_back(ymaxPoint); } if (Normal[2] != 0) { // zmin plane zminPoint = Centre + Normal * ((zmin - Centre[2]) / Normal[2]); // zmax plane zmaxPoint = Centre + Normal * ((zmax - Centre[2]) / Normal[2]); - listOfPoints.push_back(zminPoint); - listOfPoints.push_back(zmaxPoint); + listOfPoints.emplace_back(zminPoint); + listOfPoints.emplace_back(zmaxPoint); } if (!listOfPoints.empty()) { xmin = ymin = zmin = std::numeric_limits<double>::max(); diff --git a/Framework/Geometry/src/Surfaces/Line.cpp b/Framework/Geometry/src/Surfaces/Line.cpp index 3cb40385dce1be9902ee9f793db9ad2941ac97e9..294f9fc44014c0dbd346852617e3a1d7eb853fb4 100644 --- a/Framework/Geometry/src/Surfaces/Line.cpp +++ b/Framework/Geometry/src/Surfaces/Line.cpp @@ -201,7 +201,7 @@ added. It does not check the points for validity. const double u = (Pln.getDistance() - OdotN) / DdotN; if (u <= 0) return 0; - PntOut.push_back(getPoint(u)); + PntOut.emplace_back(getPoint(u)); return 1; } diff --git a/Framework/Geometry/src/Surfaces/Plane.cpp b/Framework/Geometry/src/Surfaces/Plane.cpp index 340e838230b215e76bf0f86911565fba13b491a7..8e65a5c6b7c009e7f513be88d1cd5dfa688760d5 100644 --- a/Framework/Geometry/src/Surfaces/Plane.cpp +++ b/Framework/Geometry/src/Surfaces/Plane.cpp @@ -355,47 +355,47 @@ void Plane::getBoundingBox(double &xmax, double &ymax, double &zmax, //(xmin,ymin,zmax)--- (xmin,ymax,zmax) 12 std::vector<V3D> listOfPoints; if (this->side(vertex1) <= 0) - listOfPoints.push_back(vertex1); + listOfPoints.emplace_back(vertex1); if (this->side(vertex2) <= 0) - listOfPoints.push_back(vertex2); + listOfPoints.emplace_back(vertex2); if (this->side(vertex3) <= 0) - listOfPoints.push_back(vertex3); + listOfPoints.emplace_back(vertex3); if (this->side(vertex4) <= 0) - listOfPoints.push_back(vertex4); + listOfPoints.emplace_back(vertex4); if (this->side(vertex5) <= 0) - listOfPoints.push_back(vertex5); + listOfPoints.emplace_back(vertex5); if (this->side(vertex6) <= 0) - listOfPoints.push_back(vertex6); + listOfPoints.emplace_back(vertex6); if (this->side(vertex7) <= 0) - listOfPoints.push_back(vertex7); + listOfPoints.emplace_back(vertex7); if (this->side(vertex8) <= 0) - listOfPoints.push_back(vertex8); + listOfPoints.emplace_back(vertex8); V3D edge1, edge2, edge3, edge4, edge5, edge6, edge7, edge8, edge9, edge10, edge11, edge12; if (LineIntersectionWithPlane(vertex1, vertex2, edge1) == 1) - listOfPoints.push_back(edge1); + listOfPoints.emplace_back(edge1); if (LineIntersectionWithPlane(vertex2, vertex3, edge2) == 1) - listOfPoints.push_back(edge2); + listOfPoints.emplace_back(edge2); if (LineIntersectionWithPlane(vertex3, vertex4, edge3) == 1) - listOfPoints.push_back(edge3); + listOfPoints.emplace_back(edge3); if (LineIntersectionWithPlane(vertex4, vertex1, edge4) == 1) - listOfPoints.push_back(edge4); + listOfPoints.emplace_back(edge4); if (LineIntersectionWithPlane(vertex5, vertex6, edge5) == 1) - listOfPoints.push_back(edge5); + listOfPoints.emplace_back(edge5); if (LineIntersectionWithPlane(vertex6, vertex7, edge6) == 1) - listOfPoints.push_back(edge6); + listOfPoints.emplace_back(edge6); if (LineIntersectionWithPlane(vertex7, vertex8, edge7) == 1) - listOfPoints.push_back(edge7); + listOfPoints.emplace_back(edge7); if (LineIntersectionWithPlane(vertex8, vertex5, edge8) == 1) - listOfPoints.push_back(edge8); + listOfPoints.emplace_back(edge8); if (LineIntersectionWithPlane(vertex1, vertex5, edge9) == 1) - listOfPoints.push_back(edge9); + listOfPoints.emplace_back(edge9); if (LineIntersectionWithPlane(vertex2, vertex6, edge10) == 1) - listOfPoints.push_back(edge10); + listOfPoints.emplace_back(edge10); if (LineIntersectionWithPlane(vertex3, vertex7, edge11) == 1) - listOfPoints.push_back(edge11); + listOfPoints.emplace_back(edge11); if (LineIntersectionWithPlane(vertex4, vertex8, edge12) == 1) - listOfPoints.push_back(edge12); + listOfPoints.emplace_back(edge12); // now sort the vertices to find the mins and max // std::cout<<listOfPoints.size()<<'\n'; if (!listOfPoints.empty()) { diff --git a/Framework/Geometry/test/CSGObjectTest.h b/Framework/Geometry/test/CSGObjectTest.h index 74341d53af26e741b03878e1f884cceb4b079b56..f15133680fd3a2dc0afd7051d6b548fd7563e5de 100644 --- a/Framework/Geometry/test/CSGObjectTest.h +++ b/Framework/Geometry/test/CSGObjectTest.h @@ -335,9 +335,9 @@ public: // format = startPoint, endPoint, total distance so far // forward only intercepts means that start point should be track origin - expectedResults.push_back(Link(V3D(-1, 1.5, 1), - V3D(sqrt(16 - 0.25) + 1, 1.5, 1.0), - sqrt(15.75) + 2, *geom_obj)); + expectedResults.emplace_back(Link(V3D(-1, 1.5, 1), + V3D(sqrt(16 - 0.25) + 1, 1.5, 1.0), + sqrt(15.75) + 2, *geom_obj)); checkTrackIntercept(geom_obj, track, expectedResults); } @@ -348,7 +348,7 @@ public: Track track(V3D(0, -10, 0), V3D(0, 1, 0)); // format = startPoint, endPoint, total distance so far - expectedResults.push_back( + expectedResults.emplace_back( Link(V3D(0, -4.1, 0), V3D(0, 4.1, 0), 14.1, *geom_obj)); checkTrackIntercept(geom_obj, track, expectedResults); @@ -360,7 +360,7 @@ public: Track track(V3D(-10, 0, 0), V3D(1, 0, 0)); // format = startPoint, endPoint, total distance so far - expectedResults.push_back( + expectedResults.emplace_back( Link(V3D(-4.1, 0, 0), V3D(4.1, 0, 0), 14.1, *geom_obj)); checkTrackIntercept(geom_obj, track, expectedResults); } @@ -369,7 +369,8 @@ public: std::vector<Link> expectedResults; auto geom_obj = createCappedCylinder(); // format = startPoint, endPoint, total distance so far - expectedResults.push_back(Link(V3D(0, -3, 0), V3D(0, 3, 0), 13, *geom_obj)); + expectedResults.emplace_back( + Link(V3D(0, -3, 0), V3D(0, 3, 0), 13, *geom_obj)); Track track(V3D(0, -10, 0), V3D(0, 1, 0)); checkTrackIntercept(geom_obj, track, expectedResults); @@ -381,7 +382,7 @@ public: Track track(V3D(-10, 0, 0), V3D(1, 0, 0)); // format = startPoint, endPoint, total distance so far - expectedResults.push_back( + expectedResults.emplace_back( Link(V3D(-3.2, 0, 0), V3D(1.2, 0, 0), 11.2, *geom_obj)); checkTrackIntercept(geom_obj, track, expectedResults); } @@ -466,8 +467,8 @@ public: TS_ASSERT(object2.interceptSurface(TL) != 0); std::vector<Link> expectedResults; - expectedResults.push_back(Link(V3D(-1, 0, 0), V3D(1, 0, 0), 6, object1)); - expectedResults.push_back( + expectedResults.emplace_back(Link(V3D(-1, 0, 0), V3D(1, 0, 0), 6, object1)); + expectedResults.emplace_back( Link(V3D(4.5, 0, 0), V3D(6.5, 0, 0), 11.5, object2)); checkTrackIntercept(TL, expectedResults); } @@ -497,8 +498,8 @@ public: TS_ASSERT(object2.interceptSurface(TL) != 0); std::vector<Link> expectedResults; - expectedResults.push_back(Link(V3D(-1, 0, 0), V3D(1, 0, 0), 6, object1)); - expectedResults.push_back( + expectedResults.emplace_back(Link(V3D(-1, 0, 0), V3D(1, 0, 0), 6, object1)); + expectedResults.emplace_back( Link(V3D(1, 0, 0), V3D(6.5, 0, 0), 11.5, object2)); checkTrackIntercept(TL, expectedResults); @@ -529,11 +530,12 @@ public: TS_ASSERT(object2.interceptSurface(TL) != 0); std::vector<Link> expectedResults; - expectedResults.push_back( + expectedResults.emplace_back( Link(V3D(-1, 0, 0), V3D(-0.8, 0, 0), 4.2, object1)); - expectedResults.push_back( + expectedResults.emplace_back( Link(V3D(-0.8, 0, 0), V3D(0.8, 0, 0), 5.8, object1)); - expectedResults.push_back(Link(V3D(0.8, 0, 0), V3D(1, 0, 0), 6, object2)); + expectedResults.emplace_back( + Link(V3D(0.8, 0, 0), V3D(1, 0, 0), 6, object2)); checkTrackIntercept(TL, expectedResults); } @@ -562,11 +564,12 @@ public: TS_ASSERT(object2.interceptSurface(TL) != 0); std::vector<Link> expectedResults; - expectedResults.push_back( + expectedResults.emplace_back( Link(V3D(-1, 0, 0), V3D(-0.4, 0, 0), 4.6, object1)); - expectedResults.push_back( + expectedResults.emplace_back( Link(V3D(-0.4, 0, 0), V3D(0.2, 0, 0), 5.2, object1)); - expectedResults.push_back(Link(V3D(0.2, 0, 0), V3D(1, 0, 0), 6, object2)); + expectedResults.emplace_back( + Link(V3D(0.2, 0, 0), V3D(1, 0, 0), 6, object2)); checkTrackIntercept(TL, expectedResults); } @@ -1404,29 +1407,29 @@ private: using SCompT = std::pair<int, std::string>; std::vector<SCompT> SurfLine; if (desired.find("60001") != std::string::npos) - SurfLine.push_back(SCompT(60001, "px -1")); + SurfLine.emplace_back(SCompT(60001, "px -1")); if (desired.find("60002") != std::string::npos) - SurfLine.push_back(SCompT(60002, "px 1")); + SurfLine.emplace_back(SCompT(60002, "px 1")); if (desired.find("60003") != std::string::npos) - SurfLine.push_back(SCompT(60003, "py -2")); + SurfLine.emplace_back(SCompT(60003, "py -2")); if (desired.find("60004") != std::string::npos) - SurfLine.push_back(SCompT(60004, "py 2")); + SurfLine.emplace_back(SCompT(60004, "py 2")); if (desired.find("60005") != std::string::npos) - SurfLine.push_back(SCompT(60005, "pz -3")); + SurfLine.emplace_back(SCompT(60005, "pz -3")); if (desired.find("60006") != std::string::npos) - SurfLine.push_back(SCompT(60006, "pz 3")); + SurfLine.emplace_back(SCompT(60006, "pz 3")); if (desired.find("80001") != std::string::npos) - SurfLine.push_back(SCompT(80001, "px 4.5")); + SurfLine.emplace_back(SCompT(80001, "px 4.5")); if (desired.find("80002") != std::string::npos) - SurfLine.push_back(SCompT(80002, "px 6.5")); + SurfLine.emplace_back(SCompT(80002, "px 6.5")); if (desired.find("71") != std::string::npos) - SurfLine.push_back(SCompT(71, "so 0.8")); + SurfLine.emplace_back(SCompT(71, "so 0.8")); if (desired.find("72") != std::string::npos) - SurfLine.push_back(SCompT(72, "s -0.7 0 0 0.3")); + SurfLine.emplace_back(SCompT(72, "s -0.7 0 0 0.3")); if (desired.find("73") != std::string::npos) - SurfLine.push_back(SCompT(73, "s 0.6 0 0 0.4")); + SurfLine.emplace_back(SCompT(73, "s 0.6 0 0 0.4")); // Note that the testObject now manages the "new Plane" for (const auto &vc : SurfLine) { diff --git a/Framework/Geometry/test/ComponentInfoTest.h b/Framework/Geometry/test/ComponentInfoTest.h index 3f0f5d89a1e020b437fa03099beb64b083bd414b..0dce9322e192fbbd18540cb43d1216f1ae34640d 100644 --- a/Framework/Geometry/test/ComponentInfoTest.h +++ b/Framework/Geometry/test/ComponentInfoTest.h @@ -91,14 +91,14 @@ std::unique_ptr<Beamline::ComponentInfo> makeSingleBeamlineComponentInfo( boost::make_shared<std::vector<size_t>>(); // No detectors in this example auto detectorRanges = boost::make_shared<std::vector<std::pair<size_t, size_t>>>(); - detectorRanges->push_back( + detectorRanges->emplace_back( std::make_pair(0, 0)); // One component with no detectors auto componentIndices = boost::make_shared<std::vector<size_t>>( std::vector<size_t>{0}); // No detectors in this example auto componentRanges = boost::make_shared<std::vector<std::pair<size_t, size_t>>>(); - componentRanges->push_back( + componentRanges->emplace_back( std::make_pair(0, 1)); // One component with no sub-components auto parentIndices = boost::make_shared<const std::vector<size_t>>( @@ -138,18 +138,18 @@ public: // example auto detectorRanges = boost::make_shared<std::vector<std::pair<size_t, size_t>>>(); - detectorRanges->push_back( + detectorRanges->emplace_back( std::make_pair(0, 0)); // One component with no detectors - detectorRanges->push_back( + detectorRanges->emplace_back( std::make_pair(0, 0)); // Another component with no detectors auto componentIndices = boost::make_shared<std::vector<size_t>>( std::vector<size_t>{0, 1}); // No detectors in this example auto componentRanges = boost::make_shared<std::vector<std::pair<size_t, size_t>>>(); - componentRanges->push_back( + componentRanges->emplace_back( std::make_pair(0, 0)); // One component with no sub-components - componentRanges->push_back( + componentRanges->emplace_back( std::make_pair(0, 0)); // Another component with no subcomponents auto parentIndices = boost::make_shared<const std::vector<size_t>>( @@ -179,8 +179,8 @@ public: auto shapes = boost::make_shared< std::vector<boost::shared_ptr<const Geometry::IObject>>>(); - shapes->push_back(boost::make_shared<const Geometry::CSGObject>()); - shapes->push_back(boost::make_shared<const Geometry::CSGObject>()); + shapes->emplace_back(boost::make_shared<const Geometry::CSGObject>()); + shapes->emplace_back(boost::make_shared<const Geometry::CSGObject>()); ComponentInfo info(std::move(internalInfo), componentIds, makeComponentIDMap(componentIds), shapes); @@ -198,7 +198,7 @@ public: auto shapes = boost::make_shared< std::vector<boost::shared_ptr<const Geometry::IObject>>>(); - shapes->push_back(createCappedCylinder()); + shapes->emplace_back(createCappedCylinder()); ComponentInfo a(std::move(internalInfo), componentIds, makeComponentIDMap(componentIds), shapes); @@ -225,7 +225,7 @@ public: auto shapes = boost::make_shared< std::vector<boost::shared_ptr<const Geometry::IObject>>>(); - shapes->push_back(createCappedCylinder()); + shapes->emplace_back(createCappedCylinder()); ComponentInfo compInfo(std::move(internalInfo), componentIds, makeComponentIDMap(componentIds), shapes); @@ -253,7 +253,7 @@ public: auto shapes = boost::make_shared< std::vector<boost::shared_ptr<const Geometry::IObject>>>(); - shapes->push_back(ComponentCreationHelper::createSphere(radius)); + shapes->emplace_back(ComponentCreationHelper::createSphere(radius)); ComponentInfo info(std::move(internalInfo), componentIds, makeComponentIDMap(componentIds), shapes); @@ -288,7 +288,7 @@ public: auto shapes = boost::make_shared< std::vector<boost::shared_ptr<const Geometry::IObject>>>(); - shapes->push_back(createCappedCylinder()); + shapes->emplace_back(createCappedCylinder()); ComponentInfo info(std::move(internalInfo), componentIds, makeComponentIDMap(componentIds), shapes); @@ -311,7 +311,7 @@ public: auto shapes = boost::make_shared< std::vector<boost::shared_ptr<const Geometry::IObject>>>(); - shapes->push_back(ComponentCreationHelper::createSphere(radius)); + shapes->emplace_back(ComponentCreationHelper::createSphere(radius)); ComponentInfo componentInfo(std::move(internalInfo), componentIds, makeComponentIDMap(componentIds), shapes); diff --git a/Framework/Geometry/test/GroupTest.h b/Framework/Geometry/test/GroupTest.h index 043cbd31b30be8d4cf9ecd1b53d724dcbe44fde0..aa0f0bd1e46e98c4fe6bb7523db2b897920ec102 100644 --- a/Framework/Geometry/test/GroupTest.h +++ b/Framework/Geometry/test/GroupTest.h @@ -40,8 +40,9 @@ public: void testConstructor() { std::vector<SymmetryOperation> symOps; - symOps.push_back(SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - symOps.push_back( + symOps.emplace_back( + SymmetryOperationFactory::Instance().createSymOp("x,y,z")); + symOps.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); TS_ASSERT_THROWS_NOTHING(Group group(symOps)); @@ -57,8 +58,9 @@ public: void testCopyConstructor() { std::vector<SymmetryOperation> symOps; - symOps.push_back(SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - symOps.push_back( + symOps.emplace_back( + SymmetryOperationFactory::Instance().createSymOp("x,y,z")); + symOps.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); Group group(symOps); @@ -71,8 +73,9 @@ public: void testAssignmentOperator() { std::vector<SymmetryOperation> symOps; - symOps.push_back(SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - symOps.push_back( + symOps.emplace_back( + SymmetryOperationFactory::Instance().createSymOp("x,y,z")); + symOps.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); Group otherGroup(symOps); @@ -94,21 +97,22 @@ public: // Making a group of two operations gives order 2 std::vector<SymmetryOperation> symOps; - symOps.push_back(SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - symOps.push_back( + symOps.emplace_back( + SymmetryOperationFactory::Instance().createSymOp("x,y,z")); + symOps.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); Group biggerGroup(symOps); TS_ASSERT_EQUALS(biggerGroup.order(), 2); // Adding another one results in 3 - symOps.push_back( + symOps.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,y,z")); Group evenBiggerGroup(symOps); TS_ASSERT_EQUALS(evenBiggerGroup.order(), 3); // Multiple occurences of the same operation do not count - symOps.push_back( + symOps.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); Group sameAsBefore(symOps); TS_ASSERT_EQUALS(sameAsBefore.order(), 3); @@ -116,8 +120,9 @@ public: void testComparison() { std::vector<SymmetryOperation> symOps; - symOps.push_back(SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - symOps.push_back( + symOps.emplace_back( + SymmetryOperationFactory::Instance().createSymOp("x,y,z")); + symOps.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); Group groupOne(symOps); @@ -136,16 +141,16 @@ public: void testMultiplicationOperator() { // We take pointgroup -1 std::vector<SymmetryOperation> inversion; - inversion.push_back( + inversion.emplace_back( SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - inversion.push_back( + inversion.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); // And 2 (b-axis unique) std::vector<SymmetryOperation> twoFoldY; - twoFoldY.push_back( + twoFoldY.emplace_back( SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - twoFoldY.push_back( + twoFoldY.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,y,-z")); Group one(inversion); @@ -171,9 +176,9 @@ public: void testAxisSystemOrthogonal() { std::vector<SymmetryOperation> orthogonal; - orthogonal.push_back( + orthogonal.emplace_back( SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - orthogonal.push_back( + orthogonal.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,y,-z")); Group two(orthogonal); @@ -183,9 +188,9 @@ public: void testAxisSystemHexagonal() { std::vector<SymmetryOperation> hexagonal; - hexagonal.push_back( + hexagonal.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-y,x-y,z")); - hexagonal.push_back( + hexagonal.emplace_back( SymmetryOperationFactory::Instance().createSymOp("y,x,-z+1/2")); Group two(hexagonal); @@ -343,16 +348,16 @@ public: void testSmartPointerOperators() { // We take pointgroup -1 std::vector<SymmetryOperation> inversion; - inversion.push_back( + inversion.emplace_back( SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - inversion.push_back( + inversion.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,-y,-z")); // And 2 (b-axis unique) std::vector<SymmetryOperation> twoFoldY; - twoFoldY.push_back( + twoFoldY.emplace_back( SymmetryOperationFactory::Instance().createSymOp("x,y,z")); - twoFoldY.push_back( + twoFoldY.emplace_back( SymmetryOperationFactory::Instance().createSymOp("-x,y,-z")); Group_const_sptr one = boost::make_shared<const Group>(inversion); diff --git a/Framework/Geometry/test/IndexingUtilsTest.h b/Framework/Geometry/test/IndexingUtilsTest.h index 4cabc518d8be2f4e75ad4751ddfd975bd1583b7d..635e98da571fe36874a42ca0881d56c09b854a25 100644 --- a/Framework/Geometry/test/IndexingUtilsTest.h +++ b/Framework/Geometry/test/IndexingUtilsTest.h @@ -226,7 +226,7 @@ public: std::vector<int> index_values; int correct_indices[] = {1, 4, 2, 0, 1, 3, 0, -1, 0, -1, -2, -3}; for (int correct_index : correct_indices) { - index_values.push_back(correct_index); + index_values.emplace_back(correct_index); } std::vector<V3D> q_vectors = getNatroliteQs(); @@ -331,7 +331,7 @@ public: V3D vec(current_dir); vec *= ((double)i + 0.6); vec *= 2.0 * M_PI; - q_vectors.push_back(vec); + q_vectors.emplace_back(vec); } double max_q_magnitude = 16.0; @@ -471,17 +471,17 @@ public: V3D v5c(2.8666800, 5.39606, 8.06534); V3D v5d(2.9666800, 5.49606, 8.16534); - directions.push_back(v1); - directions.push_back(v1b); - directions.push_back(v1c); - directions.push_back(v2); - directions.push_back(v3); - directions.push_back(v3b); - directions.push_back(v4); - directions.push_back(v5); - directions.push_back(v5b); - directions.push_back(v5c); - directions.push_back(v5d); + directions.emplace_back(v1); + directions.emplace_back(v1b); + directions.emplace_back(v1c); + directions.emplace_back(v2); + directions.emplace_back(v3); + directions.emplace_back(v3b); + directions.emplace_back(v4); + directions.emplace_back(v5); + directions.emplace_back(v5b); + directions.emplace_back(v5c); + directions.emplace_back(v5d); IndexingUtils::DiscardDuplicates(new_list, directions, q_vectors, required_tolerance, length_tol, angle_tol); diff --git a/Framework/Geometry/test/LineIntersectVisitTest.h b/Framework/Geometry/test/LineIntersectVisitTest.h index 9e9cb229c54b7040f3c066e6d20927055beecc4e..29f58bd1014e93a78335c2e31f9dbf874611a3f2 100644 --- a/Framework/Geometry/test/LineIntersectVisitTest.h +++ b/Framework/Geometry/test/LineIntersectVisitTest.h @@ -56,7 +56,7 @@ public: TS_ASSERT_EQUALS(A.getNPoints(), 1); TS_ASSERT_EQUALS(A.getPoints(), pntOut); std::vector<double> Dist; - Dist.push_back(2.0); + Dist.emplace_back(2.0); TS_ASSERT_EQUALS(A.getDistance(), Dist); } @@ -96,8 +96,8 @@ public: TS_ASSERT_EQUALS(A.getNPoints(), 1); TS_ASSERT_EQUALS(A.getPoints(), pntOut); std::vector<double> Dist; - // Dist.push_back(1.0); - Dist.push_back(1.0); + // Dist.emplace_back(1.0); + Dist.emplace_back(1.0); TS_ASSERT_EQUALS(A.getDistance(), Dist); LineIntersectVisit C(V3D(1.1, 0.0, 0.0), V3D(-1.0, 0.0, 0.0)); diff --git a/Framework/Geometry/test/MDBoxImplicitFunctionTest.h b/Framework/Geometry/test/MDBoxImplicitFunctionTest.h index fa37477f3b539fdc73e4847fd935c4a7c9f746f7..6c5117cd19f4452fd345641f2d93c3da0e095235 100644 --- a/Framework/Geometry/test/MDBoxImplicitFunctionTest.h +++ b/Framework/Geometry/test/MDBoxImplicitFunctionTest.h @@ -27,10 +27,10 @@ public: std::vector<coord_t> max; TSM_ASSERT_THROWS_ANYTHING("0 dimensions is bad.", MDBoxImplicitFunction f(min, max)); - min.push_back(1.234f); + min.emplace_back(1.234f); TSM_ASSERT_THROWS_ANYTHING("Mismatch in nd", MDBoxImplicitFunction f(min, max)); - max.push_back(4.56f); + max.emplace_back(4.56f); TS_ASSERT_THROWS_NOTHING(MDBoxImplicitFunction f(min, max)); } @@ -43,11 +43,11 @@ public: /** Make a box from 1,1 - 2,2 */ void test_2D() { std::vector<coord_t> min; - min.push_back(1.0); - min.push_back(1.0); + min.emplace_back(1.0f); + min.emplace_back(1.0f); std::vector<coord_t> max; - max.push_back(2.0); - max.push_back(2.0); + max.emplace_back(2.0f); + max.emplace_back(2.0f); MDBoxImplicitFunction f(min, max); TS_ASSERT(try2Dpoint(f, 1.5, 1.5)); TS_ASSERT(!try2Dpoint(f, 0.9, 1.5)); @@ -58,12 +58,12 @@ public: void test_volume() { std::vector<coord_t> min, max; - min.push_back(0); - min.push_back(0); - min.push_back(0); - max.push_back(1); - max.push_back(2); - max.push_back(3); + min.emplace_back(0.f); + min.emplace_back(0.f); + min.emplace_back(0.f); + max.emplace_back(1.f); + max.emplace_back(2.f); + max.emplace_back(3.f); MDBoxImplicitFunction box(min, max); TS_ASSERT_EQUALS(1 * 2 * 3, box.volume()); } @@ -73,11 +73,11 @@ public: const coord_t areaMin = 1.0f; const coord_t areaMax = 2.0f; std::vector<coord_t> min; - min.push_back(areaMin); - min.push_back(areaMin); + min.emplace_back(areaMin); + min.emplace_back(areaMin); std::vector<coord_t> max; - max.push_back(areaMax); - max.push_back(areaMax); + max.emplace_back(areaMax); + max.emplace_back(areaMax); MDBoxImplicitFunction f(min, max); // The box to test. @@ -85,9 +85,9 @@ public: const coord_t boxMax = 0.1f; std::vector<Extent> extents; // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); TS_ASSERT_EQUALS(0.0, f.fraction(extents)); } @@ -97,11 +97,11 @@ public: const coord_t areaMin = 1.0f; const coord_t areaMax = 2.0f; std::vector<coord_t> min; - min.push_back(areaMin); - min.push_back(areaMin); + min.emplace_back(areaMin); + min.emplace_back(areaMin); std::vector<coord_t> max; - max.push_back(areaMax); - max.push_back(areaMax); + max.emplace_back(areaMax); + max.emplace_back(areaMax); MDBoxImplicitFunction f(min, max); // The box to test. @@ -110,13 +110,13 @@ public: std::vector<coord_t> boxVertexes; std::vector<Extent> extents; // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); TS_ASSERT_EQUALS(1.0, f.fraction(extents)); } @@ -126,9 +126,9 @@ public: const coord_t areaMin = 0.9f; const coord_t areaMax = 2.0f; std::vector<coord_t> min; - min.push_back(areaMin); + min.emplace_back(areaMin); std::vector<coord_t> max; - max.push_back(areaMax); + max.emplace_back(areaMax); MDBoxImplicitFunction f(min, max); // The box to test. @@ -136,7 +136,7 @@ public: const coord_t boxMax = 1; std::vector<Extent> extents; // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); /* @@ -157,9 +157,9 @@ public: const coord_t areaMin = 0.25; const coord_t areaMax = 0.75; std::vector<coord_t> min; - min.push_back(areaMin); + min.emplace_back(areaMin); std::vector<coord_t> max; - max.push_back(areaMax); + max.emplace_back(areaMax); MDBoxImplicitFunction f(min, max); // The box to test. @@ -167,7 +167,7 @@ public: const coord_t boxMax = 1.0; std::vector<Extent> extents; // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); /* @@ -208,11 +208,11 @@ public: const coord_t areaMin = 0.5; const coord_t areaMax = 1.5; std::vector<coord_t> min; - min.push_back(areaMin); - min.push_back(areaMin); + min.emplace_back(areaMin); + min.emplace_back(areaMin); std::vector<coord_t> max; - max.push_back(areaMax); - max.push_back(areaMax); + max.emplace_back(areaMax); + max.emplace_back(areaMax); MDBoxImplicitFunction f(min, max); // The box to test. @@ -220,9 +220,9 @@ public: const coord_t boxMax = 1; std::vector<Extent> extents; // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); TSM_ASSERT_DELTA("2d overlap incorrectly calculated", 1.0 / 4, f.fraction(extents), 1e-3); @@ -253,11 +253,11 @@ public: const coord_t areaMin = 0.5; const coord_t areaMax = 1.5; std::vector<coord_t> min; - min.push_back(areaMin); // xmin at 0.5 - min.push_back(areaMin + (areaMin / 2)); // ymin at 0.75 + min.emplace_back(areaMin); // xmin at 0.5 + min.emplace_back(areaMin + (areaMin / 2)); // ymin at 0.75 std::vector<coord_t> max; - max.push_back(areaMax); - max.push_back(areaMax + (areaMin / 2)); // ymax at 0.75 + max.emplace_back(areaMax); + max.emplace_back(areaMax + (areaMin / 2)); // ymax at 0.75 MDBoxImplicitFunction f(min, max); // The box to test. @@ -265,9 +265,9 @@ public: const coord_t boxMax = 1; std::vector<Extent> extents; // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); // extent - extents.push_back(Extent(boxMin, boxMax)); + extents.emplace_back(Extent(boxMin, boxMax)); TSM_ASSERT_DELTA("2d overlap incorrectly calculated", 1.0 / 8, f.fraction(extents), 1e-3); @@ -278,27 +278,27 @@ class MDBoxImplicitFunctionTestPerformance : public CxxTest::TestSuite { public: MDBoxImplicitFunction get3DFunction() { std::vector<coord_t> min; - min.push_back(1.0); - min.push_back(2.0); - min.push_back(3.0); + min.emplace_back(1.0f); + min.emplace_back(2.0f); + min.emplace_back(3.0f); std::vector<coord_t> max; - max.push_back(2.0); - max.push_back(3.0); - max.push_back(4.0); + max.emplace_back(2.0f); + max.emplace_back(3.0f); + max.emplace_back(4.0f); return MDBoxImplicitFunction(min, max); } MDBoxImplicitFunction get4DFunction() { std::vector<coord_t> min; - min.push_back(1.0); - min.push_back(2.0); - min.push_back(3.0); - min.push_back(4.0); + min.emplace_back(1.0f); + min.emplace_back(2.0f); + min.emplace_back(3.0f); + min.emplace_back(4.0f); std::vector<coord_t> max; - max.push_back(2.0); - max.push_back(3.0); - max.push_back(4.0); - max.push_back(5.0); + max.emplace_back(2.0f); + max.emplace_back(3.0f); + max.emplace_back(4.0f); + max.emplace_back(5.0f); return MDBoxImplicitFunction(min, max); } diff --git a/Framework/Geometry/test/MDGeometryXMLBuilderTest.h b/Framework/Geometry/test/MDGeometryXMLBuilderTest.h index 3c1e410ddc53e3624742ed0cd725de77dfd31245..36d91bf9080646bd53c98f319d369f12437f7a10 100644 --- a/Framework/Geometry/test/MDGeometryXMLBuilderTest.h +++ b/Framework/Geometry/test/MDGeometryXMLBuilderTest.h @@ -291,9 +291,9 @@ public: .WillOnce(Return(createDimensionXMLString(1, -1, 1, "C", "c"))); VecIMDDimension_sptr vecDims; - vecDims.push_back(IMDDimension_sptr(pDimA)); - vecDims.push_back(IMDDimension_sptr(pDimB)); - vecDims.push_back(IMDDimension_sptr(pDimC)); + vecDims.emplace_back(IMDDimension_sptr(pDimA)); + vecDims.emplace_back(IMDDimension_sptr(pDimB)); + vecDims.emplace_back(IMDDimension_sptr(pDimC)); MDGeometryBuilderXML<NoDimensionPolicy> builder; builder.addManyOrdinaryDimensions(vecDims); diff --git a/Framework/Geometry/test/MDImplicitFunctionTest.h b/Framework/Geometry/test/MDImplicitFunctionTest.h index b9d29dfdaa363865a79db86e6f1e3debbc4f6f2d..f82c440101af8c18ac9567623ba1dfb7d6fdce3a 100644 --- a/Framework/Geometry/test/MDImplicitFunctionTest.h +++ b/Framework/Geometry/test/MDImplicitFunctionTest.h @@ -81,22 +81,22 @@ public: // These points will be blocked by adding the second plane std::vector<coord_t> point; point.clear(); - point.push_back(-1); - point.push_back(-2); + point.emplace_back(-1.f); + point.emplace_back(-2.f); TS_ASSERT(f.isPointContained(point)); point.clear(); - point.push_back(2.5); - point.push_back(3.5); + point.emplace_back(2.5f); + point.emplace_back(3.5f); TS_ASSERT(!f.isPointContained(point)); } void add2DVertex(std::vector<std::vector<coord_t>> &vertexes, double x, double y) { std::vector<coord_t> vertex; - vertex.push_back(static_cast<coord_t>(x)); - vertex.push_back(static_cast<coord_t>(y)); - vertexes.push_back(vertex); + vertex.emplace_back(static_cast<coord_t>(x)); + vertex.emplace_back(static_cast<coord_t>(y)); + vertexes.emplace_back(vertex); } /** Make the 4 points that define a square/rectangle diff --git a/Framework/Geometry/test/MDPlaneTest.h b/Framework/Geometry/test/MDPlaneTest.h index ff6da57afc1540d38e85630599b4f1f8e55bd805..dbf1e0abc8917085f060e039d5ae4ffd82674de9 100644 --- a/Framework/Geometry/test/MDPlaneTest.h +++ b/Framework/Geometry/test/MDPlaneTest.h @@ -24,13 +24,13 @@ public: std::vector<coord_t> point; TSM_ASSERT_THROWS_ANYTHING("O-dimensions are not allowed.", MDPlane test(normal, point)); - normal.push_back(1.234f); - normal.push_back(4.56f); - point.push_back(0); + normal.emplace_back(1.234f); + normal.emplace_back(4.56f); + point.emplace_back(0.f); TSM_ASSERT_THROWS_ANYTHING( "Mismatched dimensions in normal/point are not allowed.", MDPlane test(normal, point)); - point.push_back(0); + point.emplace_back(0.f); MDPlane p(normal, point); TS_ASSERT_EQUALS(p.getNumDims(), 2); TS_ASSERT_DELTA(p.getNormal()[0], 1.234, 1e-5); @@ -64,13 +64,13 @@ public: std::vector<VMD> points; VMD insidePoint(1); TS_ASSERT_THROWS_ANYTHING(MDPlane p(points, VMD(1, 2, 3), insidePoint)); - points.push_back(VMD(1, 2, 3)); + points.emplace_back(VMD(1, 2, 3)); TS_ASSERT_THROWS_ANYTHING(MDPlane p(points, VMD(1, 2, 3), VMD(2, 3, 4))); } void test_constructorVectors_2D() { std::vector<VMD> points; - points.push_back(VMD(1.0, 1.0)); + points.emplace_back(VMD(1.0, 1.0)); MDPlane p(points, VMD(0., 0.), VMD(1.5, 0.5)); TS_ASSERT(p.isPointBounded(VMD(0.2, 0.1))); } @@ -78,8 +78,8 @@ public: /// Define a plane along x=y axis vertical in Z void test_constructorVectors_3D() { std::vector<VMD> points; - points.push_back(VMD(1., 1., 0.)); - points.push_back(VMD(0., 0., 1.)); + points.emplace_back(VMD(1., 1., 0.)); + points.emplace_back(VMD(0., 0., 1.)); MDPlane p(points, VMD(0., 0., 0.), VMD(0.5, 1.5, 1.0)); TS_ASSERT(p.isPointBounded(VMD(0.5, 1.5, 1.0))); } @@ -87,8 +87,8 @@ public: /// Bad vectors = they are collinear void test_constructorVectors_3D_collinear() { std::vector<VMD> points; - points.push_back(VMD(1., 1., 0.)); - points.push_back(VMD(2., 2., 0.)); + points.emplace_back(VMD(1., 1., 0.)); + points.emplace_back(VMD(2., 2., 0.)); TS_ASSERT_THROWS_ANYTHING( MDPlane p(points, VMD(0., 0., 0.), VMD(0.5, 1.5, 1.0))); } @@ -96,9 +96,9 @@ public: /// Define a plane along x=y axis vertical in Z and t void test_constructorVectors_4D() { std::vector<VMD> points; - points.push_back(VMD(1., 1., 0., 0.)); - points.push_back(VMD(0., 0., 1., 0.)); - points.push_back(VMD(0., 0., 0., 1.)); + points.emplace_back(VMD(1., 1., 0., 0.)); + points.emplace_back(VMD(0., 0., 1., 0.)); + points.emplace_back(VMD(0., 0., 0., 1.)); MDPlane p(points, VMD(0., 0., 0., 0.), VMD(0.5, 1.5, 1.0, 1.0)); TS_ASSERT(p.isPointBounded(VMD(0.5, 1.5, 1.0, -23.0))); TS_ASSERT(!p.isPointBounded(VMD(1.5, 0.5, 1.0, -23.0))); @@ -211,20 +211,20 @@ public: MDPlane p1(2, normal1, point1); std::vector<coord_t> point; point.clear(); - point.push_back(4.0); - point.push_back(12.0); + point.emplace_back(4.0f); + point.emplace_back(12.0f); TS_ASSERT(p1.isPointBounded(point)); point.clear(); - point.push_back(5.0); - point.push_back(-5.0); + point.emplace_back(5.0f); + point.emplace_back(-5.0f); TSM_ASSERT("Point should be found to be bounded by " "plane, it lies exactly on the plane", p1.isPointBounded(point)); point.clear(); - point.push_back(6.0); - point.push_back(-5.0); + point.emplace_back(6.0f); + point.emplace_back(-5.0f); TS_ASSERT(!p1.isPointBounded(point)); } @@ -235,15 +235,15 @@ public: MDPlane p1(2, normal1, point1); std::vector<coord_t> point; point.clear(); - point.push_back(4.0); - point.push_back(12.0); + point.emplace_back(4.0f); + point.emplace_back(12.0f); TSM_ASSERT("Point should be found to be inside region bounded by plane", p1.isPointInside(point)); // Point lies on the plane, not inside it point.clear(); - point.push_back(5.0); - point.push_back(-5.0); + point.emplace_back(5.0f); + point.emplace_back(-5.0f); TSM_ASSERT("Point should not be found to be inside region bounded by " "plane, it lies exactly on the plane", !p1.isPointInside(point)); @@ -305,10 +305,10 @@ public: coord_t point[4] = {1}; std::vector<coord_t> pointA; - pointA.push_back(0.111f); - pointA.push_back(0.222f); - pointA.push_back(0.333f); - pointA.push_back(0.444f); + pointA.emplace_back(0.111f); + pointA.emplace_back(0.222f); + pointA.emplace_back(0.333f); + pointA.emplace_back(0.444f); MDPlane p(4, normal, point); bool res = false; diff --git a/Framework/Geometry/test/MeshObject2DTest.h b/Framework/Geometry/test/MeshObject2DTest.h index 5cb89ed6193243c29dcd15a654d1faabe91bacc1..a35e566afeb6c4f4994be0cafc80c76501f83bcc 100644 --- a/Framework/Geometry/test/MeshObject2DTest.h +++ b/Framework/Geometry/test/MeshObject2DTest.h @@ -51,36 +51,36 @@ public: void test_not_in_plane_if_insufficient_points() { std::vector<V3D> points; - points.push_back(V3D{1, 0, 0}); - points.push_back(V3D{2, 1, 0}); + points.emplace_back(V3D{1, 0, 0}); + points.emplace_back(V3D{2, 1, 0}); TS_ASSERT(!MeshObject2D::pointsCoplanar(points)); } void test_points_not_in_plane_if_colinear() { std::vector<V3D> points; - points.push_back(V3D{1, 0, 0}); - points.push_back(V3D{2, 0, 0}); - points.push_back(V3D{3, 0, 0}); + points.emplace_back(V3D{1, 0, 0}); + points.emplace_back(V3D{2, 0, 0}); + points.emplace_back(V3D{3, 0, 0}); TS_ASSERT(!MeshObject2D::pointsCoplanar(points)); } void test_points_in_plane() { using Mantid::Kernel::V3D; std::vector<V3D> points; - points.push_back(V3D{1, 0, 0}); - points.push_back(V3D{2, 0, 0}); - points.push_back(V3D{3, 0, 0}); - points.push_back(V3D{1, 1, 0}); + points.emplace_back(V3D{1, 0, 0}); + points.emplace_back(V3D{2, 0, 0}); + points.emplace_back(V3D{3, 0, 0}); + points.emplace_back(V3D{1, 1, 0}); TS_ASSERT(MeshObject2D::pointsCoplanar(points)); } void test_points_not_in_plane() { std::vector<V3D> points; // Make tetrahedron - points.push_back(V3D{-1, 0, 0}); - points.push_back(V3D{1, 0, 0}); - points.push_back(V3D{0, 0, -1}); - points.push_back(V3D{0, 1, 0}); + points.emplace_back(V3D{-1, 0, 0}); + points.emplace_back(V3D{1, 0, 0}); + points.emplace_back(V3D{0, 0, -1}); + points.emplace_back(V3D{0, 1, 0}); TS_ASSERT(!MeshObject2D::pointsCoplanar(points)); } void test_construct_with_insufficient_points_throws() { diff --git a/Framework/Geometry/test/MeshObjectTest.h b/Framework/Geometry/test/MeshObjectTest.h index d900ebd9ee79932351e338e5d6316a38ff1eb28f..d5b5b782a8b08d360bcb193de4b7eede1d3a0fcd 100644 --- a/Framework/Geometry/test/MeshObjectTest.h +++ b/Framework/Geometry/test/MeshObjectTest.h @@ -1129,7 +1129,7 @@ public: std::vector<V3D> output; output.reserve(num); for (size_t i = 0; i < num; ++i) { - output.push_back(create_test_point(i, dim)); + output.emplace_back(create_test_point(i, dim)); } return output; } @@ -1151,7 +1151,7 @@ public: std::vector<Track> output; output.reserve(num); for (size_t i = 0; i < num; ++i) { - output.push_back(create_test_ray(i, sDim, dDim)); + output.emplace_back(create_test_ray(i, sDim, dDim)); } return output; } diff --git a/Framework/Geometry/test/ProductOfCyclicGroupsTest.h b/Framework/Geometry/test/ProductOfCyclicGroupsTest.h index 8c007c66b2eb7984c87322db6ca47e9a011d4e4a..b9cd4e3073328a0c09db461f48a289922e008a14 100644 --- a/Framework/Geometry/test/ProductOfCyclicGroupsTest.h +++ b/Framework/Geometry/test/ProductOfCyclicGroupsTest.h @@ -34,13 +34,13 @@ public: void testVectorConstructor() { std::vector<Group_const_sptr> groups; - groups.push_back(GroupFactory::create<CyclicGroup>("-x,-y,-z")); - groups.push_back(GroupFactory::create<CyclicGroup>("x,-y,z")); + groups.emplace_back(GroupFactory::create<CyclicGroup>("-x,-y,-z")); + groups.emplace_back(GroupFactory::create<CyclicGroup>("x,-y,z")); TS_ASSERT_THROWS_NOTHING(ProductOfCyclicGroups group(groups)); Group_const_sptr null; - groups.push_back(null); + groups.emplace_back(null); TS_ASSERT_THROWS_ANYTHING(ProductOfCyclicGroups group(groups)); } @@ -71,8 +71,8 @@ public: TestableProductOfCyclicGroups group; std::vector<Group_const_sptr> groups; - groups.push_back(GroupFactory::create<CyclicGroup>("-x,-y,-z")); - groups.push_back(GroupFactory::create<CyclicGroup>("x,-y,z")); + groups.emplace_back(GroupFactory::create<CyclicGroup>("-x,-y,-z")); + groups.emplace_back(GroupFactory::create<CyclicGroup>("x,-y,z")); Group_const_sptr productGroup = group.getProductOfCyclicGroups(groups); diff --git a/Framework/Geometry/test/SymmetryOperationTest.h b/Framework/Geometry/test/SymmetryOperationTest.h index 2448598a68f8ea2d4b268255a7aaddae6cfccb3a..f5974139b60849db824ebdf56b878138f59a1b46 100644 --- a/Framework/Geometry/test/SymmetryOperationTest.h +++ b/Framework/Geometry/test/SymmetryOperationTest.h @@ -43,10 +43,10 @@ public: : m_h(3.0), m_k(2.0), m_l(4.0), m_hkl(m_h, m_k, m_l), m_hhl(m_h, m_h, m_l), m_hk0(m_h, m_k, 0.0), m_h00(m_h, 0.0, 0.0), m_allHkl() { - m_allHkl.push_back(m_hkl); - m_allHkl.push_back(m_hhl); - m_allHkl.push_back(m_hk0); - m_allHkl.push_back(m_h00); + m_allHkl.emplace_back(m_hkl); + m_allHkl.emplace_back(m_hhl); + m_allHkl.emplace_back(m_hk0); + m_allHkl.emplace_back(m_h00); } void testDefaultConstructor() { diff --git a/Framework/HistogramData/test/HistogramTest.h b/Framework/HistogramData/test/HistogramTest.h index 684445e5191d9e3ec7f814e1974c727a776fe87b..d5ba610df68565f17c6b7ea9eae7e3adbcdd5847 100644 --- a/Framework/HistogramData/test/HistogramTest.h +++ b/Framework/HistogramData/test/HistogramTest.h @@ -1211,7 +1211,7 @@ public: HistogramTestPerformance() : xData(histSize, LinearGenerator(0, 2)) { BinEdges edges(histSize, LinearGenerator(0, 2)); for (size_t i = 0; i < nHists; i++) - hists.push_back(Histogram(edges)); + hists.emplace_back(Histogram(edges)); } void test_copy_X() { diff --git a/Framework/ICat/src/CatalogDownloadDataFiles.cpp b/Framework/ICat/src/CatalogDownloadDataFiles.cpp index f5c26ca33f204143e2ac00f7896de403828a789c..847c3b6977436d2f862b5a3bc2cf16a901ca40bb 100644 --- a/Framework/ICat/src/CatalogDownloadDataFiles.cpp +++ b/Framework/ICat/src/CatalogDownloadDataFiles.cpp @@ -109,7 +109,7 @@ void CatalogDownloadDataFiles::exec() { if (hasAccessToArchives) { g_log.information() << "File (" << *fileName << ") located in archives (" << fileLocation << ").\n"; - fileLocations.push_back(fileLocation); + fileLocations.emplace_back(fileLocation); } else { g_log.information() << "Unable to open file (" << *fileName @@ -120,7 +120,7 @@ void CatalogDownloadDataFiles::exec() { progress(prog, "downloading over internet..."); const std::string fullPathDownloadedFile = doDownloadandSavetoLocalDrive(url, *fileName); - fileLocations.push_back(fullPathDownloadedFile); + fileLocations.emplace_back(fullPathDownloadedFile); } } diff --git a/Framework/ICat/src/ICat3/ICat3Helper.cpp b/Framework/ICat/src/ICat3/ICat3Helper.cpp index 19ede8ed1d0cc760be631a8728876d6e6089d194..01b69613d0a1d8851a5b782367e73e87e5247321 100644 --- a/Framework/ICat/src/ICat3/ICat3Helper.cpp +++ b/Framework/ICat/src/ICat3/ICat3Helper.cpp @@ -516,12 +516,12 @@ CICatHelper::buildSearchQuery(const CatalogSearchParam &inputs) { // instrument name if (!inputs.getInstrument().empty()) { - advancedSearchDetails->instruments.push_back(inputs.getInstrument()); + advancedSearchDetails->instruments.emplace_back(inputs.getInstrument()); } // keywords if (!inputs.getKeywords().empty()) { - advancedSearchDetails->keywords.push_back(inputs.getKeywords()); + advancedSearchDetails->keywords.emplace_back(inputs.getKeywords()); } std::string investigationName, investigationType, datafileName, sampleName; @@ -552,7 +552,7 @@ CICatHelper::buildSearchQuery(const CatalogSearchParam &inputs) { // investigator's surname if (!inputs.getInvestigatorSurName().empty()) { - advancedSearchDetails->investigators.push_back( + advancedSearchDetails->investigators.emplace_back( inputs.getInvestigatorSurName()); } diff --git a/Framework/ICat/src/ICat4/ICat4Catalog.cpp b/Framework/ICat/src/ICat4/ICat4Catalog.cpp index 734589cf40f2bb1a0d275da9693c20dc1526fe76..8711fc15284d58768c0d14b1c862552bdd153b24 100644 --- a/Framework/ICat/src/ICat4/ICat4Catalog.cpp +++ b/Framework/ICat/src/ICat4/ICat4Catalog.cpp @@ -82,11 +82,11 @@ API::CatalogSession_sptr ICat4Catalog::login(const std::string &username, // Setting the username and pass credentials to the login class. entry.key = &usernameKey; entry.value = &userName; - entries.push_back(entry); + entries.emplace_back(entry); entry.key = &passwordKey; entry.value = &passWord; - entries.push_back(entry); + entries.emplace_back(entry); int result = icat.login(&login, &loginResponse); @@ -557,7 +557,7 @@ void ICat4Catalog::listInstruments(std::vector<std::string> &instruments) { for (auto &searchResult : searchResults) { auto instrument = dynamic_cast<xsd__string *>(searchResult); if (instrument) - instruments.push_back(instrument->__item); + instruments.emplace_back(instrument->__item); } } @@ -576,7 +576,7 @@ void ICat4Catalog::listInvestigationTypes( for (auto &searchResult : searchResults) { auto investigationType = dynamic_cast<xsd__string *>(searchResult); if (investigationType) - invstTypes.push_back(investigationType->__item); + invstTypes.emplace_back(investigationType->__item); } } diff --git a/Framework/Indexing/inc/MantidIndexing/Conversion.h b/Framework/Indexing/inc/MantidIndexing/Conversion.h index 310068a8e964ff146f07969b116ed8cc7a337577..19232ed4358ce060af9806064575d2e672a85b05 100644 --- a/Framework/Indexing/inc/MantidIndexing/Conversion.h +++ b/Framework/Indexing/inc/MantidIndexing/Conversion.h @@ -35,7 +35,7 @@ std::vector<Out> castVector(const std::vector<In> &indices) { std::vector<Out> converted; converted.reserve(indices.size()); for (const auto index : indices) - converted.push_back(static_cast<typename Out::underlying_type>(index)); + converted.emplace_back(static_cast<typename Out::underlying_type>(index)); return converted; } @@ -53,7 +53,7 @@ std::vector<Out> castVector(const std::vector<In> &indices) { std::vector<Out> converted; converted.reserve(indices.size()); for (const auto index : indices) - converted.push_back( + converted.emplace_back( static_cast<Out>(static_cast<typename In::underlying_type>(index))); return converted; } diff --git a/Framework/Indexing/src/IndexInfo.cpp b/Framework/Indexing/src/IndexInfo.cpp index 06b80b311c93466e19d45d0a67e2ca2ddba7ce26..166612fb16fba97c9eb65ef539c0d8af7d45c209 100644 --- a/Framework/Indexing/src/IndexInfo.cpp +++ b/Framework/Indexing/src/IndexInfo.cpp @@ -317,7 +317,7 @@ IndexInfo::globalSpectrumIndicesFromDetectorIndices( const auto timeIndex = static_cast<size_t>(spectrumDefinition.second); if (detectorMap.size() > detectorIndex && detectorMap[detectorIndex].first != 0) { - spectrumIndices.push_back(i); + spectrumIndices.emplace_back(i); if (detectorMap[detectorIndex].first == 1) { ++detectorMap[detectorIndex].first; } diff --git a/Framework/Indexing/src/Scatter.cpp b/Framework/Indexing/src/Scatter.cpp index a494242873af87274dce658119519da85604f627..629477499d41b98798779c9c8bd8646b7596cfd8 100644 --- a/Framework/Indexing/src/Scatter.cpp +++ b/Framework/Indexing/src/Scatter.cpp @@ -27,7 +27,7 @@ IndexInfo scatter(const Indexing::IndexInfo &indexInfo) { std::vector<SpectrumNumber> spectrumNumbers; for (size_t i = 0; i < indexInfo.size(); ++i) - spectrumNumbers.push_back(indexInfo.spectrumNumber(i)); + spectrumNumbers.emplace_back(indexInfo.spectrumNumber(i)); IndexInfo scattered(spectrumNumbers, Parallel::StorageMode::Distributed, indexInfo.communicator()); const auto &globalSpectrumDefinitions = indexInfo.spectrumDefinitions(); diff --git a/Framework/Indexing/src/SpectrumNumberTranslator.cpp b/Framework/Indexing/src/SpectrumNumberTranslator.cpp index 871e683f671b601a5c395c3759be8d24771c043f..2a4b1a36b4b16bd8bd4355088c5fca0cd2bd381b 100644 --- a/Framework/Indexing/src/SpectrumNumberTranslator.cpp +++ b/Framework/Indexing/src/SpectrumNumberTranslator.cpp @@ -118,7 +118,7 @@ SpectrumNumberTranslator::makeIndexSet(SpectrumNumber min, const auto begin = lower_bound(m_spectrumNumberToIndex, min); const auto end = upper_bound(m_spectrumNumberToIndex, max); for (auto it = begin; it != end; ++it) - indices.push_back(it->second); + indices.emplace_back(it->second); return SpectrumIndexSet(indices, m_spectrumNumberToIndex.size()); } @@ -150,7 +150,8 @@ SpectrumIndexSet SpectrumNumberTranslator::makeIndexSet( std::vector<size_t> indices; for (const auto &spectrumNumber : spectrumNumbers) if (m_spectrumNumberToPartition.at(spectrumNumber) == m_partition) - indices.push_back(find(m_spectrumNumberToIndex, spectrumNumber)->second); + indices.emplace_back( + find(m_spectrumNumberToIndex, spectrumNumber)->second); return SpectrumIndexSet(indices, m_spectrumNumberToIndex.size()); } @@ -163,7 +164,7 @@ SpectrumIndexSet SpectrumNumberTranslator::makeIndexSet( "SpectrumIndexTranslator: specified index is out of range."); const auto it = find(m_globalToLocal, globalIndex); if (it != m_globalToLocal.end()) - indices.push_back(it->second); + indices.emplace_back(it->second); } return SpectrumIndexSet(indices, m_globalToLocal.size()); } diff --git a/Framework/Kernel/inc/MantidKernel/DataService.h b/Framework/Kernel/inc/MantidKernel/DataService.h index f3eb57b2eb82b8e45ff44fcfb08a80c24aa9ed52..a2fd738b5c87a5a6fbab5ad7dd5b96ef44fae10b 100644 --- a/Framework/Kernel/inc/MantidKernel/DataService.h +++ b/Framework/Kernel/inc/MantidKernel/DataService.h @@ -445,7 +445,7 @@ public: std::lock_guard<std::recursive_mutex> _lock(m_mutex); foundNames.reserve(datamap.size()); for (const auto &item : datamap) { - foundNames.push_back(item.first); + foundNames.emplace_back(item.first); } // Lock released at end of scope here } else { @@ -454,7 +454,7 @@ public: for (const auto &item : datamap) { if (!isHiddenDataServiceObject(item.first)) { // This item is not hidden add it - foundNames.push_back(item.first); + foundNames.emplace_back(item.first); } } // Lock released at end of scope here @@ -484,7 +484,7 @@ public: objects.reserve(datamap.size()); for (const auto &it : datamap) { if (showingHidden || !isHiddenDataServiceObject(it.first)) { - objects.push_back(it.second); + objects.emplace_back(it.second); } } return objects; diff --git a/Framework/Kernel/inc/MantidKernel/ListValidator.h b/Framework/Kernel/inc/MantidKernel/ListValidator.h index a9e02f08da239e9c1e283724ce63ab635dbaaa95..f763b374bbde5f75247e61c335fc2c2b1bff119f 100644 --- a/Framework/Kernel/inc/MantidKernel/ListValidator.h +++ b/Framework/Kernel/inc/MantidKernel/ListValidator.h @@ -75,7 +75,7 @@ public: allowedStrings.reserve(m_allowedValues.size()); auto cend = m_allowedValues.end(); for (auto cit = m_allowedValues.begin(); cit != cend; ++cit) { - allowedStrings.push_back(boost::lexical_cast<std::string>(*cit)); + allowedStrings.emplace_back(boost::lexical_cast<std::string>(*cit)); } return allowedStrings; } @@ -88,7 +88,7 @@ public: // add only new values if (std::find(m_allowedValues.begin(), m_allowedValues.end(), value) == m_allowedValues.end()) { - m_allowedValues.push_back(value); + m_allowedValues.emplace_back(value); } } diff --git a/Framework/Kernel/inc/MantidKernel/PropertyHelper.h b/Framework/Kernel/inc/MantidKernel/PropertyHelper.h index e5e2b5ec3391f5335eaeb169639d176ce9e4ae4c..161e85743611fb5ddd0dced84c6ed2c8a13f5c30 100644 --- a/Framework/Kernel/inc/MantidKernel/PropertyHelper.h +++ b/Framework/Kernel/inc/MantidKernel/PropertyHelper.h @@ -190,7 +190,7 @@ inline void appendValue(const std::string &strvalue, std::vector<T> &value) { // just convert the whole thing into a value if (pos == std::string::npos) { - value.push_back(boost::lexical_cast<T>(strvalue)); + value.emplace_back(boost::lexical_cast<T>(strvalue)); return; } @@ -204,7 +204,7 @@ inline void appendValue(const std::string &strvalue, std::vector<T> &value) { if (start + step < start) throw std::logic_error("Step size is negative with increasing limits"); for (auto i = start; i <= stop;) { - value.push_back(i); + value.emplace_back(i); // done inside the loop because gcc7 doesn't like i+=step for short // unsigned int i = static_cast<T>(i + step); @@ -213,7 +213,7 @@ inline void appendValue(const std::string &strvalue, std::vector<T> &value) { if (start + step >= start) throw std::logic_error("Step size is positive with decreasing limits"); for (auto i = start; i >= stop;) { - value.push_back(i); + value.emplace_back(i); // done inside the loop because gcc7 doesn't like i+=step for short // unsigned int i = static_cast<T>(i + step); @@ -303,7 +303,7 @@ void toValue(const std::string &strvalue, std::vector<std::vector<T>> &value, std::transform( values.begin(), values.end(), std::back_inserter(vect), [](const std::string &str) { return boost::lexical_cast<T>(str); }); - value.push_back(std::move(vect)); + value.emplace_back(std::move(vect)); } } diff --git a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h index 8b632b9ffee43169d00156f7dae26186e34cb11e..e3039773916a2f2b7545492fc4d0502addb6e5f4 100644 --- a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h +++ b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h @@ -143,7 +143,7 @@ public: // Cache the total cost m_queueLock.lock(); m_cost += newTask->cost(); - m_queue.push_back(newTask); + m_queue.emplace_back(newTask); m_queueLock.unlock(); } diff --git a/Framework/Kernel/src/BinFinder.cpp b/Framework/Kernel/src/BinFinder.cpp index 1e6e599dc454d0452fe879fc86b231775b4b6e92..05f7abfb9f1b9197a3ccea1bae9eb67bb2519c01 100644 --- a/Framework/Kernel/src/BinFinder.cpp +++ b/Framework/Kernel/src/BinFinder.cpp @@ -37,11 +37,11 @@ BinFinder::BinFinder(const std::vector<double> &binParams) { double max = binParams[i * 2 + 2]; // Only the first bin needs the min boundary if (i == 0) - boundaries.push_back(min); - boundaries.push_back(max); + boundaries.emplace_back(min); + boundaries.emplace_back(max); // The step double step = binParams[i * 2 + 1]; - stepSizes.push_back(step); + stepSizes.emplace_back(step); if (step == 0) throw std::invalid_argument("BinFinder: step size of 0."); if ((step < 0) && (min <= 0)) @@ -56,10 +56,10 @@ BinFinder::BinFinder(const std::vector<double> &binParams) { // Pre-do some calculations for log binning. if (step < 0) { double log_step = log1p(fabs(step)); - logSteps.push_back(log_step); + logSteps.emplace_back(log_step); if (i == 0) - logBoundaries.push_back(log(min)); - logBoundaries.push_back(log(max)); + logBoundaries.emplace_back(log(min)); + logBoundaries.emplace_back(log(max)); // How many bins is that? numBins = static_cast<int>(ceil((log(max) - log(min)) / log_step)); @@ -76,10 +76,10 @@ BinFinder::BinFinder(const std::vector<double> &binParams) { } else { // Empty log values; these won't be used - logSteps.push_back(0); + logSteps.emplace_back(0); if (i == 0) - logBoundaries.push_back(0); - logBoundaries.push_back(0); + logBoundaries.emplace_back(0); + logBoundaries.emplace_back(0); //# of linear bins numBins = static_cast<int>(ceil((max - min) / step)); @@ -96,7 +96,7 @@ BinFinder::BinFinder(const std::vector<double> &binParams) { int startBinIndex = 0; if (i > 0) startBinIndex = this->endBinIndex[i - 1]; - endBinIndex.push_back(numBins + startBinIndex); + endBinIndex.emplace_back(numBins + startBinIndex); } // How many binning regions? numRegions = static_cast<int>(stepSizes.size()); diff --git a/Framework/Kernel/src/CompositeValidator.cpp b/Framework/Kernel/src/CompositeValidator.cpp index f67a6f47c04d75f18afb28ba6e651049a4358128..4b333e91493637cedc2cabf78ad4265ded472802 100644 --- a/Framework/Kernel/src/CompositeValidator.cpp +++ b/Framework/Kernel/src/CompositeValidator.cpp @@ -69,7 +69,7 @@ Kernel::IValidator_sptr CompositeValidator::clone() const { * @param child :: A pointer to the validator to add */ void CompositeValidator::add(Kernel::IValidator_sptr child) { - m_children.push_back(child); + m_children.emplace_back(child); } /** Checks the value of all child validators. Fails if any child fails. diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp index 861b5936ae04805bf0ded8d88a9a9503d4b2382f..3e152df83f0885447c13c52838079df5542f60e3 100644 --- a/Framework/Kernel/src/ConfigService.cpp +++ b/Framework/Kernel/src/ConfigService.cpp @@ -94,7 +94,7 @@ std::vector<std::string> splitPath(const std::string &path) { std::vector<std::string> splitted; if (path.find(';') == std::string::npos) { // don't bother tokenizing - splitted.push_back(path); + splitted.emplace_back(path); } else { int options = Mantid::Kernel::StringTokenizer::TOK_TRIM + Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY; @@ -102,7 +102,7 @@ std::vector<std::string> splitPath(const std::string &path) { auto iend = tokenizer.end(); for (auto itr = tokenizer.begin(); itr != iend; ++itr) { if (!itr->empty()) { - splitted.push_back(*itr); + splitted.emplace_back(*itr); } } } @@ -935,7 +935,7 @@ void ConfigServiceImpl::getKeysRecursive( std::vector<std::string> rootKeys = getKeys(root); if (rootKeys.empty()) - allKeys.push_back(root); + allKeys.emplace_back(root); for (auto &rootKey : rootKeys) { std::string searchString; @@ -1595,7 +1595,7 @@ void ConfigServiceImpl::appendDataSearchSubDir(const std::string &subdir) { // only add new path if it isn't already there if (std::find(newDataDirs.begin(), newDataDirs.end(), newDirPath.toString()) == newDataDirs.end()) - newDataDirs.push_back(newDirPath.toString()); + newDataDirs.emplace_back(newDirPath.toString()); } catch (Poco::PathSyntaxException &) { continue; } @@ -1728,7 +1728,7 @@ bool ConfigServiceImpl::addDirectoryifExists( const std::string &directoryName, std::vector<std::string> &directoryList) { try { if (Poco::File(directoryName).isDirectory()) { - directoryList.push_back(directoryName); + directoryList.emplace_back(directoryName); return true; } else { g_log.information("Unable to locate directory at: " + directoryName); diff --git a/Framework/Kernel/src/DeltaEMode.cpp b/Framework/Kernel/src/DeltaEMode.cpp index 4581fbfe6d2a34aed08143805021d16483930014..4cc538263547c1fa19b6f740756da9f5301a1e03 100644 --- a/Framework/Kernel/src/DeltaEMode.cpp +++ b/Framework/Kernel/src/DeltaEMode.cpp @@ -41,7 +41,7 @@ const std::vector<std::string> DeltaEMode::availableTypes() { for (const auto &iter : lookup.index) { if (iter.first == DeltaEMode::Undefined) continue; - modes.push_back(iter.second); + modes.emplace_back(iter.second); } return modes; } diff --git a/Framework/Kernel/src/DiskBuffer.cpp b/Framework/Kernel/src/DiskBuffer.cpp index 22547d6a36f4044297db59d589bd1b731ab49830..e3098c9edddddc9fd3c11449bb126af6892ef69f 100644 --- a/Framework/Kernel/src/DiskBuffer.cpp +++ b/Framework/Kernel/src/DiskBuffer.cpp @@ -164,7 +164,7 @@ void DiskBuffer::writeOldObjects() { } else // object busy { // The object is busy, can't write. Save it for later - couldNotWrite.push_back(obj); + couldNotWrite.emplace_back(obj); // When a prefix or postfix operator is applied to a function argument, // the value of the argument is // NOT GUARANTEED to be incremented or decremented before it is passed to @@ -358,8 +358,8 @@ void DiskBuffer::getFreeSpaceVector(std::vector<uint64_t> &free) const { freeSpace_bySize_t::const_iterator it = m_free_bySize.begin(); freeSpace_bySize_t::const_iterator it_end = m_free_bySize.end(); for (; it != it_end; ++it) { - free.push_back(it->getFilePosition()); - free.push_back(it->getSize()); + free.emplace_back(it->getFilePosition()); + free.emplace_back(it->getSize()); } } diff --git a/Framework/Kernel/src/FacilityInfo.cpp b/Framework/Kernel/src/FacilityInfo.cpp index 7e0d38989e15fdc9ea33bbbeb532b1a3c8f2d9b7..92bb281bd9c3497a565c3c2a28d3078dccad385a 100644 --- a/Framework/Kernel/src/FacilityInfo.cpp +++ b/Framework/Kernel/src/FacilityInfo.cpp @@ -114,7 +114,7 @@ void FacilityInfo::fillExtensions(const Poco::XML::Element *elem) { void FacilityInfo::addExtension(const std::string &ext) { auto it = std::find(m_extensions.begin(), m_extensions.end(), ext); if (it == m_extensions.end()) - m_extensions.push_back(ext); + m_extensions.emplace_back(ext); } /// Called from constructor to fill archive interface names @@ -131,7 +131,7 @@ void FacilityInfo::fillArchiveNames(const Poco::XML::Element *elem) { auto *elem = dynamic_cast<Poco::XML::Element *>(pNL_interfaces->item(i)); std::string plugin = elem->getAttribute("plugin"); if (!plugin.empty()) { - m_archiveSearch.push_back(plugin); + m_archiveSearch.emplace_back(plugin); } } } @@ -167,7 +167,7 @@ void FacilityInfo::fillInstruments(const Poco::XML::Element *elem) { if (elem) { try { InstrumentInfo instr(this, elem); - m_instruments.push_back(instr); + m_instruments.emplace_back(instr); } catch (...) { /*skip this instrument*/ } } @@ -190,7 +190,7 @@ void FacilityInfo::fillComputeResources(const Poco::XML::Element *elem) { if (elem) { try { ComputeResourceInfo cr(this, elem); - m_computeResInfos.push_back(cr); + m_computeResInfos.emplace_back(cr); g_log.debug() << "Compute resource found: " << cr << '\n'; } catch (...) { // next resource... @@ -264,7 +264,7 @@ FacilityInfo::instruments(const std::string &tech) const { auto it = m_instruments.begin(); for (; it != m_instruments.end(); ++it) { if (it->techniques().count(tech)) { - out.push_back(*it); + out.emplace_back(*it); } } return out; @@ -278,7 +278,7 @@ std::vector<std::string> FacilityInfo::computeResources() const { std::vector<std::string> names; auto it = m_computeResources.begin(); while (it != m_computeResources.end()) { - names.push_back((*it).first); + names.emplace_back((*it).first); ++it; } diff --git a/Framework/Kernel/src/FileValidator.cpp b/Framework/Kernel/src/FileValidator.cpp index 7808ffd996b3d96449fd13ce55272b8e173c6598..f53736631a9e697b7d4b37518ce6d34de21e3422 100644 --- a/Framework/Kernel/src/FileValidator.cpp +++ b/Framework/Kernel/src/FileValidator.cpp @@ -33,7 +33,7 @@ FileValidator::FileValidator(const std::vector<std::string> &extensions, const std::string ext = boost::to_lower_copy(extension); if (std::find(m_extensions.begin(), m_extensions.end(), ext) == m_extensions.end()) { - m_extensions.push_back(ext); + m_extensions.emplace_back(ext); } } } diff --git a/Framework/Kernel/src/Interpolation.cpp b/Framework/Kernel/src/Interpolation.cpp index be88d82f97e7a5537e8dd20c5159c07a56d0c376..b494225597fe9fcd93e9cf2b9bcff4ac39745192 100644 --- a/Framework/Kernel/src/Interpolation.cpp +++ b/Framework/Kernel/src/Interpolation.cpp @@ -105,8 +105,8 @@ void Interpolation::addPoint(const double &xx, const double &yy) { std::vector<double>::iterator it; if (N == 0) { - m_x.push_back(xx); - m_y.push_back(yy); + m_x.emplace_back(xx); + m_y.emplace_back(yy); return; } @@ -121,8 +121,8 @@ void Interpolation::addPoint(const double &xx, const double &yy) { } if (xx >= m_x[N - 1]) { - m_x.push_back(xx); - m_y.push_back(yy); + m_x.emplace_back(xx); + m_y.emplace_back(yy); return; } diff --git a/Framework/Kernel/src/MaterialBuilder.cpp b/Framework/Kernel/src/MaterialBuilder.cpp index 3f2b5016d8aa2cab31f262d6e55a20b9a16ce873..31f31c1ec0ff163b5f7a2d0721d10d3e408dc442 100644 --- a/Framework/Kernel/src/MaterialBuilder.cpp +++ b/Framework/Kernel/src/MaterialBuilder.cpp @@ -249,7 +249,7 @@ MaterialBuilder::createCompositionFromAtomicNumber() const { static_cast<uint16_t>(m_massNo))), 1.}; Material::ChemicalFormula formula; - formula.push_back(unit); + formula.emplace_back(unit); return formula; } diff --git a/Framework/Kernel/src/PropertyHistory.cpp b/Framework/Kernel/src/PropertyHistory.cpp index c2a518126827db3b63db5f4c881cddb0eabd1bc1..588766996a7eb34068b68e75cf00369bbebeedf5 100644 --- a/Framework/Kernel/src/PropertyHistory.cpp +++ b/Framework/Kernel/src/PropertyHistory.cpp @@ -72,15 +72,15 @@ bool PropertyHistory::isEmptyDefault() const { static std::vector<std::string> numberTypes, emptyValues; // Type strings corresponding to numbers if (numberTypes.empty()) { - numberTypes.push_back(getUnmangledTypeName(typeid(int))); - numberTypes.push_back(getUnmangledTypeName(typeid(int64_t))); - numberTypes.push_back(getUnmangledTypeName(typeid(double))); + numberTypes.emplace_back(getUnmangledTypeName(typeid(int))); + numberTypes.emplace_back(getUnmangledTypeName(typeid(int64_t))); + numberTypes.emplace_back(getUnmangledTypeName(typeid(double))); } // Empty values if (emptyValues.empty()) { - emptyValues.push_back(std::to_string(EMPTY_INT())); - emptyValues.push_back(boost::lexical_cast<std::string>(EMPTY_DBL())); - emptyValues.push_back(std::to_string(EMPTY_LONG())); + emptyValues.emplace_back(std::to_string(EMPTY_INT())); + emptyValues.emplace_back(boost::lexical_cast<std::string>(EMPTY_DBL())); + emptyValues.emplace_back(std::to_string(EMPTY_LONG())); } // If default, input, number type and matches empty value then return true diff --git a/Framework/Kernel/src/PropertyManager.cpp b/Framework/Kernel/src/PropertyManager.cpp index 7419ce2786b4fee821140f69b7932f06b3940021..1e9f8054687ce5e2b9f0635b0ced373f0db76fb3 100644 --- a/Framework/Kernel/src/PropertyManager.cpp +++ b/Framework/Kernel/src/PropertyManager.cpp @@ -151,10 +151,10 @@ void PropertyManager::splitByTime( std::vector<Property *> output_properties; for (size_t i = 0; i < n; i++) { if (outputs[i]) - output_properties.push_back( + output_properties.emplace_back( outputs[i]->getPointerToPropertyOrNull(prop->name())); else - output_properties.push_back(nullptr); + output_properties.emplace_back(nullptr); } // Now the property does the splitting. @@ -202,7 +202,7 @@ void PropertyManager::declareProperty(std::unique_ptr<Property> p, const std::string key = createKey(p->name()); auto existing = m_properties.find(key); if (existing == m_properties.end()) { - m_orderedProperties.push_back(p.get()); + m_orderedProperties.emplace_back(p.get()); m_properties[key] = std::move(p); } else { // Don't error if this is actually the same property object! @@ -235,7 +235,7 @@ void PropertyManager::declareOrReplaceProperty(std::unique_ptr<Property> p, assert(ordereredPropPos != std::end(m_orderedProperties)); *ordereredPropPos = p.get(); } else { - m_orderedProperties.push_back(p.get()); + m_orderedProperties.emplace_back(p.get()); } m_properties[key] = std::move(p); } diff --git a/Framework/Kernel/src/RegexStrings.cpp b/Framework/Kernel/src/RegexStrings.cpp index 01ade0f52491fdfb9850ff6a2d57c524183f07a6..14557c67b50cd6182961246aeba2bfd5fb55bb92 100644 --- a/Framework/Kernel/src/RegexStrings.cpp +++ b/Framework/Kernel/src/RegexStrings.cpp @@ -145,7 +145,7 @@ int StrFullCut(std::string &Text, const boost::regex &Re, T tmp; if (!Mantid::Kernel::Strings::convert((*m1)[index].str(), tmp)) return 0; - Aout.push_back(tmp); + Aout.emplace_back(tmp); } ML = m1->position(zero) + (*m1)[0].str().length(); } @@ -182,7 +182,7 @@ int StrFullCut(std::string &Text, const boost::regex &Re, for (; m1 != empty; m1++) { ML = static_cast<int>(m1->position(zero) + (*m1)[0].str().length()); for (unsigned int index = 1; index < m1->size(); index++) - Aout.push_back((*m1)[index].str()); + Aout.emplace_back((*m1)[index].str()); } logger.information() << "SFC :: " << M0 << " " << ML << '\n'; // Found object @@ -211,7 +211,7 @@ int StrFullSplit(const std::string &text, const boost::regex &Re, T tmp; if (!Mantid::Kernel::Strings::convert((*m1)[index].str(), tmp)) return static_cast<int>(Aout.size()); - Aout.push_back(tmp); + Aout.emplace_back(tmp); } return static_cast<int>(Aout.size()); } @@ -237,7 +237,7 @@ int StrSingleSplit(const std::string &text, const boost::regex &Re, T tmp; if (!Mantid::Kernel::Strings::convert((*m1)[index].str(), tmp)) return static_cast<int>(Aout.size()); - Aout.push_back(tmp); + Aout.emplace_back(tmp); } return static_cast<int>(Aout.size()); @@ -262,7 +262,7 @@ int StrSingleSplit(const std::string &text, const boost::regex &Re, boost::sregex_iterator empty; if (m1 != empty) { for (unsigned int index = 1; index < m1->size(); index++) - Aout.push_back((*m1)[index].str()); + Aout.emplace_back((*m1)[index].str()); return 1; } return 0; diff --git a/Framework/Kernel/src/SimpleJSON.cpp b/Framework/Kernel/src/SimpleJSON.cpp index 340fe42019ab640a9ff3b00a0ffdfb444e47adfd..158ca2994fa82dc9175be613868956befd451829 100644 --- a/Framework/Kernel/src/SimpleJSON.cpp +++ b/Framework/Kernel/src/SimpleJSON.cpp @@ -399,7 +399,7 @@ void initArrayFromStream(JSONArray &arr, istream &istr) { // We expect to start the loop with the stream pointing to the // first character of the value // Add the value to our array - arr.push_back(initValueFromStream(istr)); + arr.emplace_back(initValueFromStream(istr)); istr >> nextChar; // nextChar is guaranteed to be either a comma, close brace or close diff --git a/Framework/Kernel/src/Statistics.cpp b/Framework/Kernel/src/Statistics.cpp index 2da8ac477a3e3f14c28639b4689caf279ac609f0..e6c27efb3506b1f6a74befff78bc8110a33c520c 100644 --- a/Framework/Kernel/src/Statistics.cpp +++ b/Framework/Kernel/src/Statistics.cpp @@ -111,7 +111,7 @@ std::vector<double> getZscore(const vector<TYPE> &data) { } for (auto it = data.cbegin(); it != data.cend(); ++it) { auto tmp = static_cast<double>(*it); - Zscore.push_back(fabs((stats.mean - tmp) / stats.standard_deviation)); + Zscore.emplace_back(fabs((stats.mean - tmp) / stats.standard_deviation)); } return Zscore; } @@ -146,8 +146,8 @@ std::vector<double> getWeightedZscore(const vector<TYPE> &data, std::pow(static_cast<double>(weights[it]) / sumWeights, 2); } for (auto it = data.cbegin(); it != data.cend(); ++it) { - Zscore.push_back(fabs((static_cast<double>(*it) - weightedMean) / - std::sqrt(weightedVariance))); + Zscore.emplace_back(fabs((static_cast<double>(*it) - weightedMean) / + std::sqrt(weightedVariance))); } return Zscore; } @@ -169,7 +169,7 @@ std::vector<double> getModifiedZscore(const vector<TYPE> &data, double median = getMedian(data, num_data, sorted); for (auto it = data.cbegin(); it != data.cend(); ++it) { tmp = static_cast<double>(*it); - MADvec.push_back(fabs(tmp - median)); + MADvec.emplace_back(fabs(tmp - median)); } double MAD = getMedian(MADvec, num_data, sorted); if (MAD == 0.) { @@ -180,7 +180,7 @@ std::vector<double> getModifiedZscore(const vector<TYPE> &data, std::vector<double> Zscore; for (auto it = data.begin(); it != data.end(); ++it) { tmp = static_cast<double>(*it); - Zscore.push_back(0.6745 * fabs((tmp - median) / MAD)); + Zscore.emplace_back(0.6745 * fabs((tmp - median) / MAD)); } return Zscore; } diff --git a/Framework/Kernel/src/Strings.cpp b/Framework/Kernel/src/Strings.cpp index e0c84207eb77e5090d8fd1a7a5bba0cffcd7593f..c66eece0660b7ddd893fd27bbb6b1a00bee5a365 100644 --- a/Framework/Kernel/src/Strings.cpp +++ b/Framework/Kernel/src/Strings.cpp @@ -783,7 +783,7 @@ int writeFile(const std::string &Fname, const T &step, const V<T, A> &Y) { V<T, A> Ex; // Empty vector V<T, A> X; // Empty vector for (unsigned int i = 0; i < Y.size(); i++) - X.push_back(i * step); + X.emplace_back(i * step); return writeFile(Fname, X, Y, Ex); } @@ -1023,14 +1023,14 @@ size_t split_path(const std::string &path, // code below implements perl split(/\\//,string) commamd. (\\ has been // converted to / above) std::list<int64_t> split_pos; - split_pos.push_back(-1); + split_pos.emplace_back(-1); size_t path_size = working_path.size(); for (size_t i = 0; i < path_size; i++) { if (working_path[i] == '/') { - split_pos.push_back(i); + split_pos.emplace_back(i); } } - split_pos.push_back(path_size); + split_pos.emplace_back(path_size); // allocate target vector to keep folder structure and fill it in size_t n_folders = split_pos.size() - 1; path_components.resize(n_folders); @@ -1135,7 +1135,7 @@ std::vector<int> parseRange(const std::string &str, const std::string &elemSep, int element; if (convert(rangeElements[0], element) != 1) throw std::invalid_argument("Invalid element: " + elementString); - result.push_back(element); + result.emplace_back(element); } // A pair else if (noOfRangeElements == 2) { @@ -1150,7 +1150,7 @@ std::vector<int> parseRange(const std::string &str, const std::string &elemSep, elementString); for (int i = start; i <= end; i++) - result.push_back(i); + result.emplace_back(i); } // Error - e.g. "--"" else { diff --git a/Framework/Kernel/src/TestChannel.cpp b/Framework/Kernel/src/TestChannel.cpp index b892490021c4b377692bf7dd3f470be51349a81b..54741ca25f423230fb1bdcf596cd5e7ea9d96ecb 100644 --- a/Framework/Kernel/src/TestChannel.cpp +++ b/Framework/Kernel/src/TestChannel.cpp @@ -11,7 +11,7 @@ namespace Mantid { -void TestChannel::log(const Poco::Message &msg) { _msgList.push_back(msg); } +void TestChannel::log(const Poco::Message &msg) { _msgList.emplace_back(msg); } TestChannel::MsgList &TestChannel::list() { return _msgList; } diff --git a/Framework/Kernel/src/ThreadPool.cpp b/Framework/Kernel/src/ThreadPool.cpp index 400f25afccddf5fd2306aca2c042c3bb8707f628..07362bce691868815a04e5d05e6f090d92cb1700 100644 --- a/Framework/Kernel/src/ThreadPool.cpp +++ b/Framework/Kernel/src/ThreadPool.cpp @@ -111,8 +111,8 @@ void ThreadPool::start(double waitSec) { auto runnable = std::make_unique<ThreadPoolRunnable>(i, m_scheduler.get(), m_prog.get(), waitSec); thread->start(*runnable); - m_threads.push_back(std::move(thread)); - m_runnables.push_back(std::move(runnable)); + m_threads.emplace_back(std::move(thread)); + m_runnables.emplace_back(std::move(runnable)); } // Yep, all the threads are running. m_started = true; diff --git a/Framework/Kernel/src/TimeSeriesProperty.cpp b/Framework/Kernel/src/TimeSeriesProperty.cpp index 3927fe318a145d2e067dc4f6914bd941997f2706..de59d2083d617bbba74344fac15952dbf7a5b463 100644 --- a/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -389,7 +389,7 @@ void TimeSeriesProperty<TYPE>::filterByTimes( if (tstartindex == tstopindex) { TimeValueUnit<TYPE> temp(t_start, m_values[tstartindex].value()); - mp_copy.push_back(temp); + mp_copy.emplace_back(temp); } else { mp_copy.emplace_back(t_start, m_values[tstartindex].value()); for (auto im = size_t(tstartindex + 1); im <= size_t(tstopindex); ++im) { @@ -440,7 +440,7 @@ void TimeSeriesProperty<TYPE>::splitByTime( for (size_t i = 0; i < numOutputs; i++) { auto *myOutput = dynamic_cast<TimeSeriesProperty<TYPE> *>(outputs[i]); if (myOutput) { - outputs_tsp.push_back(myOutput); + outputs_tsp.emplace_back(myOutput); if (this->m_values.size() == 1) { // Special case for TSP with a single entry = just copy. myOutput->m_values = this->m_values; @@ -450,7 +450,7 @@ void TimeSeriesProperty<TYPE>::splitByTime( myOutput->m_size = 0; } } else { - outputs_tsp.push_back(nullptr); + outputs_tsp.emplace_back(nullptr); } } @@ -1124,7 +1124,7 @@ std::vector<TYPE> TimeSeriesProperty<TYPE>::valuesAsVector() const { out.reserve(m_values.size()); for (size_t i = 0; i < m_values.size(); i++) - out.push_back(m_values[i].value()); + out.emplace_back(m_values[i].value()); return out; } @@ -1161,7 +1161,7 @@ std::vector<DateAndTime> TimeSeriesProperty<TYPE>::timesAsVector() const { out.reserve(m_values.size()); for (size_t i = 0; i < m_values.size(); i++) { - out.push_back(m_values[i].time()); + out.emplace_back(m_values[i].time()); } return out; @@ -1182,7 +1182,8 @@ std::vector<double> TimeSeriesProperty<TYPE>::timesAsVectorSeconds() const { Types::Core::DateAndTime start = m_values[0].time(); for (size_t i = 0; i < m_values.size(); i++) { - out.push_back(DateAndTime::secondsFromDuration(m_values[i].time() - start)); + out.emplace_back( + DateAndTime::secondsFromDuration(m_values[i].time() - start)); } return out; @@ -1198,7 +1199,7 @@ void TimeSeriesProperty<TYPE>::addValue(const Types::Core::DateAndTime &time, const TYPE value) { TimeValueUnit<TYPE> newvalue(time, value); // Add the value to the back of the vector - m_values.push_back(newvalue); + m_values.emplace_back(newvalue); // Increment the separate record of the property's size m_size++; @@ -1410,7 +1411,7 @@ std::vector<std::string> TimeSeriesProperty<TYPE>::time_tValue() const { for (size_t i = 0; i < m_values.size(); i++) { std::stringstream line; line << m_values[i].time().toSimpleString() << " " << m_values[i].value(); - values.push_back(line.str()); + values.emplace_back(line.str()); } return values; @@ -1505,7 +1506,7 @@ template <typename TYPE> void TimeSeriesProperty<TYPE>::clearOutdated() { if (realSize() > 1) { auto lastValue = m_values.back(); clear(); - m_values.push_back(lastValue); + m_values.emplace_back(lastValue); m_size = 1; } } @@ -1558,7 +1559,7 @@ void TimeSeriesProperty<TYPE>::create( m_propSortedFlag = TimeSeriesSortStatus::TSSORTED; for (std::size_t i = 0; i < num; i++) { TimeValueUnit<TYPE> newentry(new_times[i], new_values[i]); - m_values.push_back(newentry); + m_values.emplace_back(newentry); if (m_propSortedFlag == TimeSeriesSortStatus::TSSORTED && i > 0 && new_times[i - 1] > new_times[i]) { // Status gets to unsorted diff --git a/Framework/Kernel/src/TimeSplitter.cpp b/Framework/Kernel/src/TimeSplitter.cpp index 53f6248c0ee97ef201c6b28bcd915405b8aa6c4e..c24c3efc5b8ea0e53bc072e09b04a9aba50f721b 100644 --- a/Framework/Kernel/src/TimeSplitter.cpp +++ b/Framework/Kernel/src/TimeSplitter.cpp @@ -162,7 +162,7 @@ TimeSplitterType operator&(const TimeSplitterType &a, // left-hand-side (ait in this case) // meaning that a has to be the splitter because the b index is // ignored. - out.push_back(*ait & *bit); + out.emplace_back(*ait & *bit); } } } @@ -223,10 +223,10 @@ TimeSplitterType operator|(const TimeSplitterType &a, ; for (it = a.begin(); it != a.end(); ++it) if (it->stop() > it->start()) - temp.push_back(*it); + temp.emplace_back(*it); for (it = b.begin(); it != b.end(); ++it) if (it->stop() > it->start()) - temp.push_back(*it); + temp.emplace_back(*it); // Sort by start time std::sort(temp.begin(), temp.end(), compareSplittingInterval); diff --git a/Framework/Kernel/src/UserStringParser.cpp b/Framework/Kernel/src/UserStringParser.cpp index a843dfa9b9895ee5137875c769c32f29c52ed24e..6dae4e0a860a22cd039777af9ed1ec7ebf25edb9 100644 --- a/Framework/Kernel/src/UserStringParser.cpp +++ b/Framework/Kernel/src/UserStringParser.cpp @@ -52,16 +52,16 @@ void UserStringParser::parse(const std::string &userString, std::string separators("-+:"); // if input contains no separator string if (userString.find_first_of(separators) == std::string::npos) { - numbers.push_back(std::vector<unsigned int>(1, toUInt(userString))); + numbers.emplace_back(std::vector<unsigned int>(1, toUInt(userString))); } else if (Contains(userString, '-')) { std::vector<unsigned int> value = separateDelimiters(userString, "-:"); if (!value.empty()) { - numbers.push_back(value); + numbers.emplace_back(value); } } else if (Contains(userString, '+')) { std::vector<unsigned int> value = separateDelimiters(userString, "+"); if (!value.empty()) { - numbers.push_back(value); + numbers.emplace_back(value); } } else if (Contains(userString, ':')) { std::vector<std::vector<unsigned int>> colonseparated = @@ -69,7 +69,7 @@ void UserStringParser::parse(const std::string &userString, std::vector<std::vector<unsigned int>>::const_iterator citr1; for (citr1 = colonseparated.begin(); citr1 != colonseparated.end(); ++citr1) { - numbers.push_back((*citr1)); + numbers.emplace_back((*citr1)); } } } @@ -107,7 +107,7 @@ UserStringParser::separateColon(const std::string &input) { std::vector<std::vector<unsigned int>> separatedValues; Tokenize(input, ":", startNum, endNum, step); for (unsigned int num = startNum; num <= endNum; num += step) { - separatedValues.push_back(std::vector<unsigned int>(1, num)); + separatedValues.emplace_back(std::vector<unsigned int>(1, num)); } return separatedValues; @@ -129,7 +129,7 @@ UserStringParser::separateDelimiters(const std::string &input, Tokenize(input, delimiters, startNum, endNum, step); for (unsigned int num = startNum; num <= endNum; num += step) { - separatedValues.push_back(num); + separatedValues.emplace_back(num); } return separatedValues; } diff --git a/Framework/Kernel/src/VectorHelper.cpp b/Framework/Kernel/src/VectorHelper.cpp index 99da5d66a7b72889d4a6081e02d50f6a95140058..ae53d4dfdd1a86bf46e2a5da46262bf063888388 100644 --- a/Framework/Kernel/src/VectorHelper.cpp +++ b/Framework/Kernel/src/VectorHelper.cpp @@ -73,7 +73,7 @@ int DLLExport createAxisFromRebinParams(const std::vector<double> ¶ms, xnew.clear(); if (resize_xnew) - xnew.push_back(xcurr); + xnew.emplace_back(xcurr); while ((ibound <= ibounds) && (istep <= isteps)) { // if step is negative then it is logarithmic step @@ -111,7 +111,7 @@ int DLLExport createAxisFromRebinParams(const std::vector<double> ¶ms, istep += 2; } if (resize_xnew) - xnew.push_back(xcurr); + xnew.emplace_back(xcurr); inew++; } @@ -553,7 +553,7 @@ std::vector<NumT> splitStringIntoVector(std::string listString) { std::stringstream oneNumber(str); NumT num; oneNumber >> num; - values.push_back(num); + values.emplace_back(num); } } return values; diff --git a/Framework/Kernel/test/ArrayLengthValidatorTest.h b/Framework/Kernel/test/ArrayLengthValidatorTest.h index 629419b3c8ffdf751dad8522605a845ed846335c..b99c3915a64935c774d315ded5abecb4d18fbc76 100644 --- a/Framework/Kernel/test/ArrayLengthValidatorTest.h +++ b/Framework/Kernel/test/ArrayLengthValidatorTest.h @@ -88,23 +88,23 @@ public: void testValidator() { ArrayLengthValidator<int> vi(3); std::vector<int> a; - a.push_back(3); + a.emplace_back(3); TS_ASSERT_DIFFERS(vi.isValid(a).length(), 0); - a.push_back(-1); - a.push_back(11); + a.emplace_back(-1); + a.emplace_back(11); TS_ASSERT_EQUALS(vi.isValid(a).length(), 0); } void testValidatorRange() { ArrayLengthValidator<int> vi(2, 3); std::vector<int> a; - a.push_back(3); + a.emplace_back(3); TS_ASSERT_DIFFERS(vi.isValid(a).length(), 0); - a.push_back(11); + a.emplace_back(11); TS_ASSERT_EQUALS(vi.isValid(a).length(), 0); - a.push_back(12); + a.emplace_back(12); TS_ASSERT_EQUALS(vi.isValid(a).length(), 0); - a.push_back(21); + a.emplace_back(21); TS_ASSERT_DIFFERS(vi.isValid(a).length(), 0); } }; diff --git a/Framework/Kernel/test/AtomTest.h b/Framework/Kernel/test/AtomTest.h index 411c19918ed94560a7a4a5e00a7bfdd98d28919b..9ed7b9cfb459e7faec95923f8a7cfd9da2d13465 100644 --- a/Framework/Kernel/test/AtomTest.h +++ b/Framework/Kernel/test/AtomTest.h @@ -67,10 +67,10 @@ public: boost::random::mt19937 gen; boost::random::uniform_int_distribution<uint16_t> dist(1, 96); for (size_t i = 0; i < test_size; ++i) { - z_input.push_back(dist(gen)); + z_input.emplace_back(dist(gen)); } for (auto z : z_input) { - symbol_input.push_back(getAtom(z).symbol); + symbol_input.emplace_back(getAtom(z).symbol); } } diff --git a/Framework/Kernel/test/ConfigServiceTest.h b/Framework/Kernel/test/ConfigServiceTest.h index 003c46cc3022969c7e16c5345bc2b60b4f4d95ea..cd1d15b008858095b16cf6171295a6531df96ce7 100644 --- a/Framework/Kernel/test/ConfigServiceTest.h +++ b/Framework/Kernel/test/ConfigServiceTest.h @@ -297,8 +297,8 @@ public: auto originalDirectories = ConfigService::Instance().getInstrumentDirectories(); std::vector<std::string> testDirectories; - testDirectories.push_back("Test Directory 1"); - testDirectories.push_back("Test Directory 2"); + testDirectories.emplace_back("Test Directory 1"); + testDirectories.emplace_back("Test Directory 2"); ConfigService::Instance().setInstrumentDirectories(testDirectories); auto readDirectories = ConfigService::Instance().getInstrumentDirectories(); TS_ASSERT_EQUALS(readDirectories.size(), testDirectories.size()); diff --git a/Framework/Kernel/test/DataServiceTest.h b/Framework/Kernel/test/DataServiceTest.h index 8324c564a7b1086489396c6b59ca01a67358bcab..2e845c84bb2d8e7d88ed43e53abe125660622bd8 100644 --- a/Framework/Kernel/test/DataServiceTest.h +++ b/Framework/Kernel/test/DataServiceTest.h @@ -49,7 +49,7 @@ public: void handleAddNotification( const Poco::AutoPtr<FakeDataService::AddNotification> &) { std::lock_guard<std::mutex> _lock(m_vectorMutex); - vector.push_back(123); + vector.emplace_back(123); ++notificationFlag; } diff --git a/Framework/Kernel/test/DateAndTimeHelpersTest.h b/Framework/Kernel/test/DateAndTimeHelpersTest.h index be3174145571d1e459ee2407e683c9d0cea8bd45..06b3ef8022cad25e7b16f4c6e3bb1e0412808282 100644 --- a/Framework/Kernel/test/DateAndTimeHelpersTest.h +++ b/Framework/Kernel/test/DateAndTimeHelpersTest.h @@ -45,13 +45,13 @@ public: std::vector<DateAndTime> times; TS_ASSERT_THROWS(averageSorted(times), const std::invalid_argument &); - times.push_back( + times.emplace_back( createFromSanitizedISO8601("1977-05-25T00:00Z")); // Star Wars IV - times.push_back( + times.emplace_back( createFromSanitizedISO8601("1977-09-11T00:00Z")); // ATARI 2600 - times.push_back( + times.emplace_back( createFromSanitizedISO8601("1980-05-17T00:00Z")); // Star Wars V - times.push_back( + times.emplace_back( createFromSanitizedISO8601("1983-05-25T00:00Z")); // Star Wars VI TS_ASSERT_EQUALS(averageSorted(times), createFromSanitizedISO8601("1979-09-19T00:00Z")); diff --git a/Framework/Kernel/test/DiskBufferISaveableTest.h b/Framework/Kernel/test/DiskBufferISaveableTest.h index 08692eb062ab40494b3e2087a388a213a61960b7..2cd67d4833eeef77d794db5a70a64f71c5fb6322 100644 --- a/Framework/Kernel/test/DiskBufferISaveableTest.h +++ b/Framework/Kernel/test/DiskBufferISaveableTest.h @@ -87,12 +87,12 @@ public: num = 10; data.clear(); for (size_t i = 0; i < num; i++) - data.push_back(std::make_unique<ISaveableTester>(i)); + data.emplace_back(std::make_unique<ISaveableTester>(i)); BIG_NUM = 1000; bigData.clear(); bigData.reserve(BIG_NUM); for (long i = 0; i < BIG_NUM; i++) - bigData.push_back(std::make_unique<ISaveableTester>(i)); + bigData.emplace_back(std::make_unique<ISaveableTester>(i)); } void tearDown() override { @@ -428,7 +428,7 @@ public: num = 100000; data.clear(); for (size_t i = 0; i < num; i++) { - data.push_back(new ISaveableTester(i)); + data.emplace_back(new ISaveableTester(i)); data[i]->setBusy(true); // Items won't do any real saving } } diff --git a/Framework/Kernel/test/DiskBufferTest.h b/Framework/Kernel/test/DiskBufferTest.h index 10a6d30ef31ad537f1f72b8b6590f789631ea9b4..5bce2b1c0ac53e498cb6fba36160aeaef07bb1b4 100644 --- a/Framework/Kernel/test/DiskBufferTest.h +++ b/Framework/Kernel/test/DiskBufferTest.h @@ -116,7 +116,7 @@ public: SaveableTesterWithFile::fakeFile = ""; data.clear(); for (size_t i = 0; i < num; i++) - data.push_back( + data.emplace_back( new SaveableTesterWithFile(uint64_t(2 * i), 2, char(i + 0x41))); } @@ -261,7 +261,8 @@ public: std::vector<ISaveable *> bigData; bigData.reserve(bigNum); for (size_t i = 0; i < bigNum; i++) - bigData.push_back(new SaveableTesterWithFile(2 * i, 2, char(i + 0x41))); + bigData.emplace_back( + new SaveableTesterWithFile(2 * i, 2, char(i + 0x41))); PARALLEL_FOR_NO_WSP_CHECK() for (int i = 0; i < int(bigNum); i++) { @@ -788,7 +789,7 @@ public: dataSeek.clear(); dataSeek.reserve(200); for (size_t i = 0; i < 200; i++) - dataSeek.push_back(new SaveableTesterWithSeek(i)); + dataSeek.emplace_back(new SaveableTesterWithSeek(i)); } void setUp() override { SaveableTesterWithSeek::fakeFile = ""; } diff --git a/Framework/Kernel/test/EqualBinsCheckerTest.h b/Framework/Kernel/test/EqualBinsCheckerTest.h index c9123942609a4b50a002de0f680e5ec8c4a815d4..84bc84073c57744eff09e704ae9aff2c361808ad 100644 --- a/Framework/Kernel/test/EqualBinsCheckerTest.h +++ b/Framework/Kernel/test/EqualBinsCheckerTest.h @@ -96,7 +96,7 @@ private: if (i == length - 1) { val += error; } - data.push_back(val); + data.emplace_back(val); } return data; } diff --git a/Framework/Kernel/test/FreeBlockTest.h b/Framework/Kernel/test/FreeBlockTest.h index d654a4e8ced4ad73c9e2bfd91c92d12c1f7b8033..c8253259eb38682dc18929db65c8142ebc75dba1 100644 --- a/Framework/Kernel/test/FreeBlockTest.h +++ b/Framework/Kernel/test/FreeBlockTest.h @@ -65,7 +65,7 @@ public: num = 1000000; // Make a list where 1/3 of the blocks are adjacent for (size_t i = 0; i < num; i++) - blocks.push_back(FreeBlock(i * 10, (i % 3 == 0) ? 10 : 7)); + blocks.emplace_back(FreeBlock(i * 10, (i % 3 == 0) ? 10 : 7)); } void test_merge() { diff --git a/Framework/Kernel/test/InterpolationTest.h b/Framework/Kernel/test/InterpolationTest.h index ac1a6a0419c18381c14cae688c084ba1e6b793be..490c358fab5509a2869638411e413045dfcdcc8c 100644 --- a/Framework/Kernel/test/InterpolationTest.h +++ b/Framework/Kernel/test/InterpolationTest.h @@ -32,33 +32,33 @@ public: */ InterpolationTest() { // values for setting up the interpolation - m_tableXValues.push_back(200.0); - m_tableXValues.push_back(201.0); - m_tableXValues.push_back(202.0); - m_tableXValues.push_back(203.0); - m_tableXValues.push_back(204.0); - - m_tableYValues.push_back(50); - m_tableYValues.push_back(60); - m_tableYValues.push_back(100); - m_tableYValues.push_back(300); - m_tableYValues.push_back(400); + m_tableXValues.emplace_back(200.0); + m_tableXValues.emplace_back(201.0); + m_tableXValues.emplace_back(202.0); + m_tableXValues.emplace_back(203.0); + m_tableXValues.emplace_back(204.0); + + m_tableYValues.emplace_back(50); + m_tableYValues.emplace_back(60); + m_tableYValues.emplace_back(100); + m_tableYValues.emplace_back(300); + m_tableYValues.emplace_back(400); // bulk values for interpolation test - m_interpolationXValues.push_back(200.5); - m_interpolationXValues.push_back(201.25); - m_interpolationXValues.push_back(203.5); + m_interpolationXValues.emplace_back(200.5); + m_interpolationXValues.emplace_back(201.25); + m_interpolationXValues.emplace_back(203.5); - m_expectedYValues.push_back(55.0); - m_expectedYValues.push_back(70.0); - m_expectedYValues.push_back(350.0); + m_expectedYValues.emplace_back(55.0); + m_expectedYValues.emplace_back(70.0); + m_expectedYValues.emplace_back(350.0); // values outside interpolation range - m_outsideXValues.push_back(100.0); - m_outsideXValues.push_back(3000.0); + m_outsideXValues.emplace_back(100.0); + m_outsideXValues.emplace_back(3000.0); - m_outsideYValues.push_back(-950.0); - m_outsideYValues.push_back(280000.0); + m_outsideYValues.emplace_back(-950.0); + m_outsideYValues.emplace_back(280000.0); } void testCopyConstruction() { diff --git a/Framework/Kernel/test/MDAxisValidatorTest.h b/Framework/Kernel/test/MDAxisValidatorTest.h index 71598c2e19f707c02fe083098d86a57c3e820448..e2f9ae2905c15c96f1cdcf849a4ca62d8ed7811a 100644 --- a/Framework/Kernel/test/MDAxisValidatorTest.h +++ b/Framework/Kernel/test/MDAxisValidatorTest.h @@ -73,9 +73,9 @@ public: int nAxes = 3; std::vector<int> axes; for (int i = 0; i < nAxes - 1; i++) { - axes.push_back(i); + axes.emplace_back(i); } - axes.push_back(99); // a dimension out of the real dimension range + axes.emplace_back(99); // a dimension out of the real dimension range MDAxisValidator checker(axes, nAxes, true); auto errors = checker.validate(); TS_ASSERT_EQUALS(errors.size(), 1); @@ -95,7 +95,7 @@ private: bool checkIfEmpty) const { std::vector<int> axes; for (int i = 0; i < nAxes; i++) { - axes.push_back(i); + axes.emplace_back(i); } auto checker = boost::make_shared<MDAxisValidator>(axes, nDimensions, checkIfEmpty); diff --git a/Framework/Kernel/test/MandatoryValidatorTest.h b/Framework/Kernel/test/MandatoryValidatorTest.h index 3d1dfaa06a218d85a98a9ea5d4063fde4834d551..1b19d4472d0456d40bcc0d0d2552af76dceada13 100644 --- a/Framework/Kernel/test/MandatoryValidatorTest.h +++ b/Framework/Kernel/test/MandatoryValidatorTest.h @@ -65,7 +65,7 @@ public: TS_ASSERT(ivec.empty()) TS_ASSERT_EQUALS(i.isValid(ivec), "A value must be entered for this parameter") - ivec.push_back(1); + ivec.emplace_back(1); TS_ASSERT_EQUALS(i.isValid(ivec), "") MandatoryValidator<std::vector<double>> d; @@ -73,7 +73,7 @@ public: TS_ASSERT(dvec.empty()) TS_ASSERT_EQUALS(d.isValid(dvec), "A value must be entered for this parameter") - dvec.push_back(1.1); + dvec.emplace_back(1.1); TS_ASSERT_EQUALS(d.isValid(dvec), "") MandatoryValidator<std::vector<std::string>> s; diff --git a/Framework/Kernel/test/MultiFileValidatorTest.h b/Framework/Kernel/test/MultiFileValidatorTest.h index a2e4b4609d25e246cb021462101aed2b0c1143f5..74f536bc04460e4d5b478fb9ea983dc47dba6084 100644 --- a/Framework/Kernel/test/MultiFileValidatorTest.h +++ b/Framework/Kernel/test/MultiFileValidatorTest.h @@ -20,7 +20,7 @@ namespace { void addSingleFile(std::vector<std::vector<std::string>> &fileNames, const std::string &fileNameToAdd) { const std::vector<std::string> fileNameList(1, fileNameToAdd); - fileNames.push_back(fileNameList); + fileNames.emplace_back(fileNameList); } } // namespace diff --git a/Framework/Kernel/test/PropertyWithValueTest.h b/Framework/Kernel/test/PropertyWithValueTest.h index 92dfeddf0ba89cbd29f689ed7c50d4f72030e4da..17c463b17c040522a7c6fa836d215237a05ad229 100644 --- a/Framework/Kernel/test/PropertyWithValueTest.h +++ b/Framework/Kernel/test/PropertyWithValueTest.h @@ -98,9 +98,9 @@ public: void testSizeOfVectorProperty() { // Test vector value property. std::vector<int> v; - v.push_back(1); - v.push_back(2); - v.push_back(3); + v.emplace_back(1); + v.emplace_back(2); + v.emplace_back(3); PropertyWithValue<std::vector<int>> *pv = new PropertyWithValue<std::vector<int>>("some_array", v); TS_ASSERT_EQUALS(int(v.size()), pv->size()); @@ -117,9 +117,9 @@ public: using VecVecInt = std::vector<VecInt>; // Test vector value property. VecVecInt v; - v.push_back(VecInt(1, 0)); - v.push_back(VecInt(2, 0)); - v.push_back(VecInt(1, 0)); + v.emplace_back(VecInt(1, 0)); + v.emplace_back(VecInt(2, 0)); + v.emplace_back(VecInt(1, 0)); PropertyWithValue<VecVecInt> *pv = new PropertyWithValue<VecVecInt>("some_vec_vec_int", v); TSM_ASSERT_EQUALS( @@ -364,9 +364,9 @@ public: void testPlusEqualOperator() { std::vector<int> v; - v.push_back(1); - v.push_back(2); - v.push_back(3); + v.emplace_back(1); + v.emplace_back(2); + v.emplace_back(3); PropertyWithValue<std::vector<int>> *pv = new PropertyWithValue<std::vector<int>>("some_array", v); PropertyWithValue<std::vector<int>> *pv2 = @@ -379,9 +379,9 @@ public: void testPlusEqualOperatorOnYourself() { std::vector<int> v; - v.push_back(1); - v.push_back(2); - v.push_back(3); + v.emplace_back(1); + v.emplace_back(2); + v.emplace_back(3); PropertyWithValue<std::vector<int>> *pv = new PropertyWithValue<std::vector<int>>("some_array", v); (*pv) += pv; diff --git a/Framework/Kernel/test/SimpleJSONTest.h b/Framework/Kernel/test/SimpleJSONTest.h index 5596d1ee0a06391d3accaec4ce8aff981fee0f56..9140e5a40b9d02797095713f6207932902fdb1b3 100644 --- a/Framework/Kernel/test/SimpleJSONTest.h +++ b/Framework/Kernel/test/SimpleJSONTest.h @@ -56,8 +56,8 @@ public: std::string res; JSONArray ja; - TS_ASSERT_THROWS_NOTHING(ja.push_back(str)); - TS_ASSERT_THROWS_NOTHING(ja.push_back(str)); + TS_ASSERT_THROWS_NOTHING(ja.emplace_back(str)); + TS_ASSERT_THROWS_NOTHING(ja.emplace_back(str)); JSONValue jv(ja); JSONValue vBool(true); diff --git a/Framework/Kernel/test/StatisticsTest.h b/Framework/Kernel/test/StatisticsTest.h index aa1b6593572078b09f7cea473c2a0521856f2659..d9dd3933ae7f4c7123938fcf11bb4545c92059e8 100644 --- a/Framework/Kernel/test/StatisticsTest.h +++ b/Framework/Kernel/test/StatisticsTest.h @@ -22,11 +22,11 @@ class StatisticsTest : public CxxTest::TestSuite { public: void test_Doubles_And_Default_Flags_Calculates_All_Stats() { vector<double> data; - data.push_back(17.2); - data.push_back(18.1); - data.push_back(16.5); - data.push_back(18.3); - data.push_back(12.6); + data.emplace_back(17.2); + data.emplace_back(18.1); + data.emplace_back(16.5); + data.emplace_back(18.3); + data.emplace_back(12.6); Statistics stats = getStatistics(data); @@ -39,11 +39,11 @@ public: void test_Doubles_With_Sorted_Data() { vector<double> data; - data.push_back(17.2); - data.push_back(18.1); - data.push_back(16.5); - data.push_back(18.3); - data.push_back(12.6); + data.emplace_back(17.2); + data.emplace_back(18.1); + data.emplace_back(16.5); + data.emplace_back(18.3); + data.emplace_back(12.6); sort(data.begin(), data.end()); Statistics stats = @@ -59,11 +59,11 @@ public: void test_Unsorted_Data_With_Sorted_Flag_Gives_Expected_Incorrect_Result_For_Median() { vector<double> data; - data.push_back(17.2); - data.push_back(18.1); - data.push_back(16.5); - data.push_back(18.3); - data.push_back(12.6); + data.emplace_back(17.2); + data.emplace_back(18.1); + data.emplace_back(16.5); + data.emplace_back(18.3); + data.emplace_back(12.6); Statistics stats = getStatistics(data, (StatOptions::Median | StatOptions::SortedData)); @@ -77,11 +77,11 @@ public: void test_Doubles_With_Corrected_StdDev_Calculates_Mean() { vector<double> data; - data.push_back(17.2); - data.push_back(18.1); - data.push_back(16.5); - data.push_back(18.3); - data.push_back(12.6); + data.emplace_back(17.2); + data.emplace_back(18.1); + data.emplace_back(16.5); + data.emplace_back(18.3); + data.emplace_back(12.6); sort(data.begin(), data.end()); Statistics stats = getStatistics(data, StatOptions::CorrectedStdDev); @@ -95,11 +95,11 @@ public: void test_Types_Can_Be_Disabled_With_Flags() { vector<double> data; - data.push_back(17.2); - data.push_back(18.1); - data.push_back(16.5); - data.push_back(18.3); - data.push_back(12.6); + data.emplace_back(17.2); + data.emplace_back(18.1); + data.emplace_back(16.5); + data.emplace_back(18.3); + data.emplace_back(12.6); Statistics justMean = getStatistics(data, StatOptions::Mean); TS_ASSERT_EQUALS(justMean.mean, 16.54); @@ -111,26 +111,26 @@ public: void testZscores() { vector<double> data; - data.push_back(12); - data.push_back(13); - data.push_back(9); - data.push_back(18); - data.push_back(7); - data.push_back(9); - data.push_back(14); - data.push_back(16); - data.push_back(10); - data.push_back(12); - data.push_back(7); - data.push_back(13); - data.push_back(14); - data.push_back(19); - data.push_back(10); - data.push_back(16); - data.push_back(12); - data.push_back(16); - data.push_back(19); - data.push_back(11); + data.emplace_back(12); + data.emplace_back(13); + data.emplace_back(9); + data.emplace_back(18); + data.emplace_back(7); + data.emplace_back(9); + data.emplace_back(14); + data.emplace_back(16); + data.emplace_back(10); + data.emplace_back(12); + data.emplace_back(7); + data.emplace_back(13); + data.emplace_back(14); + data.emplace_back(19); + data.emplace_back(10); + data.emplace_back(16); + data.emplace_back(12); + data.emplace_back(16); + data.emplace_back(19); + data.emplace_back(11); std::vector<double> Zscore = getZscore(data); TS_ASSERT_DELTA(Zscore[4], 1.6397, 0.0001); @@ -142,7 +142,7 @@ public: void testDoubleSingle() { vector<double> data; - data.push_back(42.); + data.emplace_back(42.); Statistics stats = getStatistics(data); @@ -155,12 +155,12 @@ public: void testInt32Even() { vector<int32_t> data; - data.push_back(1); - data.push_back(2); - data.push_back(3); - data.push_back(4); - data.push_back(5); - data.push_back(6); + data.emplace_back(1); + data.emplace_back(2); + data.emplace_back(3); + data.emplace_back(4); + data.emplace_back(5); + data.emplace_back(6); Statistics stats = getStatistics(data); @@ -249,7 +249,7 @@ public: // x-values to try out vector<double> x; for (size_t i = 0; i < numX; ++i) - x.push_back(static_cast<double>(i) * deltaX + offsetX); + x.emplace_back(static_cast<double>(i) * deltaX + offsetX); // just declare so we can have test of exception handling vector<double> y; @@ -259,7 +259,7 @@ public: // now calculate the y-values for (size_t i = 0; i < numX; ++i) { double temp = (x[i] - mean) / sigma; - y.push_back(exp(-.5 * temp * temp) / (sigma * sqrt(2. * M_PI))); + y.emplace_back(exp(-.5 * temp * temp) / (sigma * sqrt(2. * M_PI))); } // Normal distribution values are taken from the wikipedia page @@ -290,7 +290,7 @@ public: templeft = exp(-.5 * templeft * templeft) / (sigma * sqrt(2. * M_PI)); double tempright = (x[i + 1] - mean) / sigma; tempright = exp(-.5 * tempright * tempright) / (sigma * sqrt(2. * M_PI)); - y.push_back(.5 * deltaX * (templeft + tempright)); + y.emplace_back(.5 * deltaX * (templeft + tempright)); // std::cout << i << ":\t" << x[i] << "\t" << y[i] << '\n'; } diff --git a/Framework/Kernel/test/StringsTest.h b/Framework/Kernel/test/StringsTest.h index d0bb36184f883fd26e16835670f12bb31f0fb056..ca17598e2559e91c862efcdf02cba01c12e3b1a3 100644 --- a/Framework/Kernel/test/StringsTest.h +++ b/Framework/Kernel/test/StringsTest.h @@ -416,7 +416,7 @@ public: std::vector<int> expected; expected.reserve(12); for (int i = 1; i <= 12; i++) - expected.push_back(i); + expected.emplace_back(i); TS_ASSERT_EQUALS(result, expected); } @@ -445,8 +445,8 @@ public: std::vector<int> expected; expected.reserve(8); for (int i = 52; i <= 58; i++) - expected.push_back(i); - expected.push_back(192); + expected.emplace_back(i); + expected.emplace_back(192); TS_ASSERT_EQUALS(result, expected); } @@ -459,7 +459,7 @@ public: std::vector<int> expected; expected.reserve(10); for (int i = 1; i <= 10; i++) - expected.push_back(i); + expected.emplace_back(i); TS_ASSERT_EQUALS(result, expected); } @@ -472,7 +472,7 @@ public: std::vector<int> expected; expected.reserve(10); for (int i = 1; i <= 10; i++) - expected.push_back(i); + expected.emplace_back(i); TS_ASSERT_EQUALS(result, expected); } diff --git a/Framework/Kernel/test/ThreadPoolTest.h b/Framework/Kernel/test/ThreadPoolTest.h index 5fd5f315b62dff4270393c48e88598902cd55ad8..7975ddfbad3baccb7342b9fbf667ac4272146bfe 100644 --- a/Framework/Kernel/test/ThreadPoolTest.h +++ b/Framework/Kernel/test/ThreadPoolTest.h @@ -76,7 +76,7 @@ void threadpooltest_function() { threadpooltest_check = 12; } std::vector<int> threadpooltest_vec; void threadpooltest_adding_stuff(int val) { // TODO: Mutex - threadpooltest_vec.push_back(val); + threadpooltest_vec.emplace_back(val); } // Counter for the test. diff --git a/Framework/Kernel/test/TimeSeriesPropertyTest.h b/Framework/Kernel/test/TimeSeriesPropertyTest.h index 858da8f4a98c4d37c7d162267d6b7022ca5a7ed9..645cebfc01015ae45553983da1a55a99a8cb1813 100644 --- a/Framework/Kernel/test/TimeSeriesPropertyTest.h +++ b/Framework/Kernel/test/TimeSeriesPropertyTest.h @@ -265,9 +265,9 @@ public: std::vector<double> replacementValues; double offset = 100.0; for (size_t i = 0; i < num; i++) { - times.push_back(first + double(i)); - values.push_back(double(i)); - replacementValues.push_back(double(i) + offset); + times.emplace_back(first + double(i)); + values.emplace_back(double(i)); + replacementValues.emplace_back(double(i) + offset); } TimeSeriesProperty<double> tsp("test"); tsp.addValues(times, values); @@ -290,8 +290,8 @@ public: std::vector<double> values; for (size_t i = 0; i < num; i++) { - times.push_back(first + double(i)); - values.push_back(double(i)); + times.emplace_back(first + double(i)); + values.emplace_back(double(i)); } TimeSeriesProperty<double> tsp("test"); tsp.addValues(times, values); @@ -410,7 +410,7 @@ public: 0); Mantid::Kernel::TimeSplitterType splitters; - splitters.push_back(interval0); + splitters.emplace_back(interval0); // Since the filter is < stop, the last one is not counted, so there are 3 // taken out. @@ -435,8 +435,8 @@ public: 0); Mantid::Kernel::TimeSplitterType splitters; - splitters.push_back(interval0); - splitters.push_back(interval1); + splitters.emplace_back(interval0); + splitters.emplace_back(interval1); // Since the filter is < stop, the last one is not counted, so there are 3 // taken out. @@ -633,8 +633,8 @@ public: // Test a filter that's fully within the range of both properties TimeSplitterType filter; - filter.push_back(SplittingInterval(DateAndTime("2007-11-30T16:17:05"), - DateAndTime("2007-11-30T16:17:29"))); + filter.emplace_back(SplittingInterval(DateAndTime("2007-11-30T16:17:05"), + DateAndTime("2007-11-30T16:17:29"))); TS_ASSERT_DELTA(dblLog->averageValueInFilter(filter), 7.308, 0.001); TS_ASSERT_DELTA(intLog->averageValueInFilter(filter), 2.167, 0.001); @@ -655,8 +655,8 @@ public: // the log filter[0] = SplittingInterval(DateAndTime("2007-11-30T16:17:05"), DateAndTime("2007-11-30T16:17:15")); - filter.push_back(SplittingInterval(DateAndTime("2007-11-30T16:17:25"), - DateAndTime("2007-11-30T16:17:45"))); + filter.emplace_back(SplittingInterval(DateAndTime("2007-11-30T16:17:25"), + DateAndTime("2007-11-30T16:17:45"))); TS_ASSERT_DELTA(dblLog->averageValueInFilter(filter), 9.123, 0.001); TS_ASSERT_DELTA(intLog->averageValueInFilter(filter), 3.167, 0.001); @@ -717,7 +717,7 @@ public: std::vector<Property *> outputs; for (std::size_t i = 0; i < 5; i++) { TimeSeriesProperty<int> *newlog = new TimeSeriesProperty<int>("MyIntLog"); - outputs.push_back(newlog); + outputs.emplace_back(newlog); } // Make a splitter @@ -725,23 +725,23 @@ public: TimeSplitterType splitter; start = DateAndTime("2007-11-30T16:17:10"); stop = DateAndTime("2007-11-30T16:17:40"); - splitter.push_back(SplittingInterval(start, stop, 0)); + splitter.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:55"); stop = DateAndTime("2007-11-30T16:17:56"); - splitter.push_back(SplittingInterval(start, stop, 1)); + splitter.emplace_back(SplittingInterval(start, stop, 1)); start = DateAndTime("2007-11-30T16:17:56"); stop = DateAndTime("2007-11-30T16:18:01"); - splitter.push_back(SplittingInterval(start, stop, 2)); // just one entry + splitter.emplace_back(SplittingInterval(start, stop, 2)); // just one entry start = DateAndTime("2007-11-30T16:18:09"); stop = DateAndTime("2007-11-30T16:18:21"); - splitter.push_back(SplittingInterval(start, stop, 3)); + splitter.emplace_back(SplittingInterval(start, stop, 3)); start = DateAndTime("2007-11-30T16:18:45"); stop = DateAndTime("2007-11-30T16:22:50"); - splitter.push_back(SplittingInterval(start, stop, 4)); + splitter.emplace_back(SplittingInterval(start, stop, 4)); log->splitByTime(splitter, outputs, false); @@ -772,7 +772,7 @@ public: std::vector<Property *> outputs; for (std::size_t i = 0; i < 1; i++) { TimeSeriesProperty<int> *newlog = new TimeSeriesProperty<int>("MyIntLog"); - outputs.push_back(newlog); + outputs.emplace_back(newlog); } // Make a splitter @@ -780,11 +780,11 @@ public: TimeSplitterType splitter; start = DateAndTime("2007-11-30T16:17:10"); stop = DateAndTime("2007-11-30T16:17:40"); - splitter.push_back(SplittingInterval(start, stop, 0)); + splitter.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:35"); stop = DateAndTime("2007-11-30T16:17:59"); - splitter.push_back(SplittingInterval(start, stop, 0)); + splitter.emplace_back(SplittingInterval(start, stop, 0)); log->splitByTime(splitter, outputs, false); @@ -806,21 +806,21 @@ public: void test_splitByTimeVector() { // create the splitters std::vector<DateAndTime> split_time_vec; - split_time_vec.push_back(DateAndTime("2007-11-30T16:17:10")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:17:40")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:17:55")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:17:56")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:18:09")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:18:45")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:22:50")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:17:10")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:17:40")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:17:55")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:17:56")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:18:09")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:18:45")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:22:50")); std::vector<int> split_target_vec; - split_target_vec.push_back(1); - split_target_vec.push_back(0); - split_target_vec.push_back(2); - split_target_vec.push_back(0); - split_target_vec.push_back(1); - split_target_vec.push_back(3); + split_target_vec.emplace_back(1); + split_target_vec.emplace_back(0); + split_target_vec.emplace_back(2); + split_target_vec.emplace_back(0); + split_target_vec.emplace_back(1); + split_target_vec.emplace_back(3); TimeSeriesProperty<int> log("test log"); log.addValue(DateAndTime("2007-11-30T16:17:00"), 1); @@ -837,7 +837,7 @@ public: std::vector<TimeSeriesProperty<int> *> outputs; for (int itarget = 0; itarget < 4; ++itarget) { TimeSeriesProperty<int> *tsp = new TimeSeriesProperty<int>("target"); - outputs.push_back(tsp); + outputs.emplace_back(tsp); } log.splitByTimeVector(split_time_vec, split_target_vec, outputs); @@ -882,21 +882,21 @@ public: void test_splitByTimeVectorEarlySplitter() { // create the splitters std::vector<DateAndTime> split_time_vec; - split_time_vec.push_back(DateAndTime("2007-11-30T16:00:10")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:00:40")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:07:55")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:07:56")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:08:09")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:08:45")); - split_time_vec.push_back(DateAndTime("2007-11-30T16:12:50")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:00:10")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:00:40")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:07:55")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:07:56")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:08:09")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:08:45")); + split_time_vec.emplace_back(DateAndTime("2007-11-30T16:12:50")); std::vector<int> split_target_vec; - split_target_vec.push_back(1); - split_target_vec.push_back(0); - split_target_vec.push_back(2); - split_target_vec.push_back(0); - split_target_vec.push_back(1); - split_target_vec.push_back(3); + split_target_vec.emplace_back(1); + split_target_vec.emplace_back(0); + split_target_vec.emplace_back(2); + split_target_vec.emplace_back(0); + split_target_vec.emplace_back(1); + split_target_vec.emplace_back(3); TimeSeriesProperty<int> log("test log"); log.addValue(DateAndTime("2007-11-30T16:17:00"), 1); @@ -913,7 +913,7 @@ public: // Initialze the 4 splitters std::vector<TimeSeriesProperty<int> *> outputs; for (int itarget = 0; itarget < 4; ++itarget) { - outputs.push_back(new TimeSeriesProperty<int>("target")); + outputs.emplace_back(new TimeSeriesProperty<int>("target")); } log.splitByTimeVector(split_time_vec, split_target_vec, outputs); @@ -936,21 +936,21 @@ public: void test_splitByTimeVectorLaterSplitter() { // create the splitters std::vector<DateAndTime> split_time_vec; - split_time_vec.push_back(DateAndTime("2007-12-30T16:00:10")); - split_time_vec.push_back(DateAndTime("2007-12-30T16:00:40")); - split_time_vec.push_back(DateAndTime("2007-12-30T16:07:55")); - split_time_vec.push_back(DateAndTime("2007-12-30T16:07:56")); - split_time_vec.push_back(DateAndTime("2007-12-30T16:08:09")); - split_time_vec.push_back(DateAndTime("2007-12-30T16:08:45")); - split_time_vec.push_back(DateAndTime("2007-12-30T16:12:50")); + split_time_vec.emplace_back(DateAndTime("2007-12-30T16:00:10")); + split_time_vec.emplace_back(DateAndTime("2007-12-30T16:00:40")); + split_time_vec.emplace_back(DateAndTime("2007-12-30T16:07:55")); + split_time_vec.emplace_back(DateAndTime("2007-12-30T16:07:56")); + split_time_vec.emplace_back(DateAndTime("2007-12-30T16:08:09")); + split_time_vec.emplace_back(DateAndTime("2007-12-30T16:08:45")); + split_time_vec.emplace_back(DateAndTime("2007-12-30T16:12:50")); std::vector<int> split_target_vec; - split_target_vec.push_back(1); - split_target_vec.push_back(0); - split_target_vec.push_back(2); - split_target_vec.push_back(0); - split_target_vec.push_back(1); - split_target_vec.push_back(3); + split_target_vec.emplace_back(1); + split_target_vec.emplace_back(0); + split_target_vec.emplace_back(2); + split_target_vec.emplace_back(0); + split_target_vec.emplace_back(1); + split_target_vec.emplace_back(3); // create test log TimeSeriesProperty<int> log("test log"); @@ -1009,19 +1009,19 @@ public: for (int i = 0; i < 10; ++i) { for (int j = 0; j < 10; ++j) { - vec_split_times.push_back(split_time); + vec_split_times.emplace_back(split_time); split_time += dt; - vec_split_target.push_back(j); + vec_split_target.emplace_back(j); } } // push back last split-time (split stop) - vec_split_times.push_back(split_time); + vec_split_times.emplace_back(split_time); // Initialze the 10 splitters std::vector<TimeSeriesProperty<int> *> outputs; for (int itarget = 0; itarget < 10; ++itarget) { - outputs.push_back(new TimeSeriesProperty<int>("target")); + outputs.emplace_back(new TimeSeriesProperty<int>("target")); } // split time series property @@ -1055,12 +1055,12 @@ public: // create the splitters std::vector<DateAndTime> split_time_vec; - split_time_vec.push_back(DateAndTime("2017-11-10T03:13:06.814538624")); - split_time_vec.push_back(DateAndTime("2017-11-10T03:14:07.764311936")); - split_time_vec.push_back(DateAndTime("2017-11-10T03:15:07.697312000")); - split_time_vec.push_back(DateAndTime("2017-11-10T03:16:08.827971840")); - split_time_vec.push_back(DateAndTime("2017-11-10T03:17:08.745746688")); - split_time_vec.push_back(DateAndTime("2017-11-10T03:20:10.757950208")); + split_time_vec.emplace_back(DateAndTime("2017-11-10T03:13:06.814538624")); + split_time_vec.emplace_back(DateAndTime("2017-11-10T03:14:07.764311936")); + split_time_vec.emplace_back(DateAndTime("2017-11-10T03:15:07.697312000")); + split_time_vec.emplace_back(DateAndTime("2017-11-10T03:16:08.827971840")); + split_time_vec.emplace_back(DateAndTime("2017-11-10T03:17:08.745746688")); + split_time_vec.emplace_back(DateAndTime("2017-11-10T03:20:10.757950208")); // create the target vector std::vector<int> split_target_vec(5); @@ -1071,7 +1071,7 @@ public: // Initialze the 2 splitters std::vector<TimeSeriesProperty<int> *> outputs; for (int itarget = 0; itarget < 2; ++itarget) { - outputs.push_back(new TimeSeriesProperty<int>("target")); + outputs.emplace_back(new TimeSeriesProperty<int>("target")); } // split @@ -1546,15 +1546,15 @@ public: // 2. Create method 1 std::vector<Mantid::Types::Core::DateAndTime> times; - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); std::vector<double> values; - values.push_back(1.00); - values.push_back(3.00); - values.push_back(2.00); - values.push_back(4.00); + values.emplace_back(1.00); + values.emplace_back(3.00); + values.emplace_back(2.00); + values.emplace_back(4.00); TimeSeriesProperty<double> *p1 = new TimeSeriesProperty<double>("Property2"); @@ -1578,8 +1578,8 @@ public: std::vector<double> valueXs; for (int i = 0; i < 4; i++) { - deltaTs.push_back(static_cast<double>(i) * 10.0); - valueXs.push_back(static_cast<double>(i) + 1.0); + deltaTs.emplace_back(static_cast<double>(i) * 10.0); + valueXs.emplace_back(static_cast<double>(i) + 1.0); } TimeSeriesProperty<double> *p2 = @@ -1657,15 +1657,15 @@ public: // 3. Check std::vector<Mantid::Types::Core::DateAndTime> times; - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); std::vector<double> values; - values.push_back(1.00); - values.push_back(2.00); - values.push_back(3.00); - values.push_back(4.00); + values.emplace_back(1.00); + values.emplace_back(2.00); + values.emplace_back(3.00); + values.emplace_back(4.00); std::map<Mantid::Types::Core::DateAndTime, double>::iterator tit; size_t index = 0; @@ -1697,17 +1697,17 @@ public: // 3. Check std::vector<Mantid::Types::Core::DateAndTime> times; - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); std::vector<double> values; - values.push_back(1.00); - values.push_back(1.99); - values.push_back(2.00); - values.push_back(3.00); - values.push_back(4.00); + values.emplace_back(1.00); + values.emplace_back(1.99); + values.emplace_back(2.00); + values.emplace_back(3.00); + values.emplace_back(4.00); size_t index = 0; for (auto it = tmap.begin(); it != tmap.end(); ++it) { @@ -1739,15 +1739,15 @@ public: // 3. Check std::vector<Mantid::Types::Core::DateAndTime> times; - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:15")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:15")); + times.emplace_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); std::vector<double> values; - values.push_back(1.00); - values.push_back(2.00); - values.push_back(3.00); - values.push_back(4.00); + values.emplace_back(1.00); + values.emplace_back(2.00); + values.emplace_back(3.00); + values.emplace_back(4.00); std::map<Mantid::Types::Core::DateAndTime, double>::iterator tit; size_t index = 0; @@ -1785,15 +1785,19 @@ public: if (tmap.size() == 4) { std::vector<Mantid::Types::Core::DateAndTime> times; - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); - times.push_back(Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); + times.emplace_back( + Mantid::Types::Core::DateAndTime("2007-11-30T16:17:00")); + times.emplace_back( + Mantid::Types::Core::DateAndTime("2007-11-30T16:17:10")); + times.emplace_back( + Mantid::Types::Core::DateAndTime("2007-11-30T16:17:20")); + times.emplace_back( + Mantid::Types::Core::DateAndTime("2007-11-30T16:17:30")); std::vector<double> values; - values.push_back(1.00); - values.push_back(2.00); - values.push_back(3.00); - values.push_back(4.00); + values.emplace_back(1.00); + values.emplace_back(2.00); + values.emplace_back(3.00); + values.emplace_back(4.00); std::map<Mantid::Types::Core::DateAndTime, double>::iterator tit; size_t index = 0; @@ -1905,8 +1909,8 @@ public: std::vector<double> deltaTs; std::vector<double> valueXs; for (int i = 0; i < 20; i++) { - deltaTs.push_back(static_cast<double>(i) * 10.0); - valueXs.push_back(static_cast<double>(i) + 1.0); + deltaTs.emplace_back(static_cast<double>(i) * 10.0); + valueXs.emplace_back(static_cast<double>(i) + 1.0); } TimeSeriesProperty<double> *p1 = new TimeSeriesProperty<double>("BaseProperty"); @@ -1920,7 +1924,7 @@ public: std::vector<Mantid::Kernel::TimeInterval> dts; for (size_t i = 0; i < origsize; i++) { - dts.push_back(p1->nthInterval(static_cast<int>(i))); + dts.emplace_back(p1->nthInterval(static_cast<int>(i))); } // 2. Create a filter @@ -2001,8 +2005,8 @@ public: std::vector<double> deltaTs; std::vector<double> valueXs; for (int i = 0; i < 20; i++) { - deltaTs.push_back(static_cast<double>(i) * 10.0); - valueXs.push_back(static_cast<double>(i) + 1.0); + deltaTs.emplace_back(static_cast<double>(i) * 10.0); + valueXs.emplace_back(static_cast<double>(i) + 1.0); } TimeSeriesProperty<double> *p1 = new TimeSeriesProperty<double>("BaseProperty"); @@ -2077,8 +2081,8 @@ public: std::vector<double> deltaTs; std::vector<double> valueXs; for (int i = 0; i < 20; i++) { - deltaTs.push_back(static_cast<double>(i) * 10.0); - valueXs.push_back(static_cast<double>(i) + 1.0); + deltaTs.emplace_back(static_cast<double>(i) * 10.0); + valueXs.emplace_back(static_cast<double>(i) + 1.0); } TimeSeriesProperty<double> *p1 = new TimeSeriesProperty<double>("BaseProperty"); @@ -2129,8 +2133,8 @@ public: std::vector<double> deltaTs; std::vector<double> valueXs; for (int i = 0; i < 20; i++) { - deltaTs.push_back(static_cast<double>(i) * 10.0); - valueXs.push_back(static_cast<double>(i) + 1.0); + deltaTs.emplace_back(static_cast<double>(i) * 10.0); + valueXs.emplace_back(static_cast<double>(i) + 1.0); } TimeSeriesProperty<double> *p1 = new TimeSeriesProperty<double>("BaseProperty"); @@ -2190,8 +2194,8 @@ public: std::vector<double> deltaTs; std::vector<double> valueXs; for (int i = 0; i < 20; i++) { - deltaTs.push_back(static_cast<double>(i) * 10.0); - valueXs.push_back(static_cast<double>(i) + 1.0); + deltaTs.emplace_back(static_cast<double>(i) * 10.0); + valueXs.emplace_back(static_cast<double>(i) + 1.0); } TimeSeriesProperty<double> *p1 = new TimeSeriesProperty<double>("BaseProperty"); diff --git a/Framework/Kernel/test/TimeSplitterTest.h b/Framework/Kernel/test/TimeSplitterTest.h index 1f7d4281d6c36fe52832cd31914d2f904cb2b114..4889e2f4614b4878f686e6c4b08bd5b711bbd252 100644 --- a/Framework/Kernel/test/TimeSplitterTest.h +++ b/Framework/Kernel/test/TimeSplitterTest.h @@ -160,36 +160,36 @@ public: TimeSplitterType a, b; start = DateAndTime("2007-11-30T16:17:00"); stop = DateAndTime("2007-11-30T16:17:10"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:20"); stop = DateAndTime("2007-11-30T16:17:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:40"); stop = DateAndTime("2007-11-30T16:17:50"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:18:00"); stop = DateAndTime("2007-11-30T16:18:10"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:18:20"); stop = DateAndTime("2007-11-30T16:18:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); // Smaller than the first one start = DateAndTime("2007-11-30T16:17:01"); stop = DateAndTime("2007-11-30T16:17:25"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:26"); stop = DateAndTime("2007-11-30T16:17:27"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:45"); stop = DateAndTime("2007-11-30T16:18:15"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); // Now AND the splitters (filters) together TimeSplitterType c; @@ -224,40 +224,40 @@ public: TimeSplitterType a, b; start = DateAndTime("2007-11-30T16:17:00"); stop = DateAndTime("2007-11-30T16:17:10"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:20"); stop = DateAndTime("2007-11-30T16:17:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:40"); stop = DateAndTime("2007-11-30T16:17:50"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:18:00"); stop = DateAndTime("2007-11-30T16:18:10"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:18:20"); stop = DateAndTime("2007-11-30T16:18:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); // Smaller than the first one start = DateAndTime("2007-11-30T16:17:01"); stop = DateAndTime("2007-11-30T16:17:25"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:26"); stop = DateAndTime("2007-11-30T16:17:27"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:45"); stop = DateAndTime("2007-11-30T16:18:15"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:18:50"); stop = DateAndTime("2007-11-30T16:18:55"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); // Now AND the splitters (filters) together TimeSplitterType c; @@ -290,22 +290,22 @@ public: start = DateAndTime("2007-11-30T16:17:20"); stop = DateAndTime("2007-11-30T16:17:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); // A bad (reversed) interval start = DateAndTime("2007-11-30T16:17:32"); stop = DateAndTime("2007-11-30T16:17:31"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); // REVERSED interval that is before the first one start = DateAndTime("2007-11-30T16:17:15"); stop = DateAndTime("2007-11-30T16:17:00"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); // Another bad interval start = DateAndTime("2007-11-30T16:17:45"); stop = DateAndTime("2007-11-30T16:17:35"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); // Now AND the splitters (filters) together TimeSplitterType c; @@ -330,11 +330,11 @@ public: //---- Normal Case ------ start = DateAndTime("2007-11-30T16:17:00"); stop = DateAndTime("2007-11-30T16:17:10"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:20"); stop = DateAndTime("2007-11-30T16:17:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); // Perform the NOT operation c = ~a; @@ -378,11 +378,11 @@ public: // Overlapping case ------ start = DateAndTime("2007-11-30T16:17:00"); stop = DateAndTime("2007-11-30T16:17:15"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:10"); stop = DateAndTime("2007-11-30T16:17:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); c = ~a; TS_ASSERT_EQUALS(c.size(), 2); @@ -406,40 +406,40 @@ public: // the splitter ------ start = DateAndTime("2007-11-30T16:15:00"); stop = DateAndTime("2007-11-30T16:16:00"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:00"); stop = DateAndTime("2007-11-30T16:18:00"); - b.push_back(SplittingInterval(start, stop, 1)); + b.emplace_back(SplittingInterval(start, stop, 1)); start = DateAndTime("2007-11-30T16:18:00"); stop = DateAndTime("2007-11-30T16:19:00"); - b.push_back(SplittingInterval(start, stop, 2)); + b.emplace_back(SplittingInterval(start, stop, 2)); start = DateAndTime("2007-11-30T16:19:00"); stop = DateAndTime("2007-11-30T16:20:00"); - b.push_back(SplittingInterval(start, stop, 3)); + b.emplace_back(SplittingInterval(start, stop, 3)); // the filter ------ start = DateAndTime("2007-11-30T16:16:50"); stop = DateAndTime("2007-11-30T16:17:10"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:20"); stop = DateAndTime("2007-11-30T16:17:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:17:40"); stop = DateAndTime("2007-11-30T16:18:10"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:18:50"); stop = DateAndTime("2007-11-30T16:18:55"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:22:20"); stop = DateAndTime("2007-11-30T16:22:30"); - a.push_back(SplittingInterval(start, stop, 0)); + a.emplace_back(SplittingInterval(start, stop, 0)); // Do the PLUS operation c = a + b; @@ -485,19 +485,19 @@ public: // the splitter ------ start = DateAndTime("2007-11-30T16:15:00"); stop = DateAndTime("2007-11-30T16:16:00"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:19:00"); stop = DateAndTime("2007-11-30T16:20:00"); - b.push_back(SplittingInterval(start, stop, 3)); + b.emplace_back(SplittingInterval(start, stop, 3)); start = DateAndTime("2007-11-30T16:18:00"); stop = DateAndTime("2007-11-30T16:19:00"); - b.push_back(SplittingInterval(start, stop, 2)); + b.emplace_back(SplittingInterval(start, stop, 2)); start = DateAndTime("2007-11-30T16:17:00"); stop = DateAndTime("2007-11-30T16:18:00"); - b.push_back(SplittingInterval(start, stop, 1)); + b.emplace_back(SplittingInterval(start, stop, 1)); std::sort(b.begin(), b.end()); @@ -515,19 +515,19 @@ public: // the splitter ------ start = DateAndTime("2007-11-30T16:15:00"); stop = DateAndTime("2007-11-30T16:16:00"); - b.push_back(SplittingInterval(start, stop, 0)); + b.emplace_back(SplittingInterval(start, stop, 0)); start = DateAndTime("2007-11-30T16:19:00"); stop = DateAndTime("2007-11-30T16:20:00"); - b.push_back(SplittingInterval(start, stop, 3)); + b.emplace_back(SplittingInterval(start, stop, 3)); start = DateAndTime("2007-11-30T16:18:00"); stop = DateAndTime("2007-11-30T16:19:00"); - b.push_back(SplittingInterval(start, stop, 2)); + b.emplace_back(SplittingInterval(start, stop, 2)); start = DateAndTime("2007-11-30T16:17:00"); stop = DateAndTime("2007-11-30T16:18:00"); - b.push_back(SplittingInterval(start, stop, 1)); + b.emplace_back(SplittingInterval(start, stop, 1)); std::sort(b.begin(), b.end()); diff --git a/Framework/Kernel/test/VMDTest.h b/Framework/Kernel/test/VMDTest.h index 126c42a232ca793630ccdcddd1265fed5dec7e4c..70d7cf177958871eb7d014416dc70204dd01c5ef 100644 --- a/Framework/Kernel/test/VMDTest.h +++ b/Framework/Kernel/test/VMDTest.h @@ -30,12 +30,12 @@ public: double v1[4] = {1, 2, 3, 4}; TS_ASSERT_EQUALS(VMD(4, v1), VMD(1, 2, 3, 4)); std::vector<double> v2; - v2.push_back(1); - v2.push_back(2); + v2.emplace_back(1.f); + v2.emplace_back(2.f); TS_ASSERT_EQUALS(VMD(v2), VMD(1, 2)); std::vector<float> v3; - v3.push_back(1); - v3.push_back(2); + v3.emplace_back(1.f); + v3.emplace_back(2.f); TS_ASSERT_EQUALS(VMD(v3), VMD(1, 2)); // Copy constructor VMD a(1, 2, 3, 4); @@ -187,7 +187,7 @@ public: void test_getNormalVector_2D() { std::vector<VMD> vectors; - vectors.push_back(VMD(1.0, 1.0)); + vectors.emplace_back(VMD(1.0, 1.0)); VMD normal = VMD::getNormalVector(vectors); TS_ASSERT_EQUALS(normal, VMD(1., -1.) * sqrt(0.5)); } @@ -195,8 +195,8 @@ public: /// Define a plane along x=y axis vertical in Z void test_getNormalVector_3D() { std::vector<VMD> vectors; - vectors.push_back(VMD(1., 1., 0.)); - vectors.push_back(VMD(0., 0., 1.)); + vectors.emplace_back(VMD(1., 1., 0.)); + vectors.emplace_back(VMD(0., 0., 1.)); VMD normal = VMD::getNormalVector(vectors); TS_ASSERT_EQUALS(normal, VMD(1., -1., 0.) * sqrt(0.5)); } @@ -204,17 +204,17 @@ public: /// Bad vectors = they are collinear void test_getNormalVector_3D_collinear() { std::vector<VMD> vectors; - vectors.push_back(VMD(1., 1., 0.)); - vectors.push_back(VMD(2., 2., 0.)); + vectors.emplace_back(VMD(1., 1., 0.)); + vectors.emplace_back(VMD(2., 2., 0.)); TS_ASSERT_THROWS_ANYTHING(VMD normal = VMD::getNormalVector(vectors)); } /// Define a plane along x=y axis vertical in Z and t void test_getNormalVector_4D() { std::vector<VMD> vectors; - vectors.push_back(VMD(1., 1., 0., 0.)); - vectors.push_back(VMD(0., 0., 1., 0.)); - vectors.push_back(VMD(0., 0., 0., 1.)); + vectors.emplace_back(VMD(1., 1., 0., 0.)); + vectors.emplace_back(VMD(0., 0., 1., 0.)); + vectors.emplace_back(VMD(0., 0., 0., 1.)); VMD normal = VMD::getNormalVector(vectors); TS_ASSERT_EQUALS(normal, VMD(1., -1., 0., 0.) * sqrt(0.5)); } diff --git a/Framework/Kernel/test/VectorHelperTest.h b/Framework/Kernel/test/VectorHelperTest.h index ee3c39239e297bcf8116d3e6c46b9b3a9c4a6d7e..dddb116d46e9eae45c9963f46287641017478d24 100644 --- a/Framework/Kernel/test/VectorHelperTest.h +++ b/Framework/Kernel/test/VectorHelperTest.h @@ -37,7 +37,7 @@ public: TS_ASSERT_THROWS_EQUALS(VectorHelper::indexOfValueFromEdges(single, 7.1), const std::out_of_range &e, std::string(e.what()), "indexOfValue - vector is empty"); - single.push_back(1.7); + single.emplace_back(1.7); TS_ASSERT_THROWS_EQUALS(VectorHelper::indexOfValueFromEdges(single, 4.8), const std::out_of_range &e, std::string(e.what()), "indexOfValue - requires at least two bin edges"); @@ -60,7 +60,7 @@ public: TS_ASSERT_THROWS_EQUALS(VectorHelper::indexOfValueFromCenters(single, 5.9), const std::out_of_range &e, std::string(e.what()), "indexOfValue - vector is empty"); - single.push_back(2.5); + single.emplace_back(2.5); TS_ASSERT_THROWS_EQUALS(VectorHelper::indexOfValueFromCenters(single, 6.1), const std::out_of_range &e, std::string(e.what()), "indexOfValue - value out of range"); @@ -315,8 +315,8 @@ public: y = VectorHelper::normalizeVector(x); TSM_ASSERT_EQUALS("Pass-through empty vectors", y.size(), 0); - x.push_back(3.0); - x.push_back(4.0); + x.emplace_back(3.0); + x.emplace_back(4.0); TS_ASSERT_DELTA(VectorHelper::lengthVector(x), 5.0, 1e-5); y = VectorHelper::normalizeVector(x); TS_ASSERT_EQUALS(y.size(), 2); @@ -398,7 +398,7 @@ public: TS_ASSERT_THROWS( VectorHelper::smoothInRange(inputData, output, 6, &inputBoundaries), const std::invalid_argument &); - inputBoundaries.push_back(6); + inputBoundaries.emplace_back(6); VectorHelper::smoothInRange(inputData, output, 6, &inputBoundaries); TS_ASSERT_DELTA(output[1] - output[0], 0.492, 1.e-3); diff --git a/Framework/LiveData/src/ISIS/ISISHistoDataListener.cpp b/Framework/LiveData/src/ISIS/ISISHistoDataListener.cpp index 24fbfe48a0111fc8a5f73de625ddf07b7c060858..383196730e2badcc5775d859c0703eb0e24cf65a 100644 --- a/Framework/LiveData/src/ISIS/ISISHistoDataListener.cpp +++ b/Framework/LiveData/src/ISIS/ISISHistoDataListener.cpp @@ -382,12 +382,12 @@ void ISISHistoDataListener::calculateIndicesForReading( int n = numberOfSpectra; while (n > 0) { if (n < maxNumberOfSpectra) { - index.push_back(spec); - count.push_back(n); + index.emplace_back(spec); + count.emplace_back(n); break; } else { - index.push_back(spec); - count.push_back(maxNumberOfSpectra); + index.emplace_back(spec); + count.emplace_back(maxNumberOfSpectra); n -= maxNumberOfSpectra; spec += maxNumberOfSpectra; } @@ -401,15 +401,15 @@ void ISISHistoDataListener::calculateIndicesForReading( if (next - m_specList[i - 1] > 1 || static_cast<int>(i - i0) >= maxNumberOfSpectra) { auto n = static_cast<int>(i - i0); - index.push_back(spec); - count.push_back(n); + index.emplace_back(spec); + count.emplace_back(n); i0 = i; spec = next; } } auto n = static_cast<int>(m_specList.size() - i0); - index.push_back(spec); - count.push_back(n); + index.emplace_back(spec); + count.emplace_back(n); } } @@ -531,8 +531,8 @@ void ISISHistoDataListener::loadTimeRegimes() { // if it's first call of this method populate the member variables if (m_bins.size() == tr) { - m_numberOfBins.push_back(nbins); - m_numberOfSpectra.push_back(nspec); + m_numberOfBins.emplace_back(nbins); + m_numberOfSpectra.emplace_back(nspec); // buffer to read float values in std::vector<float> floatBuffer; diff --git a/Framework/LiveData/src/Kafka/KafkaEventStreamDecoder.cpp b/Framework/LiveData/src/Kafka/KafkaEventStreamDecoder.cpp index 5e694192e8acdb6f9c8bac5abf53fdfa219ec593..817f196938539f0ab1391e4eef974573c72fd159 100644 --- a/Framework/LiveData/src/Kafka/KafkaEventStreamDecoder.cpp +++ b/Framework/LiveData/src/Kafka/KafkaEventStreamDecoder.cpp @@ -396,7 +396,7 @@ void KafkaEventStreamDecoder::eventDataFromMessage(const std::string &buffer, std::lock_guard<std::mutex> bufferLock(m_intermediateBufferMutex); /* Store the buffered pulse */ - m_receivedPulseBuffer.push_back(pulse); + m_receivedPulseBuffer.emplace_back(pulse); const auto pulseIndex = m_receivedPulseBuffer.size() - 1; /* Ensure storage for newly received events */ diff --git a/Framework/LiveData/src/Kafka/KafkaTopicSubscriber.cpp b/Framework/LiveData/src/Kafka/KafkaTopicSubscriber.cpp index 09ce48b3b8fa514f10a9440f14c8158b5afd3d33..69f28cfc1e495ee464c8fc1fe139804e95951beb 100644 --- a/Framework/LiveData/src/Kafka/KafkaTopicSubscriber.cpp +++ b/Framework/LiveData/src/Kafka/KafkaTopicSubscriber.cpp @@ -132,7 +132,7 @@ KafkaTopicSubscriber::getTopicPartitions() { ++partitionNumber) { auto topicPartition = RdKafka::TopicPartition::create( topicName, static_cast<int>(partitionNumber)); - partitions.push_back(topicPartition); + partitions.emplace_back(topicPartition); } } return partitions; @@ -164,7 +164,7 @@ KafkaTopicSubscriber::getCurrentOffsets() { if (!result.second) { // If we could not emplace a new pair then the key already exists, so // append the offset to the vector belonging to the existing topic key - currentOffsets[topicPartition->topic()].push_back( + currentOffsets[topicPartition->topic()].emplace_back( topicPartition->offset()); } } @@ -357,7 +357,7 @@ void KafkaTopicSubscriber::subscribeAtOffset(int64_t offset) { } topicPartition->set_offset(confOffset); - topicPartitions.push_back(topicPartition); + topicPartitions.emplace_back(topicPartition); } LOGGER().debug() << "Attempting to subscribe to " << topicPartitions.size() << " partitions in KafkaTopicSubscriber::subscribeAtOffset()" diff --git a/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/flatbuffers.h b/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/flatbuffers.h index 69bbccc13775de328d3ff6f72fcd4a279a54f819..eb13cd21043f7e7dbf65846aebe2da4c4443fd7f 100644 --- a/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/flatbuffers.h +++ b/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/flatbuffers.h @@ -519,7 +519,7 @@ class DetachedBuffer { }; // This is a minimal replication of std::vector<uint8_t> functionality, -// except growing from higher to lower addresses. i.e push_back() inserts data +// except growing from higher to lower addresses. i.e emplace_back() inserts data // in the lowest address in the vector. // Since this vector leaves the lower part unused, we support a "scratch-pad" // that can be stored there for temporary data, to share the allocated space. diff --git a/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/stl_emulation.h b/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/stl_emulation.h index 7e7e978a450f1a6ddd0c6f8c6805865b390c73f1..a419a26194636e0a22c9a3b766925d0b1d25263d 100644 --- a/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/stl_emulation.h +++ b/Framework/LiveData/src/Kafka/private/Schema/flatbuffers/stl_emulation.h @@ -62,7 +62,7 @@ template <typename T> inline const T *vector_data( template <typename T, typename V> inline void vector_emplace_back(std::vector<T> *vector, V &&data) { #if defined(FLATBUFFERS_CPP98_STL) - vector->push_back(data); + vector->emplace_back(data); #else vector->emplace_back(std::forward<V>(data)); #endif // defined(FLATBUFFERS_CPP98_STL) diff --git a/Framework/LiveData/src/LiveDataAlgorithm.cpp b/Framework/LiveData/src/LiveDataAlgorithm.cpp index 3fe7025d17939f98d0a6ce08df5f34c6f00cb74d..09b49a2fb6dff0d3e1cf5e8f84d0cc66ecdf3140 100644 --- a/Framework/LiveData/src/LiveDataAlgorithm.cpp +++ b/Framework/LiveData/src/LiveDataAlgorithm.cpp @@ -41,13 +41,13 @@ void LiveDataAlgorithm::initProps() { Kernel::ConfigService::Instance().getFacility().instruments(); for (const auto &instrument : instrInfo) { if (instrument.hasLiveListenerInfo()) { - instruments.push_back(instrument.name()); + instruments.emplace_back(instrument.name()); } } // All available listener class names auto listeners = LiveListenerFactory::Instance().getKeys(); - listeners.push_back(""); // Allow not specifying a listener too + listeners.emplace_back(""); // Allow not specifying a listener too declareProperty(std::make_unique<PropertyWithValue<std::string>>( "Instrument", "", diff --git a/Framework/LiveData/src/SNSLiveEventDataListener.cpp b/Framework/LiveData/src/SNSLiveEventDataListener.cpp index 1f40a7cb6911241ed5b9585a41f2666860c3f5f4..7aae2e24f23b6f4462561d000b1546c8927fae3d 100644 --- a/Framework/LiveData/src/SNSLiveEventDataListener.cpp +++ b/Framework/LiveData/src/SNSLiveEventDataListener.cpp @@ -502,7 +502,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::BeamMonitorPkt &pkt) { events += m_eventBuffer->run().getPropertyValueAsType<int>(monName); } else { // First time we've received this monitor. Add it to our list - m_monitorLogs.push_back(monName); + m_monitorLogs.emplace_back(monName); } // Update the property value (overwriting the old value if there was one) @@ -580,7 +580,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::GeometryPkt &pkt) { for (long unsigned k = 0; k < attrLength; k++) { Poco::XML::Node *attrNode = attr->item(k); if (attrNode->nodeName() == "id") { - m_requiredLogs.push_back(attrNode->nodeValue()); + m_requiredLogs.emplace_back(attrNode->nodeValue()); } } } diff --git a/Framework/LiveData/src/StartLiveData.cpp b/Framework/LiveData/src/StartLiveData.cpp index 3a73bf0b426fc4329ed469cae2e098d4cec1bd75..5be5f7cd9090be085fad974baf7b68a81e6f6d62 100644 --- a/Framework/LiveData/src/StartLiveData.cpp +++ b/Framework/LiveData/src/StartLiveData.cpp @@ -125,7 +125,7 @@ void StartLiveData::removeListenerProperties() { // Find properties tagged with the listener property group for (const auto &prop : getProperties()) { if (prop->getGroup() == listenerPropertyGroup) { - propertiesToRemove.push_back(prop->name()); + propertiesToRemove.emplace_back(prop->name()); } } diff --git a/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp b/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp index a1f6296485269dda4f835207fb44ef470bef48d3..0f0e0978f018fed7ddf84f4bee55250d88184ab1 100644 --- a/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp +++ b/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp @@ -177,8 +177,8 @@ void CalculateCoverageDGS::exec() { for (size_t i = 0; i < detectorInfo.size(); ++i) { if (!detectorInfo.isMasked(i) && !detectorInfo.isMonitor(i)) { const auto &detector = detectorInfo.detector(i); - tt.push_back(detector.getTwoTheta(V3D(0, 0, 0), V3D(0, 0, 1))); - phi.push_back(detector.getPhi()); + tt.emplace_back(detector.getTwoTheta(V3D(0, 0, 0), V3D(0, 0, 1))); + phi.emplace_back(detector.getPhi()); } } @@ -400,16 +400,16 @@ void CalculateCoverageDGS::exec() { for (size_t row = 0; row <= 3; row++) { if (affineMat[row][0] == 1.) { - binDimensions.push_back(out1); + binDimensions.emplace_back(out1); } if (affineMat[row][1] == 1.) { - binDimensions.push_back(out2); + binDimensions.emplace_back(out2); } if (affineMat[row][2] == 1.) { - binDimensions.push_back(out3); + binDimensions.emplace_back(out3); } if (affineMat[row][3] == 1.) { - binDimensions.push_back(out4); + binDimensions.emplace_back(out4); } } diff --git a/Framework/MDAlgorithms/src/CompactMD.cpp b/Framework/MDAlgorithms/src/CompactMD.cpp index 807ee480fc8336c1164ac08f5a4c25d16fc99d89..0a59434dccbd086598202a6150a971f45c9f9300 100644 --- a/Framework/MDAlgorithms/src/CompactMD.cpp +++ b/Framework/MDAlgorithms/src/CompactMD.cpp @@ -42,7 +42,7 @@ createPBinStringVector(std::vector<Mantid::coord_t> minVector, boost::lexical_cast<std::string>( maxVector[iter] + (inputWs->getDimension(iter)->getBinWidth() * 0.5)); - pBinStrVector.push_back(pBinStr); + pBinStrVector.emplace_back(pBinStr); } return pBinStrVector; } @@ -132,8 +132,8 @@ void CompactMD::exec() { // fill the min/max vectors with values per dimension. for (size_t index = 0; index < nDimensions; index++) { - minVector.push_back(input_ws->getDimension(index)->getMaximum()); - maxVector.push_back(input_ws->getDimension(index)->getMinimum()); + minVector.emplace_back(input_ws->getDimension(index)->getMaximum()); + maxVector.emplace_back(input_ws->getDimension(index)->getMinimum()); } // start our search for the first non-zero signal index. findFirstNonZeroMinMaxExtents(input_ws, minVector, maxVector); diff --git a/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp b/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp index 19a84162c1270a78778660b0d0db34e3970d82bf..9e853bbbabeebc15858e1305846e1d7d7f6e7301 100644 --- a/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp +++ b/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp @@ -61,10 +61,10 @@ size_t ConvToMDEventsWS::convertEventList(size_t workspaceIndex) { if (!m_QConverter->calcMatrixCoord(val, locCoord, signal, errorSq)) continue; // skip ND outside the range - sig_err.push_back(static_cast<float>(signal)); - sig_err.push_back(static_cast<float>(errorSq)); - run_index.push_back(runIndexLoc); - det_ids.push_back(detID); + sig_err.emplace_back(static_cast<float>(signal)); + sig_err.emplace_back(static_cast<float>(errorSq)); + run_index.emplace_back(runIndexLoc); + det_ids.emplace_back(detID); allCoord.insert(allCoord.end(), locCoord.begin(), locCoord.end()); } diff --git a/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp index 06ab8eae7aa8aa5ba3c7747dba2741c9b4f04f1b..9714b968cde6f355ed823f4c8b5f93149e9733e4 100644 --- a/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp @@ -94,7 +94,7 @@ void ConvertCWSDMDtoHKL::exec() { qsample.setZ(-4.77349); std::vector<Kernel::V3D> vec_qsample; - vec_qsample.push_back(qsample); + vec_qsample.emplace_back(qsample); std::vector<Kernel::V3D> vec_mindex(0); convertFromQSampleToHKL(vec_qsample, vec_mindex); diff --git a/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp b/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp index 928e1d07969ef5a0014575dc79dcd3e96ecfce0a..4856027e75c1079b1b37fdf52d11904b8a72c2b0 100644 --- a/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDetectorFaceMD.cpp @@ -239,7 +239,7 @@ void ConvertToDetectorFaceMD::exec() { MDHistoDimension_sptr dimBanks(new MDHistoDimension( "bank", "bank", frameNumber, static_cast<coord_t>(min), static_cast<coord_t>(max), max - min)); - dims.push_back(dimBanks); + dims.emplace_back(dimBanks); } // --------- Create the workspace with the right number of dimensions diff --git a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp index 4c1bcf78301f7458cd1ba9a02d3bf864d49542d1..d36a604b965ba0c3dd17bb60b6412c6c741473c3 100644 --- a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp @@ -426,8 +426,8 @@ void ConvertToDiffractionMDWorkspace::exec() { // Replicate a single min,max into several if (extents.size() == 2) { for (size_t d = 1; d < nd; d++) { - extents.push_back(extents[0]); - extents.push_back(extents[1]); + extents.emplace_back(extents[0]); + extents.emplace_back(extents[1]); } } if (extents.size() != nd * 2) diff --git a/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp b/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp index 143bcf3a8c0d2c6ead2241cbdc90a92db249312b..684402aac211ba8e00fda1e04b9f17288ef9d27d 100644 --- a/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp @@ -139,8 +139,8 @@ void ConvertToMDMinMaxGlobal::exec() { if (QDimension == "CopyToMD") { double xmin, xmax; ws->getXMinMax(xmin, xmax); - MinValues.push_back(xmin); - MaxValues.push_back(xmax); + MinValues.emplace_back(xmin); + MaxValues.emplace_back(xmax); } else // need to calculate the appropriate q values { double qmax, deltaEmax, deltaEmin; @@ -214,19 +214,19 @@ void ConvertToMDMinMaxGlobal::exec() { } // Calculate limits from qmax if (QDimension == "|Q|") { - MinValues.push_back(0.); - MaxValues.push_back(qmax); + MinValues.emplace_back(0.); + MaxValues.emplace_back(qmax); } else // Q3D { // Q in angstroms if ((Q3DFrames == "Q") || ((Q3DFrames == "AutoSelect") && (!ws->sample().hasOrientedLattice()))) { - MinValues.push_back(-qmax); - MinValues.push_back(-qmax); - MinValues.push_back(-qmax); - MaxValues.push_back(qmax); - MaxValues.push_back(qmax); - MaxValues.push_back(qmax); + MinValues.emplace_back(-qmax); + MinValues.emplace_back(-qmax); + MinValues.emplace_back(-qmax); + MaxValues.emplace_back(qmax); + MaxValues.emplace_back(qmax); + MaxValues.emplace_back(qmax); } else // HKL { if (!ws->sample().hasOrientedLattice()) { @@ -236,19 +236,19 @@ void ConvertToMDMinMaxGlobal::exec() { Mantid::Geometry::OrientedLattice ol = ws->sample().getOrientedLattice(); qmax /= (2. * M_PI); - MinValues.push_back(-qmax * ol.a()); - MinValues.push_back(-qmax * ol.b()); - MinValues.push_back(-qmax * ol.c()); - MaxValues.push_back(qmax * ol.a()); - MaxValues.push_back(qmax * ol.b()); - MaxValues.push_back(qmax * ol.c()); + MinValues.emplace_back(-qmax * ol.a()); + MinValues.emplace_back(-qmax * ol.b()); + MinValues.emplace_back(-qmax * ol.c()); + MaxValues.emplace_back(qmax * ol.a()); + MaxValues.emplace_back(qmax * ol.b()); + MaxValues.emplace_back(qmax * ol.c()); } } // Push deltaE if necessary if (GeometryMode != "Elastic") { - MinValues.push_back(deltaEmin); - MaxValues.push_back(deltaEmax); + MinValues.emplace_back(deltaEmin); + MaxValues.emplace_back(deltaEmax); } } @@ -261,8 +261,8 @@ void ConvertToMDMinMaxGlobal::exec() { Kernel::Property *pProperty = (ws->run().getProperty(OtherDimension)); auto *p = dynamic_cast<TimeSeriesProperty<double> *>(pProperty); if (p) { - MinValues.push_back(p->getStatistics().minimum); - MaxValues.push_back(p->getStatistics().maximum); + MinValues.emplace_back(p->getStatistics().minimum); + MaxValues.emplace_back(p->getStatistics().maximum); } else // it may be not a time series property but just number property { auto *property = @@ -276,8 +276,8 @@ void ConvertToMDMinMaxGlobal::exec() { throw(std::invalid_argument(ERR)); } double val = *property; - MinValues.push_back(val); - MaxValues.push_back(val); + MinValues.emplace_back(val); + MaxValues.emplace_back(val); } } diff --git a/Framework/MDAlgorithms/src/CreateMD.cpp b/Framework/MDAlgorithms/src/CreateMD.cpp index 102f7e0b7d0a1e54b4184fb16388531eb7183b95..5792649ce6ec53795cca67274abd98815aae51ae 100644 --- a/Framework/MDAlgorithms/src/CreateMD.cpp +++ b/Framework/MDAlgorithms/src/CreateMD.cpp @@ -211,7 +211,7 @@ void CreateMD::exec() { padParameterVector(gl, entries); padParameterVector(gs, entries); if (efix.empty()) { - efix.push_back(-1.0); + efix.emplace_back(-1.0); } padParameterVector(efix, entries); @@ -253,7 +253,7 @@ void CreateMD::exec() { gl[entry_number], gs[entry_number], do_in_place, alatt, angdeg, u, v, out_filename, fileBackEnd, run_md); - to_merge_names.push_back(to_merge_name); + to_merge_names.emplace_back(to_merge_name); // We are stuck using ADS as we can't pass workspace pointers to MergeMD // There is currently no way to pass a list of workspace pointers diff --git a/Framework/MDAlgorithms/src/CutMD.cpp b/Framework/MDAlgorithms/src/CutMD.cpp index ee79a6cb16067cd4d57c293b488c66e1b88af1d8..8c10c5425908dc2b019e8cdd3edb1006dee3a2c6 100644 --- a/Framework/MDAlgorithms/src/CutMD.cpp +++ b/Framework/MDAlgorithms/src/CutMD.cpp @@ -169,7 +169,7 @@ calculateSteps(const std::vector<MinMax> &inExtents, } if (outBin < 0) throw std::runtime_error("output bin calculated to be less than 0"); - outBins.push_back(outBin); + outBins.emplace_back(outBin); } return std::make_pair(outExtents, outBins); } @@ -393,16 +393,16 @@ void CutMD::exec() { const double extentRange = extentLimit.second - extentLimit.first; if (nArgs == 1) { - steppedExtents.push_back(extentLimit); - steppedBins.push_back(static_cast<int>(extentRange / pbins[i][0])); + steppedExtents.emplace_back(extentLimit); + steppedBins.emplace_back(static_cast<int>(extentRange / pbins[i][0])); } else if (nArgs == 2) { steppedExtents.emplace_back(pbins[i][0], pbins[i][1]); - steppedBins.push_back(1); + steppedBins.emplace_back(1); } else if (nArgs == 3) { const double dimRange = pbins[i][2] - pbins[i][0]; const double stepSize = pbins[i][1] < dimRange ? pbins[i][1] : dimRange; steppedExtents.emplace_back(pbins[i][0], pbins[i][2]); - steppedBins.push_back(static_cast<int>(dimRange / stepSize)); + steppedBins.emplace_back(static_cast<int>(dimRange / stepSize)); } // and double targetUnits' length by appending itself to itself diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp index 1e2ddf05cf1df621550de79f2807a35c7e4e3db4..f77fbe9178f61be1f0b3b96f1c14ef5ca6cbedb5 100644 --- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -483,7 +483,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace<MDE, nd>::sptr ws) { break; } - peakBoxes.push_back(box); + peakBoxes.emplace_back(box); g_log.debug() << "Found box at "; for (size_t d = 0; d < nd; d++) g_log.debug() << (d > 0 ? "," : "") << boxCenter[d]; @@ -667,7 +667,7 @@ void FindPeaksMD::findPeaksHisto( break; } - peakBoxes.push_back(index); + peakBoxes.emplace_back(index); g_log.debug() << "Found box at index " << index; g_log.debug() << "; Density = " << density << '\n'; // Report progres for each box found. @@ -743,9 +743,9 @@ void FindPeaksMD::exec() { // Do a sort by bank name and then descending bin count (intensity) std::vector<std::pair<std::string, bool>> criteria; - criteria.push_back(std::pair<std::string, bool>("RunNumber", true)); - criteria.push_back(std::pair<std::string, bool>("BankName", true)); - criteria.push_back(std::pair<std::string, bool>("bincount", false)); + criteria.emplace_back(std::pair<std::string, bool>("RunNumber", true)); + criteria.emplace_back(std::pair<std::string, bool>("BankName", true)); + criteria.emplace_back(std::pair<std::string, bool>("bincount", false)); peakWS->sort(criteria); for (auto i = 0; i != peakWS->getNumberPeaks(); ++i) { diff --git a/Framework/MDAlgorithms/src/FlippingRatioCorrectionMD.cpp b/Framework/MDAlgorithms/src/FlippingRatioCorrectionMD.cpp index b0b25a0304842eba0f7a31c4a5cab77c0cb03c61..52551be1606f516cebc2ffd0459c92df45bb2694 100644 --- a/Framework/MDAlgorithms/src/FlippingRatioCorrectionMD.cpp +++ b/Framework/MDAlgorithms/src/FlippingRatioCorrectionMD.cpp @@ -120,7 +120,7 @@ void FlippingRatioCorrectionMD::exec() { muParser.DefineConst("pi", M_PI); muParser.SetExpr(inputFormula); try { - flippingRatio.push_back(muParser.Eval()); + flippingRatio.emplace_back(muParser.Eval()); } catch (mu::Parser::exception_type &e) { g_log.error() << "Parsing error in experiment info " << i << "\n" << e.GetMsg() << std::endl @@ -129,8 +129,8 @@ void FlippingRatioCorrectionMD::exec() { } } for (const auto &fr : flippingRatio) { - C1.push_back(fr / (fr - 1.)); - C2.push_back(1. / (fr - 1.)); + C1.emplace_back(fr / (fr - 1.)); + C2.emplace_back(1. / (fr - 1.)); } // Create workspaces by cloning API::IMDWorkspace_sptr outputWS1, outputWS2; diff --git a/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp b/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp index 4980d28b561b9055fdda444ef3864ed7bff7e42a..eb0529551e8c5c1efe9c3225c020f19e114a60a0 100644 --- a/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp +++ b/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp @@ -412,12 +412,12 @@ void GetSpiceDataRawCountsFromMD::getDetCounts( Kernel::V3D v_det_sample = detpos - samplepos; Kernel::V3D v_sample_src = samplepos - sourcepos; double twotheta = v_det_sample.angle(v_sample_src) / M_PI * 180.; - vecX.push_back(twotheta); + vecX.emplace_back(twotheta); } // add new value to vecPair double signal = mditer->getInnerSignal(iev); - vecY.push_back(signal); + vecY.emplace_back(signal); } // ENDFOR (iev) // Advance to next cell @@ -471,7 +471,7 @@ void GetSpiceDataRawCountsFromMD::getSampleLogValues( } // Get experiment value double logvalue = expinfo->run().getPropertyAsSingleValue(samplelogname); - vecSampleLog.push_back(logvalue); + vecSampleLog.emplace_back(logvalue); g_log.debug() << "Add sample log (" << samplelogname << ") " << logvalue << " of " << iexp << "-th ExperimentInfo " << "\n"; diff --git a/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp b/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp index 575873f7ad464801e6e2fde9d9668c79b9f03c7a..385cf0f276a4daabcfa10425d327cb7810dddba2 100644 --- a/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp +++ b/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp @@ -126,7 +126,7 @@ MDHistoWorkspace_sptr ImportMDHistoWorkspaceBase::createEmptyOutputWorkspace() { std::vector<MDHistoDimension_sptr> dimensions; for (size_t k = 0; k < ndims; ++k) { auto frame = createMDFrame(frames[k], units[k]); - dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( + dimensions.emplace_back(MDHistoDimension_sptr(new MDHistoDimension( names[k], names[k], *frame, static_cast<coord_t>(extents[k * 2]), static_cast<coord_t>(extents[(k * 2) + 1]), nbins[k]))); } @@ -162,10 +162,10 @@ ImportMDHistoWorkspaceBase::validateInputs() { auto ndims = static_cast<size_t>(ndims_prop); std::vector<std::string> targetFrames; - targetFrames.push_back(Mantid::Geometry::GeneralFrame::GeneralFrameName); - targetFrames.push_back(Mantid::Geometry::HKL::HKLName); - targetFrames.push_back(Mantid::Geometry::QLab::QLabName); - targetFrames.push_back(Mantid::Geometry::QSample::QSampleName); + targetFrames.emplace_back(Mantid::Geometry::GeneralFrame::GeneralFrameName); + targetFrames.emplace_back(Mantid::Geometry::HKL::HKLName); + targetFrames.emplace_back(Mantid::Geometry::QLab::QLabName); + targetFrames.emplace_back(Mantid::Geometry::QSample::QSampleName); auto isValidFrame = true; for (auto &frame : frames) { diff --git a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp index a38c2e8687c946d58f9d02018542e9c172d3c005..582b88eecac4332057ce4dc0a9f712f9d29a19f5 100644 --- a/Framework/MDAlgorithms/src/Integrate3DEvents.cpp +++ b/Framework/MDAlgorithms/src/Integrate3DEvents.cpp @@ -179,9 +179,9 @@ Integrate3DEvents::integrateStrongPeak(const IntegrationParameters ¶ms, std::vector<double> abcBackgroundOuterRadii, abcBackgroundInnerRadii; std::vector<double> peakRadii; for (int i = 0; i < 3; i++) { - abcBackgroundOuterRadii.push_back(r3 * sigmas[i]); - abcBackgroundInnerRadii.push_back(r2 * sigmas[i]); - peakRadii.push_back(r1 * sigmas[i]); + abcBackgroundOuterRadii.emplace_back(r3 * sigmas[i]); + abcBackgroundInnerRadii.emplace_back(r2 * sigmas[i]); + peakRadii.emplace_back(r1 * sigmas[i]); } const auto isPeakOnDetector = @@ -318,9 +318,9 @@ double Integrate3DEvents::estimateSignalToNoiseRatio( std::vector<double> abcBackgroundOuterRadii, abcBackgroundInnerRadii; std::vector<double> peakRadii; for (int i = 0; i < 3; i++) { - abcBackgroundOuterRadii.push_back(r3 * sigmas[i]); - abcBackgroundInnerRadii.push_back(r2 * sigmas[i]); - peakRadii.push_back(r1 * sigmas[i]); + abcBackgroundOuterRadii.emplace_back(r3 * sigmas[i]); + abcBackgroundInnerRadii.emplace_back(r2 * sigmas[i]); + peakRadii.emplace_back(r1 * sigmas[i]); } // Background / Peak / Background @@ -601,7 +601,7 @@ double Integrate3DEvents::numInEllipsoidBkg( sumIn += comp * comp; } if (sum <= 1 && sumIn >= 1) - eventVec.push_back(event.first); + eventVec.emplace_back(event.first); } auto endIndex = eventVec.size(); @@ -1023,7 +1023,7 @@ void Integrate3DEvents::addEvent(std::pair<double, V3D> event_Q, else event_Q.second = event_Q.second - peak_it->second; if (event_Q.second.norm() < m_radius) { - m_event_lists[hkl_key].push_back(event_Q); + m_event_lists[hkl_key].emplace_back(event_Q); } } } @@ -1065,9 +1065,9 @@ void Integrate3DEvents::addModEvent(std::pair<double, V3D> event_Q, if (hklmnp_key % 10000 == 0) { if (event_Q.second.norm() < m_radius) - m_event_lists[hklmnp_key].push_back(event_Q); + m_event_lists[hklmnp_key].emplace_back(event_Q); } else if (event_Q.second.norm() < s_radius) { - m_event_lists[hklmnp_key].push_back(event_Q); + m_event_lists[hklmnp_key].emplace_back(event_Q); } } } @@ -1158,10 +1158,10 @@ PeakShapeEllipsoid_const_sptr Integrate3DEvents::ellipseIntegrateEvents( std::vector<double> abcBackgroundInnerRadii; std::vector<double> abcRadii; for (int i = 0; i < 3; i++) { - abcBackgroundOuterRadii.push_back(r3 * sigmas[i]); - abcBackgroundInnerRadii.push_back(r2 * sigmas[i]); - abcRadii.push_back(r1 * sigmas[i]); - axes_radii.push_back(r1 * sigmas[i]); + abcBackgroundOuterRadii.emplace_back(r3 * sigmas[i]); + abcBackgroundInnerRadii.emplace_back(r2 * sigmas[i]); + abcRadii.emplace_back(r1 * sigmas[i]); + axes_radii.emplace_back(r1 * sigmas[i]); } if (!E1Vec.empty()) { diff --git a/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp b/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp index 975db4fca72ccd177bffcdafbf4163d18731ef49..e085ec8cb58680b1c9d5344d13f9d008ec773e5b 100644 --- a/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp +++ b/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp @@ -404,8 +404,8 @@ void IntegrateEllipsoids::exec() { if (Geometry::IndexingUtils::ValidIndex(hkl, 1.0)) { peak_q_list.emplace_back(peaks[i].getQLabFrame()); qList.emplace_back(1., V3D(peaks[i].getQLabFrame())); - hkl_vectors.push_back(hkl); - mnp_vectors.push_back(mnp); + hkl_vectors.emplace_back(hkl); + mnp_vectors.emplace_back(mnp); indexed_count++; } } @@ -535,13 +535,13 @@ void IntegrateEllipsoids::exec() { if (axes_radii.size() == 3) { if (inti / sigi > cutoffIsigI || cutoffIsigI == EMPTY_DBL()) { if (mnp == V3D(0, 0, 0)) { - principalaxis1.push_back(axes_radii[0]); - principalaxis2.push_back(axes_radii[1]); - principalaxis3.push_back(axes_radii[2]); + principalaxis1.emplace_back(axes_radii[0]); + principalaxis2.emplace_back(axes_radii[1]); + principalaxis3.emplace_back(axes_radii[2]); } else { - sateprincipalaxis1.push_back(axes_radii[0]); - sateprincipalaxis2.push_back(axes_radii[1]); - sateprincipalaxis3.push_back(axes_radii[2]); + sateprincipalaxis1.emplace_back(axes_radii[0]); + sateprincipalaxis2.emplace_back(axes_radii[1]); + sateprincipalaxis3.emplace_back(axes_radii[2]); } } } @@ -635,13 +635,13 @@ void IntegrateEllipsoids::exec() { peaks[i].setSigmaIntensity(sigi); if (axes_radii.size() == 3) { if (mnp == V3D(0, 0, 0)) { - principalaxis1.push_back(axes_radii[0]); - principalaxis2.push_back(axes_radii[1]); - principalaxis3.push_back(axes_radii[2]); + principalaxis1.emplace_back(axes_radii[0]); + principalaxis2.emplace_back(axes_radii[1]); + principalaxis3.emplace_back(axes_radii[2]); } else { - sateprincipalaxis1.push_back(axes_radii[0]); - sateprincipalaxis2.push_back(axes_radii[1]); - sateprincipalaxis3.push_back(axes_radii[2]); + sateprincipalaxis1.emplace_back(axes_radii[0]); + sateprincipalaxis2.emplace_back(axes_radii[1]); + sateprincipalaxis3.emplace_back(axes_radii[2]); } } } else { @@ -736,7 +736,7 @@ void IntegrateEllipsoids::calculateE1( V3D E1 = V3D(-std::sin(tt1) * std::cos(ph1), -std::sin(tt1) * std::sin(ph1), 1. - std::cos(tt1)); // end of trajectory E1 = E1 * (1. / E1.norm()); // normalize - E1Vec.push_back(E1); + E1Vec.emplace_back(E1); } } diff --git a/Framework/MDAlgorithms/src/IntegrateEllipsoidsTwoStep.cpp b/Framework/MDAlgorithms/src/IntegrateEllipsoidsTwoStep.cpp index 30ca605b584376b5663bc958a36e81d5ba5b3a4f..6926b137fc3de5be6ae12b678ef4710bf8e9b54f 100644 --- a/Framework/MDAlgorithms/src/IntegrateEllipsoidsTwoStep.cpp +++ b/Framework/MDAlgorithms/src/IntegrateEllipsoidsTwoStep.cpp @@ -166,7 +166,7 @@ void IntegrateEllipsoidsTwoStep::exec() { V3D miller_ind(static_cast<double>(boost::math::iround<double>(hkl[0])), static_cast<double>(boost::math::iround<double>(hkl[1])), static_cast<double>(boost::math::iround<double>(hkl[2]))); - hkl_vectors.push_back(miller_ind); + hkl_vectors.emplace_back(miller_ind); indexed_count++; } } @@ -235,12 +235,12 @@ void IntegrateEllipsoidsTwoStep::exec() { g_log.notice() << "Peak " << peak.getHKL() << " with Q = " << center << " is a weak peak with signal to noise " << sig2noise << "\n"; - weakPeaks.push_back(result); + weakPeaks.emplace_back(result); } else { g_log.notice() << "Peak " << peak.getHKL() << " with Q = " << center << " is a strong peak with signal to noise " << sig2noise << "\n"; - strongPeaks.push_back(result); + strongPeaks.emplace_back(result); } } @@ -256,7 +256,7 @@ void IntegrateEllipsoidsTwoStep::exec() { IntegrationParameters params = makeIntegrationParameters(q); const auto result = integrator.integrateStrongPeak(params, q, inti, sigi); - shapeLibrary.push_back(result); + shapeLibrary.emplace_back(result); auto &peak = peak_ws->getPeak(index); peak.setIntensity(inti); @@ -549,7 +549,7 @@ void IntegrateEllipsoidsTwoStep::calculateE1( V3D E1 = V3D(-std::sin(tt1) * std::cos(ph1), -std::sin(tt1) * std::sin(ph1), 1. - std::cos(tt1)); // end of trajectory E1 = E1 * (1. / E1.norm()); // normalize - E1Vec.push_back(E1); + E1Vec.emplace_back(E1); } } diff --git a/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp b/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp index 313431106a685dc24956ea846cfd1161c2365198..0aebc019e8b616a63f410ff970c3682aa2d47d9e 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp @@ -379,7 +379,7 @@ std::vector<detid_t> IntegratePeaksCWSD::processMaskWorkspace( if (vecY[0] > 0.1) { // vecY[] > 0 is masked. det->isMasked() may not be reliable. const detid_t detid = specInfo.detector(iws).getID(); - vecMaskedDetID.push_back(detid); + vecMaskedDetID.emplace_back(detid); } } diff --git a/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp b/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp index be5764b7b1816f3265d179557501493cca0e5a66..8fbe7f6137e64b8eacd137d64df582da057d3887 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp @@ -494,7 +494,7 @@ void IntegratePeaksMD::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) { findpeaks->setProperty<bool>("HighBackground", true); findpeaks->setProperty<bool>("RawPeakParameters", true); std::vector<double> peakPosToFit; - peakPosToFit.push_back(static_cast<double>(numSteps) / 2.0); + peakPosToFit.emplace_back(static_cast<double>(numSteps) / 2.0); findpeaks->setProperty("PeakPositions", peakPosToFit); findpeaks->setProperty<int>("MinGuessedPeakWidth", 4); findpeaks->setProperty<int>("MaxGuessedPeakWidth", 4); @@ -527,7 +527,7 @@ void IntegratePeaksMD::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) { // paramsName[j].erase(0,3) <<"="<<parvalue; if (j > 0 && j < numcols - 1) fun_str << "," << paramsName[j] << "=" << parvalue; - paramsValue.push_back(parvalue); + paramsValue.emplace_back(parvalue); } if (i == 0) { for (size_t j = 0; j < numcols; ++j) diff --git a/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index 3a540df5b6176c1f4147f774f625feb1a411bab3..915edea01a3a330104e32efb4089da0a1fb7fb20 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -693,7 +693,7 @@ void IntegratePeaksMD2::calculateE1( V3D E1 = V3D(-std::sin(tt1) * std::cos(ph1), -std::sin(tt1) * std::sin(ph1), 1. - std::cos(tt1)); // end of trajectory E1 = E1 * (1. / E1.norm()); // normalize - E1Vec.push_back(E1); + E1Vec.emplace_back(E1); } } diff --git a/Framework/MDAlgorithms/src/IntegratePeaksMDHKL.cpp b/Framework/MDAlgorithms/src/IntegratePeaksMDHKL.cpp index 7af6eb75c617b8e75a7912102e5d5d4719de6d7d..6fd540708d198edcaedb9715c805f5bd164261fa 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksMDHKL.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksMDHKL.cpp @@ -209,7 +209,7 @@ void IntegratePeaksMDHKL::integratePeak(const int neighborPts, BackgroundInnerRadius2 = pow(BackgroundInnerRadius2, 2.0); const size_t dimensionality = out->getNumDims(); for (size_t i = 0; i < dimensionality; ++i) { - gridPts.push_back(static_cast<int>(out->getDimension(i)->getNBins())); + gridPts.emplace_back(static_cast<int>(out->getDimension(i)->getNBins())); } double *F = out->getSignalArray(); diff --git a/Framework/MDAlgorithms/src/LoadDNSSCD.cpp b/Framework/MDAlgorithms/src/LoadDNSSCD.cpp index 61f6613be1a07d16662dd5a3d2ae14b56fadbedc..cfecfb07e7832f43e41e39a787e1884b251a04df 100644 --- a/Framework/MDAlgorithms/src/LoadDNSSCD.cpp +++ b/Framework/MDAlgorithms/src/LoadDNSSCD.cpp @@ -251,7 +251,7 @@ void LoadDNSSCD::loadHuber(ITableWorkspace_sptr tws) { for (size_t i = 1; i < huber.size(); ++i) { for (auto &ds : old) { ds.huber = huber[i]; - m_data.push_back(ds); + m_data.emplace_back(ds); } } } @@ -886,18 +886,18 @@ void LoadDNSSCD::read_data(const std::string fname, boost::trim(line); const int cols = splitIntoColumns(columns, line); if (cols > 0) { - ds.detID.push_back(std::stoi(columns.front())); + ds.detID.emplace_back(std::stoi(columns.front())); columns.pop_front(); std::vector<double> signal; std::transform(columns.begin(), columns.end(), std::back_inserter(signal), [](const std::string &s) { return std::stod(s); }); - ds.signal.push_back(signal); + ds.signal.emplace_back(signal); } } // DNS PA detector bank has only 24 detectors ds.detID.resize(24); ds.signal.resize(24); - m_data.push_back(ds); + m_data.emplace_back(ds); } } // namespace MDAlgorithms diff --git a/Framework/MDAlgorithms/src/LoadMD.cpp b/Framework/MDAlgorithms/src/LoadMD.cpp index 2965f1f952545c2d301d08c36ba97d0dc38829be..945294a548519a320713fb1ef734b892c41ddbe6 100644 --- a/Framework/MDAlgorithms/src/LoadMD.cpp +++ b/Framework/MDAlgorithms/src/LoadMD.cpp @@ -386,7 +386,7 @@ void LoadMD::loadDimensions() { std::string dimXML; m_file->getAttr(mess.str(), dimXML); // Use the dimension factory to read the XML - m_dims.push_back(createDimension(dimXML)); + m_dims.emplace_back(createDimension(dimXML)); } // Since this is an old algorithm we will // have to provide an MDFrame correction @@ -430,7 +430,7 @@ void LoadMD::loadDimensions2() { MDFrameArgument(frame, units)); m_file->getData(axis); m_file->closeData(); - m_dims.push_back(boost::make_shared<MDHistoDimension>( + m_dims.emplace_back(boost::make_shared<MDHistoDimension>( long_name, splitAxes[d - 1], *mdFrame, static_cast<coord_t>(axis.front()), static_cast<coord_t>(axis.back()), axis.size() - 1)); diff --git a/Framework/MDAlgorithms/src/MDNorm.cpp b/Framework/MDAlgorithms/src/MDNorm.cpp index 5731f471b5b6248fa2a65a2ecbe8fe05e1193abb..7ad0ed6c7944c4772530bd3a54edfea0bdc4065d 100644 --- a/Framework/MDAlgorithms/src/MDNorm.cpp +++ b/Framework/MDAlgorithms/src/MDNorm.cpp @@ -301,11 +301,11 @@ std::map<std::string, std::string> MDNorm::validateInputs() { // check dimension names std::vector<std::string> originalDimensionNames; for (size_t i = 3; i < inputWS->getNumDims(); i++) { - originalDimensionNames.push_back(inputWS->getDimension(i)->getName()); + originalDimensionNames.emplace_back(inputWS->getDimension(i)->getName()); } - originalDimensionNames.push_back("QDimension0"); - originalDimensionNames.push_back("QDimension1"); - originalDimensionNames.push_back("QDimension2"); + originalDimensionNames.emplace_back("QDimension0"); + originalDimensionNames.emplace_back("QDimension1"); + originalDimensionNames.emplace_back("QDimension2"); std::vector<std::string> selectedDimensions; for (std::size_t i = 0; i < 6; i++) { std::string propName = "Dimension" + Strings::toString(i) + "Name"; @@ -326,7 +326,7 @@ std::map<std::string, std::string> MDNorm::validateInputs() { auto itSel = std::find(selectedDimensions.begin(), selectedDimensions.end(), dimName); if (itSel == selectedDimensions.end()) { - selectedDimensions.push_back(dimName); + selectedDimensions.emplace_back(dimName); } else { errorMessage.emplace(propName, "Name '" + dimName + "' was already selected"); @@ -570,11 +570,11 @@ std::map<std::string, std::string> MDNorm::getBinParameters() { std::stringstream extents; std::stringstream bins; std::vector<std::string> originalDimensionNames; - originalDimensionNames.push_back("QDimension0"); - originalDimensionNames.push_back("QDimension1"); - originalDimensionNames.push_back("QDimension2"); + originalDimensionNames.emplace_back("QDimension0"); + originalDimensionNames.emplace_back("QDimension1"); + originalDimensionNames.emplace_back("QDimension2"); for (size_t i = 3; i < m_inputWS->getNumDims(); i++) { - originalDimensionNames.push_back(m_inputWS->getDimension(i)->getName()); + originalDimensionNames.emplace_back(m_inputWS->getDimension(i)->getName()); } if (m_isRLU) { @@ -652,10 +652,10 @@ std::map<std::string, std::string> MDNorm::getBinParameters() { for (size_t j = 0; j < originalDimensionNames.size(); j++) { if (j == static_cast<size_t>(dimIndex)) { propertyValue << ",1"; - transformation.push_back(1.); + transformation.emplace_back(1.); } else { propertyValue << ",0"; - transformation.push_back(0.); + transformation.emplace_back(0.); } } parameters.emplace(property, propertyValue.str()); @@ -892,7 +892,7 @@ void MDNorm::validateBinningForTemporaryDataWorkspace( } } else if ((key != "OutputBins") && (key != "OutputExtents")) { - nonDimensionIndex.push_back(parametersIndex); + nonDimensionIndex.emplace_back(parametersIndex); } parametersIndex++; } @@ -977,7 +977,7 @@ MDNorm::binInputWS(std::vector<Geometry::SymmetryOperation> symmetryOps) { projection[0] = 1.; basisVector << QDimensionNameQSample(0) << ",A^{-1}"; } else { - qDimensionIndices.push_back(qindex); + qDimensionIndices.emplace_back(qindex); projection[0] = Qtransform[0][0]; projection[1] = Qtransform[1][0]; projection[2] = Qtransform[2][0]; @@ -989,7 +989,7 @@ MDNorm::binInputWS(std::vector<Geometry::SymmetryOperation> symmetryOps) { projection[1] = 1.; basisVector << QDimensionNameQSample(1) << ",A^{-1}"; } else { - qDimensionIndices.push_back(qindex); + qDimensionIndices.emplace_back(qindex); projection[0] = Qtransform[0][1]; projection[1] = Qtransform[1][1]; projection[2] = Qtransform[2][1]; @@ -1001,7 +1001,7 @@ MDNorm::binInputWS(std::vector<Geometry::SymmetryOperation> symmetryOps) { projection[2] = 1.; basisVector << QDimensionNameQSample(2) << ",A^{-1}"; } else { - qDimensionIndices.push_back(qindex); + qDimensionIndices.emplace_back(qindex); projection[0] = Qtransform[0][2]; projection[1] = Qtransform[1][2]; projection[2] = Qtransform[2][2]; @@ -1088,7 +1088,7 @@ MDNorm::getValuesFromOtherDimensions(bool &skipNormalization, } else { coord_t value = static_cast<coord_t>(currentRun.getLogAsSingleValue( dimension->getName(), Mantid::Kernel::Math::TimeAveragedMean)); - otherDimValues.push_back(value); + otherDimValues.emplace_back(value); if (value < inputDimMin || value > inputDimMax) { skipNormalization = true; } diff --git a/Framework/MDAlgorithms/src/MDNormDirectSC.cpp b/Framework/MDAlgorithms/src/MDNormDirectSC.cpp index 9b81661da918a53f13cad56bc97610b5a67a327d..66c8a85fd78cd0e50ebab41a6765094d2ad01b3d 100644 --- a/Framework/MDAlgorithms/src/MDNormDirectSC.cpp +++ b/Framework/MDAlgorithms/src/MDNormDirectSC.cpp @@ -324,7 +324,7 @@ MDNormDirectSC::getValuesFromOtherDimensions(bool &skipNormalization, currentRun.getProperty(dimension->getName())); if (dimProp) { auto value = static_cast<coord_t>(dimProp->firstValue()); - otherDimValues.push_back(value); + otherDimValues.emplace_back(value); // in the original MD data no time was spent measuring between dimMin and // dimMax if (value < dimMin || value > dimMax) { @@ -531,7 +531,7 @@ for (int64_t i = 0; i < ndets; i++) { // pre-allocate for efficiency and copy non-hkl dim values into place pos.resize(vmdDims + otherValues.size() + 1); std::copy(otherValues.begin(), otherValues.end(), pos.begin() + vmdDims); - pos.push_back(1.); + pos.emplace_back(1.); auto intersectionsBegin = intersections.begin(); for (auto it = intersectionsBegin + 1; it != intersections.end(); ++it) { const auto &curIntSec = *it; diff --git a/Framework/MDAlgorithms/src/MDNormSCD.cpp b/Framework/MDAlgorithms/src/MDNormSCD.cpp index 46c016510a6836894175aa50fed8f342f2704aa1..62829b6cfc5359d76a5f2414f8874e169361431c 100644 --- a/Framework/MDAlgorithms/src/MDNormSCD.cpp +++ b/Framework/MDAlgorithms/src/MDNormSCD.cpp @@ -298,7 +298,7 @@ MDNormSCD::getValuesFromOtherDimensions(bool &skipNormalization, currentRun.getProperty(dimension->getName())); if (dimProp) { auto value = static_cast<coord_t>(dimProp->firstValue()); - otherDimValues.push_back(value); + otherDimValues.emplace_back(value); // in the original MD data no time was spent measuring between dimMin and // dimMax if (value < dimMin || value > dimMax) { @@ -495,7 +495,7 @@ for (int64_t i = 0; i < ndets; i++) { // pre-allocate for efficiency and copy non-hkl dim values into place pos.resize(vmdDims + otherValues.size()); std::copy(otherValues.begin(), otherValues.end(), pos.begin() + vmdDims - 1); - pos.push_back(1.); + pos.emplace_back(1.); for (auto it = intersectionsBegin + 1; it != intersections.end(); ++it) { const auto &curIntSec = *it; diff --git a/Framework/MDAlgorithms/src/MDWSTransform.cpp b/Framework/MDAlgorithms/src/MDWSTransform.cpp index 360e362b4ba52b89bb02cfa49c4e52404d511462..c9301b47d56ffdcd85c174b766a0b26db6e574fc 100644 --- a/Framework/MDAlgorithms/src/MDWSTransform.cpp +++ b/Framework/MDAlgorithms/src/MDWSTransform.cpp @@ -389,11 +389,11 @@ void MDWSTransform::setQ3DDimensionsNames( std::vector<double> len; Kernel::V3D x; x = Bm * dimDirections[0]; - len.push_back(2 * M_PI * x.norm()); + len.emplace_back(2 * M_PI * x.norm()); x = Bm * dimDirections[1]; - len.push_back(2 * M_PI * x.norm()); + len.emplace_back(2 * M_PI * x.norm()); x = Bm * dimDirections[2]; - len.push_back(2 * M_PI * x.norm()); + len.emplace_back(2 * M_PI * x.norm()); for (int i = 0; i < 3; i++) TargWSDescription.setDimUnit( i, "in " + MDAlgorithms::sprintfd(len[i], 1.e-3) + " A^-1"); diff --git a/Framework/MDAlgorithms/src/MergeMD.cpp b/Framework/MDAlgorithms/src/MergeMD.cpp index 667b10f5fa9825f0afc6882a7f296972368d71f6..df05e02041b66616b8879943b88989d9c63f6350 100644 --- a/Framework/MDAlgorithms/src/MergeMD.cpp +++ b/Framework/MDAlgorithms/src/MergeMD.cpp @@ -66,7 +66,7 @@ void MergeMD::createOutputWorkspace(std::vector<std::string> &inputs) { "Workspace " + *it + " is not a MDEventWorkspace. Cannot merge this workspace."); else - m_workspaces.push_back(ws); + m_workspaces.emplace_back(ws); } if (m_workspaces.empty()) throw std::invalid_argument("No valid m_workspaces specified."); @@ -151,7 +151,7 @@ void MergeMD::createOutputWorkspace(std::vector<std::string> &inputs) { for (uint16_t i = 0; i < nExperiments; i++) { uint16_t nWSexperiments = m_workspaces[i]->getNumExperimentInfo(); - experimentInfoNo.push_back(nWSexperiments); + experimentInfoNo.emplace_back(nWSexperiments); for (uint16_t j = 0; j < nWSexperiments; j++) { API::ExperimentInfo_sptr ei = API::ExperimentInfo_sptr( m_workspaces[i]->getExperimentInfo(j)->cloneExperimentInfo()); @@ -295,7 +295,7 @@ void MergeMD::exec() { inputs.insert(inputs.end(), group.begin(), group.end()); } else { // Single workspace - inputs.push_back(input); + inputs.emplace_back(input); } } diff --git a/Framework/MDAlgorithms/src/MinusMD.cpp b/Framework/MDAlgorithms/src/MinusMD.cpp index e0fc893ef0d3da27c77214cab32c0f85f9e3caf0..bd8f14b6f8a5328f37adda8f765c728c83a075a4 100644 --- a/Framework/MDAlgorithms/src/MinusMD.cpp +++ b/Framework/MDAlgorithms/src/MinusMD.cpp @@ -86,7 +86,7 @@ void MinusMD::doMinus(typename MDEventWorkspace<MDE, nd>::sptr ws1) { for (auto it = events.begin(); it != events.end(); it++) { MDE eventCopy(*it); eventCopy.setSignal(-eventCopy.getSignal()); - eventsCopy.push_back(eventCopy); + eventsCopy.emplace_back(eventCopy); } // Add events, with bounds checking box1->addEvents(eventsCopy); diff --git a/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp b/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp index d5b287eb611045f9e4ddb865eeecb649fb1611fa..1f06a5d5ff66037762a5919c3ecfbe2c3a3815b3 100644 --- a/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp @@ -88,9 +88,9 @@ void QueryMDWorkspace::init() { "LimitRows", IS_DEFAULT)); std::vector<std::string> propOptions; - propOptions.push_back(noNormalisationOption()); - propOptions.push_back(volumeNormalisationOption()); - propOptions.push_back(numberOfEventsNormalisationOption()); + propOptions.emplace_back(noNormalisationOption()); + propOptions.emplace_back(volumeNormalisationOption()); + propOptions.emplace_back(numberOfEventsNormalisationOption()); declareProperty("Normalisation", "none", boost::make_shared<StringListValidator>(propOptions), diff --git a/Framework/MDAlgorithms/src/ReplicateMD.cpp b/Framework/MDAlgorithms/src/ReplicateMD.cpp index 14243136bd881b798484613936a398fcb8b69f17..61baa812ae2e74c1d56118fc4bcff508a4e0d9ea 100644 --- a/Framework/MDAlgorithms/src/ReplicateMD.cpp +++ b/Framework/MDAlgorithms/src/ReplicateMD.cpp @@ -86,7 +86,7 @@ std::vector<int> findAxes(const IMDHistoWorkspace &shapeWS, if (!dataDim->getIsIntegrated()) { auto index = static_cast<int>( shapeWS.getDimensionIndexById(dataDim->getDimensionId())); - axes.push_back(index); + axes.emplace_back(index); } } return axes; diff --git a/Framework/MDAlgorithms/src/SaveIsawQvector.cpp b/Framework/MDAlgorithms/src/SaveIsawQvector.cpp index b2cd3d1ceaf2bfef56ba0c09667712bbda916ece..15f5a8b4e568ade2a4434ee1107eb2627ed4d6a8 100644 --- a/Framework/MDAlgorithms/src/SaveIsawQvector.cpp +++ b/Framework/MDAlgorithms/src/SaveIsawQvector.cpp @@ -171,9 +171,9 @@ void SaveIsawQvector::exec() { static_cast<float>(coord_signs[dim] * locCoord[coord_map[dim]]); } if (filename.empty()) { - Qx_save.push_back(static_cast<double>(buffer[0])); - Qy_save.push_back(static_cast<double>(buffer[1])); - Qz_save.push_back(static_cast<double>(buffer[2])); + Qx_save.emplace_back(static_cast<double>(buffer[0])); + Qy_save.emplace_back(static_cast<double>(buffer[1])); + Qz_save.emplace_back(static_cast<double>(buffer[2])); } else handle.write(reinterpret_cast<char *>(buffer), BUFF_SIZE); } // end of loop over events in list diff --git a/Framework/MDAlgorithms/src/SaveMD2.cpp b/Framework/MDAlgorithms/src/SaveMD2.cpp index f96de0cb075b725d49337fa13cffd1fdb17fb79e..48cee033ed8ec509983566c864eec82fd72c2eea 100644 --- a/Framework/MDAlgorithms/src/SaveMD2.cpp +++ b/Framework/MDAlgorithms/src/SaveMD2.cpp @@ -161,7 +161,7 @@ void SaveMD2::doSaveHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) { IMDDimension_const_sptr dim = ws->getDimension(d); auto nbounds = dim->getNBoundaries(); for (size_t n = 0; n < nbounds; n++) - axis.push_back(dim->getX(n)); + axis.emplace_back(dim->getX(n)); file->makeData(dim->getDimensionId(), ::NeXus::FLOAT64, static_cast<int>(dim->getNBoundaries()), true); file->putData(&axis[0]); diff --git a/Framework/MDAlgorithms/src/SaveZODS.cpp b/Framework/MDAlgorithms/src/SaveZODS.cpp index a821ec0c55f44943b3424e90a26a7ecf45c33973..80068a0360fe7ff8f9cc8262c6589fdb0c21d42c 100644 --- a/Framework/MDAlgorithms/src/SaveZODS.cpp +++ b/Framework/MDAlgorithms/src/SaveZODS.cpp @@ -78,12 +78,12 @@ void SaveZODS::exec() { if (ei->sample().hasOrientedLattice()) { std::vector<double> unitCell; const OrientedLattice &latt = ei->sample().getOrientedLattice(); - unitCell.push_back(latt.a()); - unitCell.push_back(latt.b()); - unitCell.push_back(latt.c()); - unitCell.push_back(latt.alpha()); - unitCell.push_back(latt.beta()); - unitCell.push_back(latt.gamma()); + unitCell.emplace_back(latt.a()); + unitCell.emplace_back(latt.b()); + unitCell.emplace_back(latt.c()); + unitCell.emplace_back(latt.alpha()); + unitCell.emplace_back(latt.beta()); + unitCell.emplace_back(latt.gamma()); // Now write out the 6D vector std::vector<int> unit_cell_size(1, 6); @@ -133,7 +133,7 @@ void SaveZODS::exec() { for (int j = 0; j < size_field[1]; j++) for (int k = 0; k < size_field[2]; k++) { int l = i + size_field[0] * j + size_field[0] * size_field[1] * k; - data.push_back(signal[l]); + data.emplace_back(signal[l]); } file->writeData("Data", data, size); @@ -146,7 +146,7 @@ void SaveZODS::exec() { for (int j = 0; j < size_field[1]; j++) for (int k = 0; k < size_field[2]; k++) { int l = i + size_field[0] * j + size_field[0] * size_field[1] * k; - sigma.push_back(sqrt(errorSquared[l])); + sigma.emplace_back(sqrt(errorSquared[l])); } file->writeData("sigma", sigma, size); diff --git a/Framework/MDAlgorithms/src/SetMDFrame.cpp b/Framework/MDAlgorithms/src/SetMDFrame.cpp index be4d4cb6090b49ece2344bae0b195df0c5c1b606..33d34669d1a9a754ac922e7b1073f4a304acfef0 100644 --- a/Framework/MDAlgorithms/src/SetMDFrame.cpp +++ b/Framework/MDAlgorithms/src/SetMDFrame.cpp @@ -69,11 +69,11 @@ void SetMDFrame::init() { // Options for the MDFrames std::vector<std::string> mdFrames; - mdFrames.push_back(Mantid::Geometry::GeneralFrame::GeneralFrameName); - mdFrames.push_back(Mantid::Geometry::QSample::QSampleName); - mdFrames.push_back(Mantid::Geometry::QLab::QLabName); - mdFrames.push_back(Mantid::Geometry::HKL::HKLName); - mdFrames.push_back(Mantid::Geometry::UnknownFrame::UnknownFrameName); + mdFrames.emplace_back(Mantid::Geometry::GeneralFrame::GeneralFrameName); + mdFrames.emplace_back(Mantid::Geometry::QSample::QSampleName); + mdFrames.emplace_back(Mantid::Geometry::QLab::QLabName); + mdFrames.emplace_back(Mantid::Geometry::HKL::HKLName); + mdFrames.emplace_back(Mantid::Geometry::UnknownFrame::UnknownFrameName); // Create a selection of MDFrames and units for each dimension std::string propName = mdFrameSpecifier; diff --git a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp index a6439106d66b664894e7895799ba9f13e911628c..59d96842a35349e114138b9daf03aa0eda98791c 100644 --- a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp +++ b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp @@ -268,10 +268,10 @@ void SlicingAlgorithm::makeBasisVectorFromString(const std::string &str) { numBins); // Put both in the algo for future use - m_bases.push_back(basis); - m_binDimensions.push_back(std::move(out)); - m_binningScaling.push_back(binningScaling); - m_transformScaling.push_back(transformScaling); + m_bases.emplace_back(basis); + m_binDimensions.emplace_back(std::move(out)); + m_binningScaling.emplace_back(binningScaling); + m_transformScaling.emplace_back(transformScaling); } //---------------------------------------------------------------------------------------------- @@ -302,8 +302,8 @@ void SlicingAlgorithm::processGeneralTransformProperties() { m_minExtents.clear(); m_maxExtents.clear(); for (size_t d = 0; d < m_outD; d++) { - m_minExtents.push_back(extents[d * 2]); - m_maxExtents.push_back(extents[d * 2 + 1]); + m_minExtents.emplace_back(extents[d * 2]); + m_maxExtents.emplace_back(extents[d * 2 + 1]); } m_numBins = this->getProperty("OutputBins"); @@ -519,12 +519,12 @@ void SlicingAlgorithm::makeAlignedDimensionFromString(const std::string &str) { // Copy the dimension name, ID and units IMDDimension_const_sptr inputDim = m_inWS->getDimension(dim_index); const auto &frame = inputDim->getMDFrame(); - m_binDimensions.push_back(MDHistoDimension_sptr( + m_binDimensions.emplace_back(MDHistoDimension_sptr( new MDHistoDimension(inputDim->getName(), inputDim->getDimensionId(), frame, min, max, numBins))); // Add the index from which we're binning to the vector - this->m_dimensionToBinFrom.push_back(dim_index); + this->m_dimensionToBinFrom.emplace_back(dim_index); } } //---------------------------------------------------------------------------------------------- @@ -582,7 +582,7 @@ void SlicingAlgorithm::createAlignedTransform() { // Create a unit basis vector that corresponds to this VMD basis(inD); basis[m_dimensionToBinFrom[d]] = 1.0; - m_bases.push_back(basis); + m_bases.emplace_back(basis); } // Transform for binning @@ -783,7 +783,7 @@ SlicingAlgorithm::getGeneralImplicitFunction(const size_t *const chunkMin, o2 += (m_bases[d] * xMax); VMD thisBase = m_bases[d] * (xMax - xMin); - bases.push_back(thisBase); + bases.emplace_back(thisBase); if (d == 0) x = thisBase; } @@ -819,13 +819,13 @@ SlicingAlgorithm::getGeneralImplicitFunction(const size_t *const chunkMin, // Create a list of vectors that excludes the "current" basis for (size_t baseIndex = 0; baseIndex < boxDim; ++baseIndex) { if (baseIndex != ignoreIndex) - vectors.push_back(bases[baseIndex]); + vectors.emplace_back(bases[baseIndex]); } // if we have fewer basis vectors than dimensions // create a normal for the final dimension if (boxDim == nd - 1) - vectors.push_back(VMD::getNormalVector(bases)); + vectors.emplace_back(VMD::getNormalVector(bases)); // Add two planes for each set of vectors func->addPlane(MDPlane(vectors, o1, insidePoint)); @@ -918,7 +918,7 @@ SlicingAlgorithm::getOldBasis(size_t dimension) const { for (size_t i = 0; i < dimension; ++i) { Mantid::Kernel::VMD basisVector(dimension); basisVector[i] = 1.0; - oldBasis.push_back(basisVector); + oldBasis.emplace_back(basisVector); } return oldBasis; } @@ -947,7 +947,7 @@ std::vector<size_t> SlicingAlgorithm::getIndicesWithProjection( std::vector<size_t> indexWithProjection; for (size_t index = 0; index < oldBasis.size(); ++index) { if (isProjectingOnFrame(oldBasis[index], basisVector)) { - indexWithProjection.push_back(index); + indexWithProjection.emplace_back(index); } } return indexWithProjection; diff --git a/Framework/MDAlgorithms/src/SmoothMD.cpp b/Framework/MDAlgorithms/src/SmoothMD.cpp index 6977f65fa1e4a50e017522daa105de935b352555..5fcd208b7eb1d66a74a061df4338deb2f8a73fee 100644 --- a/Framework/MDAlgorithms/src/SmoothMD.cpp +++ b/Framework/MDAlgorithms/src/SmoothMD.cpp @@ -93,7 +93,7 @@ KernelVector gaussianKernel(const double fwhm) { double pixel_value = std::erf(0.5 * sigma_factor) * sigma; int pixel_count = 0; while (pixel_value > 0.02) { - kernel_one_side.push_back(pixel_value); + kernel_one_side.emplace_back(pixel_value); pixel_count++; pixel_value = (std::erf((pixel_count + 0.5) * sigma_factor) - std::erf((pixel_count - 0.5) * sigma_factor)) * diff --git a/Framework/MDAlgorithms/src/ThresholdMD.cpp b/Framework/MDAlgorithms/src/ThresholdMD.cpp index 1c82eef98a44be034ebf835aa366ab92328d6791..00584f9711b84b0b476a8d79677cdbec10b49fe3 100644 --- a/Framework/MDAlgorithms/src/ThresholdMD.cpp +++ b/Framework/MDAlgorithms/src/ThresholdMD.cpp @@ -51,8 +51,8 @@ void ThresholdMD::init() { "An input workspace."); std::vector<std::string> propOptions; - propOptions.push_back(LessThan()); - propOptions.push_back(GreaterThan()); + propOptions.emplace_back(LessThan()); + propOptions.emplace_back(GreaterThan()); declareProperty("Condition", LessThan(), boost::make_shared<StringListValidator>(propOptions), diff --git a/Framework/MDAlgorithms/src/TransformMD.cpp b/Framework/MDAlgorithms/src/TransformMD.cpp index 7a2e42486b16eeb8d0197feb62eb576e1fc06e72..e4829cc65e76da6bf26b9f662b8ca0ab8076f0df 100644 --- a/Framework/MDAlgorithms/src/TransformMD.cpp +++ b/Framework/MDAlgorithms/src/TransformMD.cpp @@ -218,10 +218,10 @@ void TransformMD::exec() { for (size_t d = 0; d < nd; d++) { Geometry::IMDDimension_const_sptr dim = event->getDimension(d); // Find the extents - extents.push_back(dim->getMinimum()); - extents.push_back(dim->getMaximum()); - names.push_back(std::string(dim->getName())); - units.push_back(dim->getUnits()); + extents.emplace_back(dim->getMinimum()); + extents.emplace_back(dim->getMaximum()); + names.emplace_back(std::string(dim->getName())); + units.emplace_back(dim->getUnits()); } Algorithm_sptr create_alg = createChildAlgorithm("CreateMDWorkspace"); create_alg->setProperty("Dimensions", static_cast<int>(nd)); @@ -238,7 +238,7 @@ void TransformMD::exec() { Mantid::API::BoxController_sptr boxController = event->getBoxController(); std::vector<int> splits; for (size_t d = 0; d < nd; d++) { - splits.push_back(static_cast<int>(boxController->getSplitInto(d))); + splits.emplace_back(static_cast<int>(boxController->getSplitInto(d))); } Algorithm_sptr merge_alg = createChildAlgorithm("MergeMD"); merge_alg->setPropertyValue("InputWorkspaces", outName + ",__none"); diff --git a/Framework/MDAlgorithms/src/TransposeMD.cpp b/Framework/MDAlgorithms/src/TransposeMD.cpp index 3906bff23ca2fc0d96db9a050648c1d62c05546d..6a47c554ad35d23a1ecdfede5bedfad793955100 100644 --- a/Framework/MDAlgorithms/src/TransposeMD.cpp +++ b/Framework/MDAlgorithms/src/TransposeMD.cpp @@ -110,7 +110,7 @@ void TransposeMD::exec() { // Clone the dimension corresponding to the axis requested. auto cloneDim = Geometry::IMDDimension_sptr( new Geometry::MDHistoDimension(inWS->getDimension(axes[i]).get())); - targetGeometry.push_back(cloneDim); + targetGeometry.emplace_back(cloneDim); } // Make the output workspace in the right shape. diff --git a/Framework/MDAlgorithms/test/FitMDTest.h b/Framework/MDAlgorithms/test/FitMDTest.h index a743cbb5d03da0541e6d89978a20e5b7787bd95e..d8704d341f15a43c554af12e2d3ed25f24a274dd 100644 --- a/Framework/MDAlgorithms/test/FitMDTest.h +++ b/Framework/MDAlgorithms/test/FitMDTest.h @@ -84,7 +84,7 @@ public: std::vector<std::unique_ptr<IMDIterator>> ret; auto ptr = std::unique_ptr<IMDIterator>{ std::make_unique<IMDWorkspaceTesterIterator>(this)}; - ret.push_back(std::move(ptr)); + ret.emplace_back(std::move(ptr)); return ret; } }; diff --git a/Framework/MDAlgorithms/test/Integrate3DEventsTest.h b/Framework/MDAlgorithms/test/Integrate3DEventsTest.h index 5e289b8439af2cd8662116a7cbad6a07e5366a99..d74188d3dc3432dba901bf7d83f5ff6da70ba902 100644 --- a/Framework/MDAlgorithms/test/Integrate3DEventsTest.h +++ b/Framework/MDAlgorithms/test/Integrate3DEventsTest.h @@ -56,37 +56,37 @@ public: // peak 3. std::vector<std::pair<double, V3D>> event_Qs; for (int i = -100; i <= 100; i++) { - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D((double)i / 100.0, 0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D((double)i / 100.0, 0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_3 + V3D((double)i / 100.0, 0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, (double)i / 200.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D(0, (double)i / 200.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_3 + V3D(0, (double)i / 200.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, 0, (double)i / 300.0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D(0, 0, (double)i / 300.0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_3 + V3D(0, 0, (double)i / 300.0)))); } for (int i = -50; i <= 50; i++) { - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, (double)i / 147.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D(0, (double)i / 147.0, 0)))); } for (int i = -25; i <= 25; i++) { - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, 0, (double)i / 61.0)))); } @@ -169,37 +169,37 @@ public: // peak 3. std::vector<std::pair<double, V3D>> event_Qs; for (int i = -100; i <= 100; i++) { - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D((double)i / 100.0, 0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D((double)i / 100.0, 0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_3 + V3D((double)i / 100.0, 0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, (double)i / 200.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D(0, (double)i / 200.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_3 + V3D(0, (double)i / 200.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, 0, (double)i / 300.0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D(0, 0, (double)i / 300.0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_3 + V3D(0, 0, (double)i / 300.0)))); } for (int i = -50; i <= 50; i++) { - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, (double)i / 147.0, 0)))); - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_2 + V3D(0, (double)i / 147.0, 0)))); } for (int i = -25; i <= 25; i++) { - event_Qs.push_back( + event_Qs.emplace_back( std::make_pair(1., V3D(peak_1 + V3D(0, 0, (double)i / 61.0)))); } @@ -501,7 +501,7 @@ private: for (size_t i = 0; i < numSamples; ++i) { V3D offset(d(gen), d(gen), d(gen)); - event_Qs.push_back(std::make_pair(1., center + offset)); + event_Qs.emplace_back(std::make_pair(1., center + offset)); } } diff --git a/Framework/MDAlgorithms/test/IntegrateEllipsoidsTest.h b/Framework/MDAlgorithms/test/IntegrateEllipsoidsTest.h index f1886f0923599440093256caf299767536913750..ebb65b5cdac5305a6d62668280963b0de157546f 100644 --- a/Framework/MDAlgorithms/test/IntegrateEllipsoidsTest.h +++ b/Framework/MDAlgorithms/test/IntegrateEllipsoidsTest.h @@ -176,9 +176,9 @@ public: rebinAlg->initialize(); rebinAlg->setProperty("InputWorkspace", m_eventWS); auto params = std::vector<double>(); - params.push_back(950); - params.push_back(10); - params.push_back(2500); + params.emplace_back(950); + params.emplace_back(10); + params.emplace_back(2500); rebinAlg->setProperty("Params", params); rebinAlg->setProperty("PreserveEvents", false); // Make a histo workspace rebinAlg->setPropertyValue("OutputWorkspace", "dummy"); @@ -474,9 +474,9 @@ public: rebinAlg->initialize(); rebinAlg->setProperty("InputWorkspace", m_eventWS); auto params = std::vector<double>(); - params.push_back(950); - params.push_back(5); - params.push_back(2500); + params.emplace_back(950); + params.emplace_back(5); + params.emplace_back(2500); rebinAlg->setProperty("Params", params); rebinAlg->setProperty("PreserveEvents", false); // Make a histo workspace rebinAlg->setPropertyValue("OutputWorkspace", "dummy"); diff --git a/Framework/MDAlgorithms/test/IntegrateEllipsoidsWithSatellitesTest.h b/Framework/MDAlgorithms/test/IntegrateEllipsoidsWithSatellitesTest.h index 6e24f2b9ff8048bea348c2d4acbdd20536f32060..77edec9e4a5782199fc1ff5f895176f3f2b1759e 100644 --- a/Framework/MDAlgorithms/test/IntegrateEllipsoidsWithSatellitesTest.h +++ b/Framework/MDAlgorithms/test/IntegrateEllipsoidsWithSatellitesTest.h @@ -218,9 +218,9 @@ public: rebinAlg->initialize(); rebinAlg->setProperty("InputWorkspace", m_eventWS); auto params = std::vector<double>(); - params.push_back(950); - params.push_back(10); - params.push_back(2500); + params.emplace_back(950); + params.emplace_back(10); + params.emplace_back(2500); rebinAlg->setProperty("Params", params); rebinAlg->setProperty("PreserveEvents", false); // Make a histo workspace rebinAlg->setPropertyValue("OutputWorkspace", "dummy"); @@ -462,9 +462,9 @@ public: rebinAlg->initialize(); rebinAlg->setProperty("InputWorkspace", m_eventWS); auto params = std::vector<double>(); - params.push_back(950); - params.push_back(5); - params.push_back(2500); + params.emplace_back(950); + params.emplace_back(5); + params.emplace_back(2500); rebinAlg->setProperty("Params", params); rebinAlg->setProperty("PreserveEvents", false); // Make a histo workspace rebinAlg->setPropertyValue("OutputWorkspace", "dummy"); diff --git a/Framework/MDAlgorithms/test/IntegratePeaksCWSDTest.h b/Framework/MDAlgorithms/test/IntegratePeaksCWSDTest.h index 7920f4b02f5d3ab1c7e9d3d64201ba1befadf453..ad2c8b9a9a15f849d636b1cb9627289edf0b5ef5 100644 --- a/Framework/MDAlgorithms/test/IntegratePeaksCWSDTest.h +++ b/Framework/MDAlgorithms/test/IntegratePeaksCWSDTest.h @@ -199,10 +199,10 @@ void createMDEvents1Run(std::vector<Mantid::Kernel::V3D> &vec_qsample, Mantid::Kernel::V3D qsample(q_x, q_y, q_z); double signal = qsample.distance(origin) * 1000; - vec_qsample.push_back(qsample); - vec_signal.push_back(signal); - vec_detid.push_back(detid); - vec_runnumber.push_back(121); + vec_qsample.emplace_back(qsample); + vec_signal.emplace_back(signal); + vec_detid.emplace_back(detid); + vec_runnumber.emplace_back(121); ++detid; } @@ -240,10 +240,10 @@ void createMDEvents2Run(std::vector<Mantid::Kernel::V3D> &vec_qsample, Mantid::Kernel::V3D qsample(q_x, q_y, q_z); double signal = qsample.distance(origin) * 1000; - vec_qsample.push_back(qsample); - vec_signal.push_back(signal); - vec_detid.push_back(detid); - vec_runnumber.push_back(121); + vec_qsample.emplace_back(qsample); + vec_signal.emplace_back(signal); + vec_detid.emplace_back(detid); + vec_runnumber.emplace_back(121); ++detid; } @@ -266,10 +266,10 @@ void createMDEvents2Run(std::vector<Mantid::Kernel::V3D> &vec_qsample, Mantid::Kernel::V3D qsample(q_x, q_y, q_z); double signal = qsample.distance(origin) * 100; - vec_qsample.push_back(qsample); - vec_signal.push_back(signal); - vec_detid.push_back(detid); - vec_runnumber.push_back(144); + vec_qsample.emplace_back(qsample); + vec_signal.emplace_back(signal); + vec_detid.emplace_back(detid); + vec_runnumber.emplace_back(144); ++detid; } @@ -318,10 +318,10 @@ public: AnalysisDataService::Instance().addOrReplace("TestMDWS", inputws); std::vector<int> runnumberlist; - runnumberlist.push_back(vec_runnumbers[0]); + runnumberlist.emplace_back(vec_runnumbers[0]); Mantid::Kernel::V3D peakcenter(1.4, 2.4, 3.4); std::vector<Mantid::Kernel::V3D> peakcenterlist; - peakcenterlist.push_back(peakcenter); + peakcenterlist.emplace_back(peakcenter); PeaksWorkspace_sptr peakws = buildPeakWorkspace(runnumberlist, peakcenterlist); AnalysisDataService::Instance().addOrReplace("TestPeaksWS", peakws); @@ -369,12 +369,12 @@ public: TS_ASSERT(AnalysisDataService::Instance().doesExist("TestMDWS2")); std::vector<int> runnumberlist; - runnumberlist.push_back(vec_runnumbers.front()); - runnumberlist.push_back(vec_runnumbers.back()); + runnumberlist.emplace_back(vec_runnumbers.front()); + runnumberlist.emplace_back(vec_runnumbers.back()); Mantid::Kernel::V3D peakcenter(3, 3, 3); std::vector<Mantid::Kernel::V3D> peakcenterlist; - peakcenterlist.push_back(peakcenter); - peakcenterlist.push_back(peakcenter); + peakcenterlist.emplace_back(peakcenter); + peakcenterlist.emplace_back(peakcenter); PeaksWorkspace_sptr peakws = buildPeakWorkspace(runnumberlist, peakcenterlist); AnalysisDataService::Instance().addOrReplace("TestPeaksWS", peakws); @@ -473,12 +473,12 @@ public: createMDWorkspace(vec_qsample, vec_signal, vec_detid, vec_runnumbers); AnalysisDataService::Instance().addOrReplace("TestMDWS2", inputws); - runnumberlist.push_back(vec_runnumbers.front()); - runnumberlist.push_back(vec_runnumbers.back()); + runnumberlist.emplace_back(vec_runnumbers.front()); + runnumberlist.emplace_back(vec_runnumbers.back()); Mantid::Kernel::V3D peakcenter(3, 3, 3); std::vector<Mantid::Kernel::V3D> peakcenterlist; - peakcenterlist.push_back(peakcenter); - peakcenterlist.push_back(peakcenter); + peakcenterlist.emplace_back(peakcenter); + peakcenterlist.emplace_back(peakcenter); peakws = buildPeakWorkspace(runnumberlist, peakcenterlist); AnalysisDataService::Instance().addOrReplace("TestPeaksWS", peakws); diff --git a/Framework/MDAlgorithms/test/MergeMDFilesTest.h b/Framework/MDAlgorithms/test/MergeMDFilesTest.h index b3dfabb378d111e7f54143e8de990cc03ed2e419..774ace4b86124724a117b54d55209bf558818ab4 100644 --- a/Framework/MDAlgorithms/test/MergeMDFilesTest.h +++ b/Framework/MDAlgorithms/test/MergeMDFilesTest.h @@ -53,8 +53,8 @@ public: MDEventWorkspace3Lean::sptr ws = MDAlgorithmsTestHelper::makeFileBackedMDEWwithMDFrame( mess.str(), true, frame, -nFileEvents, appliedCoord); - inWorkspaces.push_back(ws); - filenames.push_back( + inWorkspaces.emplace_back(ws); + filenames.emplace_back( std::vector<std::string>(1, ws->getBoxController()->getFilename())); } diff --git a/Framework/MDAlgorithms/test/ReplicateMDTest.h b/Framework/MDAlgorithms/test/ReplicateMDTest.h index ef46a7622cfda382a63ffee69f8f87e6b44da391..22d1f516cfc2a5f481a404e84ec1274bd248e3ed 100644 --- a/Framework/MDAlgorithms/test/ReplicateMDTest.h +++ b/Framework/MDAlgorithms/test/ReplicateMDTest.h @@ -42,17 +42,17 @@ MDHistoWorkspace_sptr makeHistoWorkspace(const std::vector<int> &shape, std::vector<double> extents; for (size_t i = 0; i < shape.size(); ++i) { flatSize *= shape[i]; - names.push_back(allNames[i]); - units.push_back(allUnits[i]); - extents.push_back(-10); - extents.push_back(10); + names.emplace_back(allNames[i]); + units.emplace_back(allUnits[i]); + extents.emplace_back(-10); + extents.emplace_back(10); } if (value == 0.0) { std::vector<double> signalArray; signalArray.reserve(flatSize); for (size_t i = 0; i < flatSize; ++i) { - signalArray.push_back(static_cast<double>(i + 1)); + signalArray.emplace_back(static_cast<double>(i + 1)); } create->setProperty("SignalInput", signalArray); } else { @@ -122,19 +122,19 @@ public: void test_size_check_on_dimensionality() { std::vector<int> badDataShape; - badDataShape.push_back(3); - badDataShape.push_back(3); - badDataShape.push_back(3); // 3rd dimension given + badDataShape.emplace_back(3); + badDataShape.emplace_back(3); + badDataShape.emplace_back(3); // 3rd dimension given std::vector<int> goodDataShape; - goodDataShape.push_back(3); - goodDataShape.push_back(3); - goodDataShape.push_back(1); // Integrate so should be OK + goodDataShape.emplace_back(3); + goodDataShape.emplace_back(3); + goodDataShape.emplace_back(1); // Integrate so should be OK std::vector<int> shapeShape; - shapeShape.push_back(3); - shapeShape.push_back(3); - shapeShape.push_back(3); + shapeShape.emplace_back(3); + shapeShape.emplace_back(3); + shapeShape.emplace_back(3); auto dataWSGood = makeHistoWorkspace(goodDataShape); auto dataWSBad = makeHistoWorkspace(badDataShape); diff --git a/Framework/MDAlgorithms/test/SetMDFrameTest.h b/Framework/MDAlgorithms/test/SetMDFrameTest.h index 106fe2eede1ead12a2e3c66098aa1a2fb31bc41d..c3aa16842109e9052c855bca7d35594e3deb32ae 100644 --- a/Framework/MDAlgorithms/test/SetMDFrameTest.h +++ b/Framework/MDAlgorithms/test/SetMDFrameTest.h @@ -59,7 +59,7 @@ public: 1.0, 2, 10, 10.0, 1.0, "A"); std::vector<int> axes; - axes.push_back(1); + axes.emplace_back(1); SetMDFrame alg; alg.setChild(true); @@ -87,8 +87,8 @@ public: 1.0, 1, 10, 10.0, 1.0, "A"); std::vector<int> axes; - axes.push_back(0); - axes.push_back(7); + axes.emplace_back(0); + axes.emplace_back(7); SetMDFrame alg; alg.setChild(true); @@ -109,14 +109,16 @@ public: // Arrange const size_t numberOfDimensions = 2; std::vector<Mantid::Geometry::MDFrame_sptr> frames; - frames.push_back(std::make_shared<Mantid::Geometry::UnknownFrame>("test")); - frames.push_back(std::make_shared<Mantid::Geometry::UnknownFrame>("test")); + frames.emplace_back( + std::make_shared<Mantid::Geometry::UnknownFrame>("test")); + frames.emplace_back( + std::make_shared<Mantid::Geometry::UnknownFrame>("test")); auto inputWorkspace = Mantid::DataObjects::MDEventsTestHelper::makeMDEWWithIndividualFrames< numberOfDimensions>(5, -2, 2, frames, 3); std::vector<int> axes; - axes.push_back(0); + axes.emplace_back(0); // Act SetMDFrame alg; @@ -155,17 +157,17 @@ public: auto unit0 = unitFactory->create(unitString0); auto unit1 = unitFactory->create(unitString1); - frames.push_back( + frames.emplace_back( std::make_shared<Mantid::Geometry::UnknownFrame>(std::move(unit0))); - frames.push_back( + frames.emplace_back( std::make_shared<Mantid::Geometry::UnknownFrame>(std::move(unit1))); auto inputWorkspace = Mantid::DataObjects::MDEventsTestHelper::makeMDEWWithIndividualFrames< numberOfDimensions>(5, -2, 2, frames, 3); std::vector<int> axes; - axes.push_back(0); - axes.push_back(1); + axes.emplace_back(0); + axes.emplace_back(1); // Act SetMDFrame alg; @@ -208,16 +210,16 @@ public: auto unit0 = unitFactory->create(unitString0); auto unit1 = unitFactory->create(unitString1); - frames.push_back( + frames.emplace_back( std::make_shared<Mantid::Geometry::UnknownFrame>(std::move(unit0))); - frames.push_back( + frames.emplace_back( std::make_shared<Mantid::Geometry::UnknownFrame>(std::move(unit1))); auto inputWorkspace = Mantid::DataObjects::MDEventsTestHelper::makeMDEWWithIndividualFrames< numberOfDimensions>(5, -2, 2, frames, 3); std::vector<int> axes; - axes.push_back(1); + axes.emplace_back(1); // Act SetMDFrame alg; @@ -247,17 +249,17 @@ public: auto unit0 = unitFactory->create(unitString0); auto unit1 = unitFactory->create(unitString1); - frames.push_back( + frames.emplace_back( std::make_shared<Mantid::Geometry::UnknownFrame>(std::move(unit0))); - frames.push_back( + frames.emplace_back( std::make_shared<Mantid::Geometry::UnknownFrame>(std::move(unit1))); auto inputWorkspace = Mantid::DataObjects::MDEventsTestHelper::makeMDEWWithIndividualFrames< numberOfDimensions>(5, -2, 2, frames, 3); std::vector<int> axes; - axes.push_back(0); - axes.push_back(1); + axes.emplace_back(0); + axes.emplace_back(1); // Act SetMDFrame alg; diff --git a/Framework/MDAlgorithms/test/SliceMDTest.h b/Framework/MDAlgorithms/test/SliceMDTest.h index 6764c0e70a1637c9b3cf485b7a1094d97b04ad04..57c87baf5b252982894008e9a2829124651fb365 100644 --- a/Framework/MDAlgorithms/test/SliceMDTest.h +++ b/Framework/MDAlgorithms/test/SliceMDTest.h @@ -370,12 +370,12 @@ public: alg.setPropertyValue("Translation", origin.toString(","))); std::vector<double> OutputExtents; - OutputExtents.push_back(0); - OutputExtents.push_back(lengthX); - OutputExtents.push_back(0); - OutputExtents.push_back(lengthY); - OutputExtents.push_back(0); - OutputExtents.push_back(lengthZ); + OutputExtents.emplace_back(0); + OutputExtents.emplace_back(lengthX); + OutputExtents.emplace_back(0); + OutputExtents.emplace_back(lengthY); + OutputExtents.emplace_back(0); + OutputExtents.emplace_back(lengthZ); TS_ASSERT_THROWS_NOTHING(alg.setProperty("OutputExtents", OutputExtents)); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputBins", "3,3,3")); diff --git a/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h b/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h index 32c50fa7772ca938f94925486faf8d1b1c52b50d..788291556a1c2d4bb0ed981a55f04dca800f1baa 100644 --- a/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h +++ b/Framework/MDAlgorithms/test/SlicingAlgorithmTest.h @@ -73,10 +73,10 @@ public: qSampleFrame, 1); // Workspace with mixed frames std::vector<Mantid::Geometry::MDFrame_sptr> frames; - frames.push_back(std::make_shared<Mantid::Geometry::QSample>()); - frames.push_back(std::make_shared<Mantid::Geometry::QSample>()); - frames.push_back(std::make_shared<Mantid::Geometry::QSample>()); - frames.push_back(std::make_shared<Mantid::Geometry::GeneralFrame>( + frames.emplace_back(std::make_shared<Mantid::Geometry::QSample>()); + frames.emplace_back(std::make_shared<Mantid::Geometry::QSample>()); + frames.emplace_back(std::make_shared<Mantid::Geometry::QSample>()); + frames.emplace_back(std::make_shared<Mantid::Geometry::GeneralFrame>( Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "m")); wsMixedFrames = MDEventsTestHelper::makeMDEWWithIndividualFrames<4>( 5, 0.0, 10.0, frames, 1); @@ -372,9 +372,9 @@ public: alg.m_inWS = ws; TS_ASSERT_EQUALS(alg.m_bases.size(), 0); // Set up data that comes from other properties - alg.m_minExtents.push_back(-5.0); - alg.m_maxExtents.push_back(+5.0); - alg.m_numBins.push_back(20); + alg.m_minExtents.emplace_back(-5.0); + alg.m_maxExtents.emplace_back(+5.0); + alg.m_numBins.emplace_back(20); TSM_ASSERT_THROWS_ANYTHING("Blank name", alg.makeBasisVectorFromString(",units,1,2,3")); @@ -399,9 +399,9 @@ public: SlicingAlgorithmImpl alg; alg.m_inWS = ws; // Set up data that comes from other properties - alg.m_minExtents.push_back(-5.0); - alg.m_maxExtents.push_back(+5.0); - alg.m_numBins.push_back(20); + alg.m_minExtents.emplace_back(-5.0); + alg.m_maxExtents.emplace_back(+5.0); + alg.m_numBins.emplace_back(20); alg.m_NormalizeBasisVectors = (normalize > 0); TS_ASSERT_EQUALS(alg.m_bases.size(), 0); @@ -450,9 +450,9 @@ public: SlicingAlgorithmImpl alg; alg.m_inWS = wsQSample; // All dimensions are QSample // Set up data that comes from other properties - alg.m_minExtents.push_back(-5.0); - alg.m_maxExtents.push_back(+5.0); - alg.m_numBins.push_back(20); + alg.m_minExtents.emplace_back(-5.0); + alg.m_maxExtents.emplace_back(+5.0); + alg.m_numBins.emplace_back(20); alg.m_NormalizeBasisVectors = (normalize > 0); TS_ASSERT_EQUALS(alg.m_bases.size(), 0); @@ -509,9 +509,9 @@ public: alg.m_inWS = wsMixedFrames; // First three dimensions are Q Sample // the last is General Frame // Set up data that comes from other properties - alg.m_minExtents.push_back(-5.0); - alg.m_maxExtents.push_back(+5.0); - alg.m_numBins.push_back(20); + alg.m_minExtents.emplace_back(-5.0); + alg.m_maxExtents.emplace_back(+5.0); + alg.m_numBins.emplace_back(20); alg.m_NormalizeBasisVectors = (normalize > 0); TS_ASSERT_EQUALS(alg.m_bases.size(), 0); @@ -567,9 +567,9 @@ public: SlicingAlgorithmImpl alg; alg.m_inWS = ws; // Set up data that comes from other properties - alg.m_minExtents.push_back(-5.0); - alg.m_maxExtents.push_back(+5.0); - alg.m_numBins.push_back(20); + alg.m_minExtents.emplace_back(-5.0); + alg.m_maxExtents.emplace_back(+5.0); + alg.m_numBins.emplace_back(20); alg.m_NormalizeBasisVectors = true; TS_ASSERT_EQUALS(alg.m_bases.size(), 0); diff --git a/Framework/MDAlgorithms/test/SmoothMDTest.h b/Framework/MDAlgorithms/test/SmoothMDTest.h index 110182789fa478355dc0ca8fb87dfdc274ac0d39..ca6870c686dd095c57b20ff4729f4e9ac57ce5db 100644 --- a/Framework/MDAlgorithms/test/SmoothMDTest.h +++ b/Framework/MDAlgorithms/test/SmoothMDTest.h @@ -74,9 +74,9 @@ public: std::runtime_error &); std::vector<double> widthVector; - widthVector.push_back(3); // OK - widthVector.push_back(5); // OK - widthVector.push_back(2); // Not OK + widthVector.emplace_back(3); // OK + widthVector.emplace_back(5); // OK + widthVector.emplace_back(2); // Not OK alg.setProperty("WidthVector", widthVector); // Width vector contains even number @@ -255,8 +255,8 @@ public: alg.setChild(true); alg.initialize(); WidthVector widthVector; - widthVector.push_back(3); // 3 = width in zeroth dimension - widthVector.push_back(5); // 5 = width in first dimension + widthVector.emplace_back(3); // 3 = width in zeroth dimension + widthVector.emplace_back(5); // 5 = width in first dimension alg.setProperty("WidthVector", widthVector); alg.setProperty("InputWorkspace", toSmooth); alg.setPropertyValue("OutputWorkspace", "dummy"); diff --git a/Framework/MDAlgorithms/test/TransposeMDTest.h b/Framework/MDAlgorithms/test/TransposeMDTest.h index 1bdb04085ed317cd11f86c1120876db6f91e2a09..66e3f0599151abe11315b912989d2eb3ce9c3503 100644 --- a/Framework/MDAlgorithms/test/TransposeMDTest.h +++ b/Framework/MDAlgorithms/test/TransposeMDTest.h @@ -35,9 +35,9 @@ public: TransposeMD transposeMD; transposeMD.initialize(); std::vector<int> axes; - axes.push_back(1); // should be fine. + axes.emplace_back(1); // should be fine. TS_ASSERT_THROWS_NOTHING(transposeMD.setProperty("Axes", axes)); - axes.push_back(-1); // Not a valid axis + axes.emplace_back(-1); // Not a valid axis TS_ASSERT_THROWS(transposeMD.setProperty("Axes", axes), std::invalid_argument &); } @@ -117,8 +117,8 @@ public: transposeMD.setPropertyValue("OutputWorkspace", "dummy"); transposeMD.setProperty("InputWorkspace", inputWS); std::vector<int> axes; - axes.push_back(1); - axes.push_back(0); + axes.emplace_back(1); + axes.emplace_back(0); transposeMD.setProperty("Axes", axes); transposeMD.execute(); IMDHistoWorkspace_sptr outputWS = @@ -155,8 +155,8 @@ public: transposeMD.setPropertyValue("OutputWorkspace", "dummy"); transposeMD.setProperty("InputWorkspace", inputWS); std::vector<int> axes; - axes.push_back(0); - axes.push_back(1); + axes.emplace_back(0); + axes.emplace_back(1); transposeMD.setProperty("Axes", axes); // 0 and 1, but 2 not specified! transposeMD.execute(); IMDHistoWorkspace_sptr outputWS = diff --git a/Framework/MDAlgorithms/test/WeightedMeanMDTest.h b/Framework/MDAlgorithms/test/WeightedMeanMDTest.h index de5c901f0c85aa4b93c4da1880388820f9c33e87..1ca62e7812885c365d60c81dba28d38d436fd1d1 100644 --- a/Framework/MDAlgorithms/test/WeightedMeanMDTest.h +++ b/Framework/MDAlgorithms/test/WeightedMeanMDTest.h @@ -208,11 +208,11 @@ public: const double theta_shift = 0.4; for (size_t i = 0; i < 40; ++i) { const double theta = 0.02 * double(i) * M_PI; - s1.push_back(std::sin(theta)); - e1.push_back(std::sin(theta)); - s2.push_back(std::sin(theta + theta_shift)); - e2.push_back(std::sin(theta + theta_shift)); - x.push_back(double(i)); + s1.emplace_back(std::sin(theta)); + e1.emplace_back(std::sin(theta)); + s2.emplace_back(std::sin(theta + theta_shift)); + e2.emplace_back(std::sin(theta + theta_shift)); + x.emplace_back(double(i)); } // Create Input MDWorkspaces diff --git a/Framework/Muon/src/AlphaCalc.cpp b/Framework/Muon/src/AlphaCalc.cpp index 3eb17571a286bcf074ed00d6a7cd7dc4b1413456..27a7c96dd7a15b3653795b43fd3d902e3a1e6c00 100644 --- a/Framework/Muon/src/AlphaCalc.cpp +++ b/Framework/Muon/src/AlphaCalc.cpp @@ -75,9 +75,9 @@ void AlphaCalc::exec() { // if for some reason the size of forward and backward lists are zero // default these to their defaults if (forwardSpectraList.empty()) - forwardSpectraList.push_back(1); + forwardSpectraList.emplace_back(1); if (backwardSpectraList.empty()) - backwardSpectraList.push_back(2); + backwardSpectraList.emplace_back(2); // first step is to create two workspaces which groups all forward and // backward spectra diff --git a/Framework/Muon/src/CalculateMuonAsymmetry.cpp b/Framework/Muon/src/CalculateMuonAsymmetry.cpp index 1e1b429c48796e79a9c0a39a2795d62cc795c9e5..a0728c530d96ee4b24922c2036237243c9ae4270 100644 --- a/Framework/Muon/src/CalculateMuonAsymmetry.cpp +++ b/Framework/Muon/src/CalculateMuonAsymmetry.cpp @@ -377,7 +377,7 @@ std::vector<double> CalculateMuonAsymmetry::getNormConstants( if (wsNames.size() == 1) { // N(1+g) + exp auto TFFunc = boost::dynamic_pointer_cast<API::CompositeFunction>(tmp); - norms.push_back(getNormValue(TFFunc)); + norms.emplace_back(getNormValue(TFFunc)); } else { auto result = boost::dynamic_pointer_cast<API::MultiDomainFunction>(tmp); for (size_t j = 0; j < wsNames.size(); j++) { @@ -386,7 +386,7 @@ std::vector<double> CalculateMuonAsymmetry::getNormConstants( result->getFunction(j)); // N(1+g) + exp TFFunc = boost::dynamic_pointer_cast<API::CompositeFunction>(TFFunc); - norms.push_back(getNormValue(TFFunc)); + norms.emplace_back(getNormValue(TFFunc)); } } } catch (...) { diff --git a/Framework/Muon/src/MuonAlgorithmHelper.cpp b/Framework/Muon/src/MuonAlgorithmHelper.cpp index 543ef0de9c04274e13dc353e9638da8334ae6df0..91fb3e87442b97ac7cd6bec12bbd096a56803e75 100644 --- a/Framework/Muon/src/MuonAlgorithmHelper.cpp +++ b/Framework/Muon/src/MuonAlgorithmHelper.cpp @@ -68,7 +68,7 @@ std::string getRunLabel(const std::vector<Workspace_sptr> &wsList) { runNumbers.reserve(wsList.size()); for (auto &&workspace : wsList) { int runNumber = firstPeriod(workspace)->getRunNumber(); - runNumbers.push_back(runNumber); + runNumbers.emplace_back(runNumber); } return getRunLabel(instrument, runNumbers); @@ -451,11 +451,11 @@ void parseRunLabel(const std::string &label, std::string &instrument, const auto start = boost::lexical_cast<int>(pairTokenizer[0]); const auto end = boost::lexical_cast<int>(endRun); for (int run = start; run < end + 1; run++) { - runNumbers.push_back(run); + runNumbers.emplace_back(run); } } else if (pairTokenizer.count() == 1) { // Single run - runNumbers.push_back(boost::lexical_cast<int>(pairTokenizer[0])); + runNumbers.emplace_back(boost::lexical_cast<int>(pairTokenizer[0])); } else { throw std::invalid_argument("Failed to parse run label: " + label + " too many tokens "); diff --git a/Framework/Muon/src/MuonGroupDetectors.cpp b/Framework/Muon/src/MuonGroupDetectors.cpp index 720cf40c367d040150c49e1ba50cf5cd72500a2f..e1deb201b21a557e4f8591313243d3e2512a37b1 100644 --- a/Framework/Muon/src/MuonGroupDetectors.cpp +++ b/Framework/Muon/src/MuonGroupDetectors.cpp @@ -72,7 +72,7 @@ void MuonGroupDetectors::exec() { // First pass to determine how many non-empty groups we have for (size_t row = 0; row < table->rowCount(); ++row) { if (!table->cell<std::vector<int>>(row, 0).empty()) - nonEmptyRows.push_back(row); + nonEmptyRows.emplace_back(row); } if (nonEmptyRows.empty()) diff --git a/Framework/Muon/src/PhaseQuadMuon.cpp b/Framework/Muon/src/PhaseQuadMuon.cpp index 53d041f297e6b63dad3f165ae0e8fc2da4b1a895..a73d8f0bcdc29495be8e88dbf30dd13da6b6cc1b 100644 --- a/Framework/Muon/src/PhaseQuadMuon.cpp +++ b/Framework/Muon/src/PhaseQuadMuon.cpp @@ -258,7 +258,7 @@ PhaseQuadMuon::squash(const API::MatrixWorkspace_sptr &ws, double syy = 0.; double sxy = 0.; for (size_t h = 0; h < nspec; h++) { - emptySpectrum.push_back( + emptySpectrum.emplace_back( std::all_of(ws->y(h).begin(), ws->y(h).end(), [](double value) { return value == 0.; }) || phase->Double(h, asymmetryIndex) == ASYMM_ERROR); @@ -279,15 +279,15 @@ PhaseQuadMuon::squash(const API::MatrixWorkspace_sptr &ws, const double mu2 = 2 * sxx / (sxx * syy - sxy * sxy); for (size_t h = 0; h < nspec; h++) { if (emptySpectrum[h]) { - aj.push_back(0.0); - bj.push_back(0.0); + aj.emplace_back(0.0); + bj.emplace_back(0.0); } else { const double asym = phase->Double(h, asymmetryIndex) / maxAsym; const double phi = phase->Double(h, phaseIndex); const double X = n0[h] * asym * cos(phi); const double Y = n0[h] * asym * sin(phi); - aj.push_back((lam1 * X + mu1 * Y) * 0.5); - bj.push_back((lam2 * X + mu2 * Y) * 0.5); + aj.emplace_back((lam1 * X + mu1 * Y) * 0.5); + bj.emplace_back((lam2 * X + mu2 * Y) * 0.5); } } } diff --git a/Framework/Muon/test/CalMuonDetectorPhasesTest.h b/Framework/Muon/test/CalMuonDetectorPhasesTest.h index c41fef69f87c930e53dc560017ca81911e118c84..01aed4722d6fb71e32c220552846fc4572943487 100644 --- a/Framework/Muon/test/CalMuonDetectorPhasesTest.h +++ b/Framework/Muon/test/CalMuonDetectorPhasesTest.h @@ -149,13 +149,13 @@ private: for (size_t t = 0; t < maxt; t++) { double x = static_cast<double>(t) / static_cast<double>(maxt); double e = exp(-x / tau); - X.push_back(x); - Y.push_back(a * - sin(w * x + static_cast<double>(s) * M_PI / - static_cast<double>(nspec)) * - e + - e); - E.push_back(0.005); + X.emplace_back(x); + Y.emplace_back(a * + sin(w * x + static_cast<double>(s) * M_PI / + static_cast<double>(nspec)) * + e + + e); + E.emplace_back(0.005); } } diff --git a/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h b/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h index 761dec46c9a2b716be364e5aceaf43e7afac8a3e..9da9c8f269f92d8b655470974d807a7f0ebbb3b1 100644 --- a/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h +++ b/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h @@ -138,7 +138,7 @@ public: void test_SpectrumList() { std::vector<MatrixWorkspace_sptr> workspaces; - workspaces.push_back(createWorkspace(2, 50)); + workspaces.emplace_back(createWorkspace(2, 50)); // First, run the algorithm without specifying any spectrum auto table = genTable(); @@ -149,7 +149,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg1->execute()); TS_ASSERT(alg1->isExecuted()); - workspaces.push_back(alg1->getProperty("OutputWorkspace")); + workspaces.emplace_back(alg1->getProperty("OutputWorkspace")); // Then run the algorithm on the second spectrum only IAlgorithm_sptr alg2 = setUpAlg(table); @@ -159,7 +159,7 @@ public: alg2->setPropertyValue("Spectra", "1"); TS_ASSERT_THROWS_NOTHING(alg2->execute()); TS_ASSERT(alg2->isExecuted()); - workspaces.push_back(alg2->getProperty("OutputWorkspace")); + workspaces.emplace_back(alg2->getProperty("OutputWorkspace")); for (int j = 0; j < 3; j++) { if (j != 0) { // check we have 2 spectra diff --git a/Framework/Muon/test/MuonAlgorithmHelperTest.h b/Framework/Muon/test/MuonAlgorithmHelperTest.h index 842459c45ca3c527eb6c04a31d2a81a3c0f61b9a..7c422d6d0451fc8926ed76ca4374bc873d835a25 100644 --- a/Framework/Muon/test/MuonAlgorithmHelperTest.h +++ b/Framework/Muon/test/MuonAlgorithmHelperTest.h @@ -101,7 +101,7 @@ public: std::vector<Workspace_sptr> list; for (int i = 15189; i <= 15193; ++i) { - list.push_back( + list.emplace_back( MuonWorkspaceCreationHelper::createWorkspaceWithInstrumentandRun( "MUSR", i)); } @@ -115,7 +115,7 @@ public: std::vector<Workspace_sptr> list; for (auto it = runNumbers.begin(); it != runNumbers.end(); ++it) { - list.push_back( + list.emplace_back( MuonWorkspaceCreationHelper::createWorkspaceWithInstrumentandRun( "EMU", *it)); } @@ -128,7 +128,7 @@ public: std::vector<int> runNumbers{1, 2, 3, 5, 6, 8, 10, 11, 12, 13, 14}; std::vector<Workspace_sptr> list; for (auto it = runNumbers.begin(); it != runNumbers.end(); it++) { - list.push_back( + list.emplace_back( MuonWorkspaceCreationHelper::createWorkspaceWithInstrumentandRun( "EMU", *it)); } @@ -140,7 +140,7 @@ public: std::vector<int> runNumbers{5, 14, 8, 1, 11, 3, 10, 6, 13, 12, 2}; std::vector<Workspace_sptr> list; for (auto it = runNumbers.begin(); it != runNumbers.end(); it++) { - list.push_back( + list.emplace_back( MuonWorkspaceCreationHelper::createWorkspaceWithInstrumentandRun( "EMU", *it)); } diff --git a/Framework/Muon/test/MuonGroupDetectorsTest.h b/Framework/Muon/test/MuonGroupDetectorsTest.h index dcdc37fc0c031c772e35885fb03de9a6afd51af8..edd52d7bf19fef151a34dc80461de754b7281755 100644 --- a/Framework/Muon/test/MuonGroupDetectorsTest.h +++ b/Framework/Muon/test/MuonGroupDetectorsTest.h @@ -105,15 +105,15 @@ private: t->addColumn("vector_int", "Detectors"); std::vector<int> group1; - group1.push_back(1); - group1.push_back(2); + group1.emplace_back(1); + group1.emplace_back(2); TableRow row1 = t->appendRow(); row1 << group1; std::vector<int> group2; - group2.push_back(3); - group2.push_back(4); - group2.push_back(5); + group2.emplace_back(3); + group2.emplace_back(4); + group2.emplace_back(5); TableRow row2 = t->appendRow(); row2 << group2; diff --git a/Framework/Muon/test/PhaseQuadMuonTest.h b/Framework/Muon/test/PhaseQuadMuonTest.h index 28dc4ba562a6906858e563707de51a4293aa7554..d3983965861728f8a5871d2419acda77a1c511eb 100644 --- a/Framework/Muon/test/PhaseQuadMuonTest.h +++ b/Framework/Muon/test/PhaseQuadMuonTest.h @@ -168,7 +168,7 @@ public: // check got some dead detectors std::vector<bool> emptySpectrum; for (size_t h = 0; h < nspec; h++) { - emptySpectrum.push_back( + emptySpectrum.emplace_back( std::all_of(ws->y(h).begin(), ws->y(h).end(), [](double value) { return value == 0.; })); } diff --git a/Framework/Muon/test/RemoveExpDecayTest.h b/Framework/Muon/test/RemoveExpDecayTest.h index b98868aa7095cbbb47ff1c7472c65d4483565d19..49cbb08522e48d412fdddf4c93d71bb6f2ab484d 100644 --- a/Framework/Muon/test/RemoveExpDecayTest.h +++ b/Framework/Muon/test/RemoveExpDecayTest.h @@ -37,13 +37,13 @@ MatrixWorkspace_sptr createWorkspace(size_t nspec, size_t maxt) { for (size_t t = 0; t < maxt; t++) { double x = static_cast<double>(t) / static_cast<double>(maxt); double e = exp(-x / tau); - X.push_back(x); - Y.push_back(a * - sin(w * x + static_cast<double>(s) * M_PI / - static_cast<double>(nspec)) * - e + - e); - E.push_back(0.005); + X.emplace_back(x); + Y.emplace_back(a * + sin(w * x + static_cast<double>(s) * M_PI / + static_cast<double>(nspec)) * + e + + e); + E.emplace_back(0.005); } } diff --git a/Framework/Nexus/inc/MantidNexus/NexusFileIO.h b/Framework/Nexus/inc/MantidNexus/NexusFileIO.h index 7b4ebe9a8af40af1daf19db280df5f5e9772a23f..41e51ee7e9c26a9bbcbbf61b808a331fa7517902 100644 --- a/Framework/Nexus/inc/MantidNexus/NexusFileIO.h +++ b/Framework/Nexus/inc/MantidNexus/NexusFileIO.h @@ -382,12 +382,13 @@ void NexusFileIO::writeNumericTimeLog( dv != dV.end(); dv++) { T val = dv->second; Types::Core::DateAndTime time = dv->first; - values.push_back(val); + values.emplace_back(val); if (first) { t0 = time; // start time of log first = false; } - times.push_back(Types::Core::DateAndTime::secondsFromDuration(time - t0)); + times.emplace_back( + Types::Core::DateAndTime::secondsFromDuration(time - t0)); } // create log status = NXmakegroup(fileID, logName.c_str(), "NXlog"); @@ -398,13 +399,13 @@ void NexusFileIO::writeNumericTimeLog( // write log data std::vector<std::string> attributes, avalues; attributes.emplace_back("type"); - avalues.push_back(logValueType<T>()); + avalues.emplace_back(logValueType<T>()); writeNxFloatArray("value", values, attributes, avalues); attributes.clear(); avalues.clear(); // get ISO time, and save it as an attribute attributes.emplace_back("start"); - avalues.push_back(t0.toISO8601String()); + avalues.emplace_back(t0.toISO8601String()); writeNxFloatArray("time", times, attributes, avalues); status = NXclosegroup(fileID); diff --git a/Framework/Nexus/src/MuonNexusReader.cpp b/Framework/Nexus/src/MuonNexusReader.cpp index 8a6be30adc05921d5b208de4f3751d79b4358326..ca153439f82c5f27f8a9e51bae280eb10a0bb348 100644 --- a/Framework/Nexus/src/MuonNexusReader.cpp +++ b/Framework/Nexus/src/MuonNexusReader.cpp @@ -82,7 +82,7 @@ void MuonNexusReader::readFromFile(const string &filename) { std::map<string, string> entries = handle.getEntries(); for (auto &entry : entries) { if (entry.second == NXDATA) { - nxdataname.push_back(entry.first); + nxdataname.emplace_back(entry.first); } } handle.openGroup(nxdataname.front(), NXDATA); @@ -254,7 +254,7 @@ bool MuonNexusReader::readMuonLogData(NeXus::File &handle) { for (int i = 0; i < info.dims[0]; ++i) { std::string str(&dataVals[i * info.dims[1]], &dataVals[(i + 1) * info.dims[1]]); - stringValues.push_back(str); + stringValues.emplace_back(str); } values.resize(info.dims[0]); // Leave empty } else { @@ -284,14 +284,14 @@ bool MuonNexusReader::readMuonLogData(NeXus::File &handle) { // Add loaded values to vectors - logNames.push_back(dataName); + logNames.emplace_back(dataName); std::vector<float> tmp(timeVals.get(), timeVals.get() + info.dims[0]); - logTimes.push_back(tmp); + logTimes.emplace_back(tmp); - logType.push_back(isNumeric); - logValues.push_back(values); - logStringValues.push_back(stringValues); + logType.emplace_back(isNumeric); + logValues.emplace_back(values); + logStringValues.emplace_back(stringValues); return true; } diff --git a/Framework/Nexus/src/NexusClasses.cpp b/Framework/Nexus/src/NexusClasses.cpp index 180de52517a69951e0d66331bfb6303b9594dce1..40099c937a94a99c5274037f2bb88b64ec0c8ed6 100644 --- a/Framework/Nexus/src/NexusClasses.cpp +++ b/Framework/Nexus/src/NexusClasses.cpp @@ -183,10 +183,10 @@ void NXClass::readAllInfo() { NXgetinfo(m_fileID, &data_info.rank, data_info.dims, &data_info.type); NXclosedata(m_fileID); data_info.nxname = info.nxname; - m_datasets->push_back(data_info); + m_datasets->emplace_back(data_info); } else if (info.nxclass.substr(0, 2) == "NX" || info.nxclass.substr(0, 2) == "IX") { - m_groups->push_back(info); + m_groups->emplace_back(info); } // std::cerr<<'!'<<info.nxname<<'\n'; } @@ -358,7 +358,7 @@ std::vector<std::string> &NXNote::data() { std::string line; while (getline(istr, line)) { - m_data.push_back(line); + m_data.emplace_back(line); } m_data_ok = true; diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp index 8e501354acd58a1c4517c930eba8e132bff1649a..c1dd7857b63f69f8aeddf362af26ef681fe5e5a7 100644 --- a/Framework/Nexus/src/NexusFileIO.cpp +++ b/Framework/Nexus/src/NexusFileIO.cpp @@ -273,7 +273,7 @@ bool NexusFileIO::writeNxNote(const std::string ¬eName, std::vector<std::string> attributes, avalues; if (!date.empty()) { attributes.emplace_back("date"); - avalues.push_back(date); + avalues.emplace_back(date); } if (!writeNxValue<std::string>("author", author, NX_CHAR, attributes, avalues)) @@ -339,10 +339,10 @@ int NexusFileIO::writeNexusProcessedData2D( std::vector<double> axis2; if (nSpect < nHist) for (size_t i = 0; i < nSpect; i++) - axis2.push_back((*sAxis)(spec[i])); + axis2.emplace_back((*sAxis)(spec[i])); else for (size_t i = 0; i < sAxis->length(); i++) - axis2.push_back((*sAxis)(i)); + axis2.emplace_back((*sAxis)(i)); int start[2] = {0, 0}; int asize[2] = {1, dims_array[1]}; @@ -1164,11 +1164,11 @@ bool NexusFileIO::writeNexusBinMasking( for (std::size_t i = 0; i < ws->getNumberHistograms(); ++i) { if (ws->hasMaskedBins(i)) { const API::MatrixWorkspace::MaskList &mList = ws->maskedBins(i); - spectra.push_back(spectra_count); - spectra.push_back(offset); + spectra.emplace_back(spectra_count); + spectra.emplace_back(offset); for (const auto &mask : mList) { - bins.push_back(mask.first); - weights.push_back(mask.second); + bins.emplace_back(mask.first); + weights.emplace_back(mask.second); } ++spectra_count; offset += static_cast<int>(mList.size()); @@ -1264,7 +1264,7 @@ int getNexusEntryTypes(const std::string &fileName, NX_OK) { std::string nxc(nxclass); if (nxc == "NXentry") - entryList.push_back(nxname); + entryList.emplace_back(nxname); } // for each entry found, look for "analysis" or "definition" text data fields // and return value plus entry name @@ -1287,8 +1287,8 @@ int getNexusEntryTypes(const std::string &fileName, continue; value[dims[0]] = '\0'; // return e.g entryName "analysis"/definition "muonTD" - definition.push_back(value); - entryName.push_back(entry); + definition.emplace_back(value); + entryName.emplace_back(entry); delete[] value; NXclosegroup(fileH); // close data group, then entry NXclosegroup(fileH); diff --git a/Framework/NexusGeometry/src/JSONGeometryParser.cpp b/Framework/NexusGeometry/src/JSONGeometryParser.cpp index cd2a0956938c3622d0b73cc16b3481f72760f8fc..ef770ab3e4d2d9a59db3250093238cc4b2f27ec0 100644 --- a/Framework/NexusGeometry/src/JSONGeometryParser.cpp +++ b/Framework/NexusGeometry/src/JSONGeometryParser.cpp @@ -50,7 +50,7 @@ std::vector<Json::Value> getAllNXComponents(const Json::Value &instrument, for (const auto &component : components) { auto attributes = component[ATTRIBUTES]; if (validateNXAttribute(attributes, NXClass)) - nxComponents.push_back(component); + nxComponents.emplace_back(component); } return nxComponents; @@ -69,19 +69,19 @@ std::vector<Json::Value> getAllChoppers(const Json::Value &instrument) { } void addSingleValue(const Json::Value &val, std::vector<double> &fillArray) { - fillArray.push_back(val.asDouble()); + fillArray.emplace_back(val.asDouble()); } void addSingleValue(const Json::Value &val, std::vector<float> &fillArray) { - fillArray.push_back(val.asFloat()); + fillArray.emplace_back(val.asFloat()); } void addSingleValue(const Json::Value &val, std::vector<uint32_t> &fillArray) { - fillArray.push_back(val.asUInt()); + fillArray.emplace_back(val.asUInt()); } void addSingleValue(const Json::Value &val, std::vector<int32_t> &fillArray) { - fillArray.push_back(val.asInt()); + fillArray.emplace_back(val.asInt()); } /// Recursively fills JSON array data trees which are usually arranges as arrays @@ -303,7 +303,7 @@ std::vector<std::unique_ptr<Json::Value>> moveToUniquePtrVec(std::vector<Json::Value> &jsonVector) { std::vector<std::unique_ptr<Json::Value>> ret; for (auto &val : jsonVector) - ret.push_back(std::make_unique<Json::Value>(std::move(val))); + ret.emplace_back(std::make_unique<Json::Value>(std::move(val))); return ret; } @@ -489,7 +489,7 @@ void JSONGeometryParser::extractDetectorContent() { m_x.emplace_back(std::move(x)); m_y.emplace_back(std::move(y)); m_z.emplace_back(std::move(z)); - m_isOffGeometry.push_back(isOffGeometry); + m_isOffGeometry.emplace_back(isOffGeometry); m_pixelShapeCylinders.emplace_back(std::move(cylinders)); m_pixelShapeVertices.emplace_back(std::move(vertices)); m_pixelShapeFaces.emplace_back(std::move(faces)); diff --git a/Framework/NexusGeometry/src/NexusGeometryParser.cpp b/Framework/NexusGeometry/src/NexusGeometryParser.cpp index 3dc0dd94bf78c83a4527379cd7539405b669444e..2f5da3167f8867da3cebb96348403577e85f1642 100644 --- a/Framework/NexusGeometry/src/NexusGeometryParser.cpp +++ b/Framework/NexusGeometry/src/NexusGeometryParser.cpp @@ -285,7 +285,7 @@ private: attribute.read(dataType, classType); // If group of correct type, append to subGroup vector if (classType == CLASS_TYPE) { - subGroups.push_back(childGroup); + subGroups.emplace_back(childGroup); } } } @@ -605,14 +605,14 @@ private: auto &detWinding = detWindingOrder[detIndex]; vertsForDet.reserve(nVertsInFace); detWinding.reserve(nVertsInFace); - detFaceIndices[detIndex].push_back( + detFaceIndices[detIndex].emplace_back( faceIndex); // Associate face with detector index // Use face index to index into winding order. for (size_t v = 0; v < nVertsInFace; ++v) { const auto vi = windingOrder[faceIndex + v] * 3; vertsForDet.emplace_back(vertices[vi], vertices[vi + 1], vertices[vi + 2]); - detWinding.push_back(static_cast<uint32_t>(detWinding.size())); + detWinding.emplace_back(static_cast<uint32_t>(detWinding.size())); } // Index -> Id detIds[detIndex] = detID; diff --git a/Framework/NexusGeometry/src/NexusGeometrySave.cpp b/Framework/NexusGeometry/src/NexusGeometrySave.cpp index 1c788f4c26a1ee6eeffb931921b8a6831fa94dbf..ac27550517cc3dedaaf165d0864695678e76c031 100644 --- a/Framework/NexusGeometry/src/NexusGeometrySave.cpp +++ b/Framework/NexusGeometry/src/NexusGeometrySave.cpp @@ -89,9 +89,9 @@ inline H5::Group tryCreateGroup(const H5::Group &parentGroup, std::vector<double> toStdVector(const V3D &data) { std::vector<double> stdVector; stdVector.reserve(3); - stdVector.push_back(data.X()); - stdVector.push_back(data.Y()); - stdVector.push_back(data.Z()); + stdVector.emplace_back(data.X()); + stdVector.emplace_back(data.Y()); + stdVector.emplace_back(data.Z()); return stdVector; } @@ -235,9 +235,9 @@ void writeXYZPixeloffset(H5::Group &grp, auto offset = Geometry::ComponentInfoBankHelpers::offsetFromAncestor( compInfo, idx, i); - posx.push_back(offset[0]); - posy.push_back(offset[1]); - posz.push_back(offset[2]); + posx.emplace_back(offset[0]); + posy.emplace_back(offset[1]); + posz.emplace_back(offset[2]); } bool xIsZero = isApproxZero(posx, PRECISION); @@ -314,7 +314,7 @@ void writeNXDetectorNumber(H5::Group &grp, // dataset std::for_each(bankDetectors.begin(), bankDetectors.end(), [&bankDetIDs, &detectorIDs](const size_t index) { - bankDetIDs.push_back(detectorIDs[index]); + bankDetIDs.emplace_back(detectorIDs[index]); }); write1DIntDataset(grp, DETECTOR_IDS, bankDetIDs); @@ -1075,8 +1075,9 @@ void saveInstrument(const Geometry::ComponentInfo &compInfo, if (reporter != nullptr) reporter->report(); writer.detector(instrument, compInfo, detIds, index); - saved_indices.push_back(index); // Now record the fact that children of - // this are not needed as NXdetectors + saved_indices.emplace_back( + index); // Now record the fact that children of + // this are not needed as NXdetectors } } } @@ -1175,8 +1176,9 @@ void saveInstrument(const Mantid::API::MatrixWorkspace &ws, if (reporter != nullptr) reporter->report(); writer.detector(instrument, compInfo, detIds, index, mappings); - saved_indices.push_back(index); // Now record the fact that children of - // this are not needed as NXdetectors + saved_indices.emplace_back( + index); // Now record the fact that children of + // this are not needed as NXdetectors } } } diff --git a/Framework/NexusGeometry/src/NexusGeometryUtilities.cpp b/Framework/NexusGeometry/src/NexusGeometryUtilities.cpp index 9a7ef743c90e324fada51c7ba977176717747040..5c77f90775655d52210e07ccd2e54fbec7b394bd 100644 --- a/Framework/NexusGeometry/src/NexusGeometryUtilities.cpp +++ b/Framework/NexusGeometry/src/NexusGeometryUtilities.cpp @@ -107,7 +107,7 @@ std::vector<H5::Group> findGroups(const H5::Group &parentGroup, auto childGroup = parentGroup.openGroup(childPath); // Iterate through attributes to find NX_class if (hasNXAttribute(childGroup, classType)) - groups.push_back(childGroup); + groups.emplace_back(childGroup); } } return groups; // Empty diff --git a/Framework/NexusGeometry/src/NexusShapeFactory.cpp b/Framework/NexusGeometry/src/NexusShapeFactory.cpp index 38339c9bd2b4473f66331b5e2c83c2d2d5aed697..22d522af90febf1923d42b081a124073b08599cf 100644 --- a/Framework/NexusGeometry/src/NexusShapeFactory.cpp +++ b/Framework/NexusGeometry/src/NexusShapeFactory.cpp @@ -55,9 +55,9 @@ void createTrianglesFromPolygon(const std::vector<uint32_t> &windingOrder, triangularFaces.reserve(triangularFaces.size() + 3 * polygonOrder); for (int polygonVertex = 1; polygonVertex < polygonOrder - 1; ++polygonVertex) { - triangularFaces.push_back(*first); - triangularFaces.push_back(*(first + polygonVertex)); - triangularFaces.push_back(*(first + polygonVertex + 1)); + triangularFaces.emplace_back(*first); + triangularFaces.emplace_back(*(first + polygonVertex)); + triangularFaces.emplace_back(*(first + polygonVertex + 1)); } startOfFace = endOfFace; // start of the next face } @@ -154,8 +154,8 @@ createCylinder(const Eigen::Matrix<double, 3, 3> &pointsDef) { } // xmax, xmin, ymax, ymin, zmax, zmin - boundingBoxSimplified.push_back(max); - boundingBoxSimplified.push_back(min); + boundingBoxSimplified.emplace_back(max); + boundingBoxSimplified.emplace_back(min); } std::string algebra = "(-1 -2 3)"; diff --git a/Framework/NexusGeometry/src/TubeBuilder.cpp b/Framework/NexusGeometry/src/TubeBuilder.cpp index 2224bd6ea4b4e477b63c08d4c8508f83ee6f223d..44d423d3e073fa249b474204bdf463b3f189b5bd 100644 --- a/Framework/NexusGeometry/src/TubeBuilder.cpp +++ b/Framework/NexusGeometry/src/TubeBuilder.cpp @@ -25,8 +25,8 @@ TubeBuilder::TubeBuilder(const Mantid::Geometry::IObject &pixelShape, m_axis = Kernel::toVector3d( pixelShape.getGeometryHandler()->shapeInfo().points()[1]); // Set position and id of first detector in tube - m_positions.push_back(firstDetectorPosition); - m_detIDs.push_back(firstDetectorId); + m_positions.emplace_back(firstDetectorPosition); + m_detIDs.emplace_back(firstDetectorId); // points which define the line the tube sits on m_p1 = m_axis + firstDetectorPosition; @@ -83,8 +83,8 @@ bool TubeBuilder::addDetectorIfCoLinear(const Eigen::Vector3d &pos, int detID) { if (isCoLinear) { // Add Detector - m_positions.push_back(pos); - m_detIDs.push_back(detID); + m_positions.emplace_back(pos); + m_detIDs.emplace_back(detID); // Recalculate height as distance between base of tube and tip of new // detector diff --git a/Framework/NexusGeometry/src/TubeHelpers.cpp b/Framework/NexusGeometry/src/TubeHelpers.cpp index 114b84b649cd112e31485c8f1bb639f9e451092d..eb21e27c9e2dc8b34db45354424ca4537621f95f 100644 --- a/Framework/NexusGeometry/src/TubeHelpers.cpp +++ b/Framework/NexusGeometry/src/TubeHelpers.cpp @@ -71,7 +71,7 @@ notInTubes(const std::vector<detail::TubeBuilder> &tubes, std::vector<Mantid::detid_t> used; for (const auto &tube : tubes) { for (const auto &id : tube.detIDs()) { - used.push_back(id); + used.emplace_back(id); } } std::vector<Mantid::detid_t> diff; diff --git a/Framework/NexusGeometry/test/NexusShapeFactoryTest.h b/Framework/NexusGeometry/test/NexusShapeFactoryTest.h index d392974f3de761836d91b2b318064e9c51dd99e1..282ef221a5248853a56888436a12643d946c4502 100644 --- a/Framework/NexusGeometry/test/NexusShapeFactoryTest.h +++ b/Framework/NexusGeometry/test/NexusShapeFactoryTest.h @@ -64,7 +64,7 @@ private: template <typename T> void appendTo(std::vector<T> &destination, unsigned int value) { - destination.push_back(static_cast<T>(value)); + destination.emplace_back(static_cast<T>(value)); } public: diff --git a/Framework/Parallel/inc/MantidParallel/ThreadingBackend.h b/Framework/Parallel/inc/MantidParallel/ThreadingBackend.h index 6938db5bf3497216c51e3dcfa8a176c55d9db3f8..1e94d8676591833147b72fa7e6fe2790ee4eb08d 100644 --- a/Framework/Parallel/inc/MantidParallel/ThreadingBackend.h +++ b/Framework/Parallel/inc/MantidParallel/ThreadingBackend.h @@ -124,7 +124,7 @@ void ThreadingBackend::send(int source, int dest, int tag, T &&... args) { detail::saveToStream(oa, std::forward<T>(args)...); } std::lock_guard<std::mutex> lock(m_mutex); - m_buffer[std::make_tuple(source, dest, tag)].push_back(std::move(buf)); + m_buffer[std::make_tuple(source, dest, tag)].emplace_back(std::move(buf)); } template <typename... T> diff --git a/Framework/Parallel/src/IO/Chunker.cpp b/Framework/Parallel/src/IO/Chunker.cpp index 0619a69281e463726d18557634fa8d47675fabbe..c8b996dac3ec5cdfba8c43bd015a022f9dfdefaa 100644 --- a/Framework/Parallel/src/IO/Chunker.cpp +++ b/Framework/Parallel/src/IO/Chunker.cpp @@ -51,7 +51,7 @@ buildPartition(const int totalWorkers, const size_t totalSize, continue; if (std::get<0>(item) <= remainder) { std::get<2>(item) = true; - itemsInPartition.push_back(std::get<1>(item)); + itemsInPartition.emplace_back(std::get<1>(item)); remainder -= std::get<0>(item); } } @@ -107,7 +107,7 @@ std::vector<std::vector<int>> Chunker::makeWorkerGroups() const { for (const auto &partition : m_partitioning) { workerGroups.emplace_back(); for (int i = 0; i < partition.first; ++i) - workerGroups.back().push_back(worker++); + workerGroups.back().emplace_back(worker++); } return workerGroups; } @@ -153,7 +153,7 @@ std::vector<Chunker::LoadRange> Chunker::makeLoadRanges() const { (m_worker - firstWorkerSharingOurPartition)) { size_t count = std::min(current + m_chunkSize, m_bankSizes[bank]) - current; - ranges.push_back(LoadRange{bank, current, count}); + ranges.emplace_back(LoadRange{bank, current, count}); } current += m_chunkSize; chunk++; diff --git a/Framework/Parallel/src/IO/EventLoaderHelpers.cpp b/Framework/Parallel/src/IO/EventLoaderHelpers.cpp index e4e2470fe3ce7c85d6eaa6e2d12bf17523842ebe..f46b5e085887fa2510e30bb8ce46197a174a5fc5 100644 --- a/Framework/Parallel/src/IO/EventLoaderHelpers.cpp +++ b/Framework/Parallel/src/IO/EventLoaderHelpers.cpp @@ -17,7 +17,7 @@ std::vector<size_t> readBankSizes(const H5::Group &group, for (const auto &bankName : bankNames) { const H5::DataSet dataset = group.openDataSet(bankName + "/event_id"); const H5::DataSpace dataSpace = dataset.getSpace(); - bankSizes.push_back(dataSpace.getSelectNpoints()); + bankSizes.emplace_back(dataSpace.getSelectNpoints()); } return bankSizes; } diff --git a/Framework/Parallel/src/IO/MultiProcessEventLoader.cpp b/Framework/Parallel/src/IO/MultiProcessEventLoader.cpp index eac5b860d6dfb675c80b773ac1a9e90c3bea4c85..6e64e87a78016d23c5851eeb00686e4ba619add6 100644 --- a/Framework/Parallel/src/IO/MultiProcessEventLoader.cpp +++ b/Framework/Parallel/src/IO/MultiProcessEventLoader.cpp @@ -136,21 +136,23 @@ void MultiProcessEventLoader::load( i < m_numProcesses - 1 ? evPerPr * (i + 1) : numEvents; std::vector<std::string> processArgs; - processArgs.push_back(m_segmentNames[i]); // segment name - processArgs.push_back(m_storageName); // storage name - processArgs.push_back(std::to_string(i)); // proc id - processArgs.push_back(std::to_string(evPerPr * i)); // first event to load - processArgs.push_back(std::to_string(upperBound)); // upper bound to load - processArgs.push_back(std::to_string(m_numPixels)); // pixel count - processArgs.push_back(std::to_string(storageSize)); // memory size - processArgs.push_back(filename); // nexus file name - processArgs.push_back(groupname); // instrument group name - processArgs.push_back( + processArgs.emplace_back(m_segmentNames[i]); // segment name + processArgs.emplace_back(m_storageName); // storage name + processArgs.emplace_back(std::to_string(i)); // proc id + processArgs.emplace_back( + std::to_string(evPerPr * i)); // first event to load + processArgs.emplace_back( + std::to_string(upperBound)); // upper bound to load + processArgs.emplace_back(std::to_string(m_numPixels)); // pixel count + processArgs.emplace_back(std::to_string(storageSize)); // memory size + processArgs.emplace_back(filename); // nexus file name + processArgs.emplace_back(groupname); // instrument group name + processArgs.emplace_back( m_precalculateEvents ? "1 " : "0 "); // variant of algorithm used for loading for (unsigned j = 0; j < bankNames.size(); ++j) { - processArgs.push_back(bankNames[j]); // bank name - processArgs.push_back(std::to_string(bankOffsets[j])); // bank size + processArgs.emplace_back(bankNames[j]); // bank name + processArgs.emplace_back(std::to_string(bankOffsets[j])); // bank size } try { diff --git a/Framework/Parallel/test/EventLoaderTest.h b/Framework/Parallel/test/EventLoaderTest.h index 3527ba0edb3da7750cd938cb93a69e4b83421efd..677a38daf1b745e31fcb728b294687edc6b67162 100644 --- a/Framework/Parallel/test/EventLoaderTest.h +++ b/Framework/Parallel/test/EventLoaderTest.h @@ -56,7 +56,7 @@ public: 700 * static_cast<int64_t>(m_bank + 1)}; std::vector<double> time_zero; for (size_t i = 0; i < index.size(); ++i) - time_zero.push_back(static_cast<double>(10 * i + bank)); + time_zero.emplace_back(static_cast<double>(10 * i + bank)); // Drift depening on bank to ensure correct offset is used for every bank. int64_t time_zero_offset = 123456789 + 1000000 * m_bank; diff --git a/Framework/Parallel/test/ParallelRunnerTest.h b/Framework/Parallel/test/ParallelRunnerTest.h index 25f7f313766db321edd36ef59b287c64a7ee522c..774971b3b7fbef2a7facfea524a5ca94f2651290 100644 --- a/Framework/Parallel/test/ParallelRunnerTest.h +++ b/Framework/Parallel/test/ParallelRunnerTest.h @@ -22,7 +22,7 @@ namespace { void get_sizes(const Communicator &comm, std::mutex &mutex, std::vector<int> &sizes) { std::lock_guard<std::mutex> lock(mutex); - sizes.push_back(comm.size()); + sizes.emplace_back(comm.size()); } void get_ranks(const Communicator &comm, std::mutex &mutex, diff --git a/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp b/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp index 424e6fe1be22f9bd62107446790a8ffb2afee766..85aa78a1a2c9c126d236c0fb343f032e581029c1 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/FileFinder.cpp @@ -44,7 +44,7 @@ std::vector<std::string> runFinderProxy(FileFinderImpl &self, // Convert python list to c++ vector std::vector<std::string> exts; for (int i = 0; i < len(exts_list); ++i) - exts.push_back(extract<std::string>(exts_list[i])); + exts.emplace_back(extract<std::string>(exts_list[i])); // Before calling the function we need to release the GIL, // drop the Python threadstate and reset anything installed diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp index 1b942618137ef3260fbf50a9eddcccefc7dc37b8..3d68171c2ff34e0e620bd2c4d7b8dc53f799066f 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp @@ -72,7 +72,7 @@ std::vector<Py_intptr_t> countDimensions(const IMDHistoWorkspace &self) { // invert dimensions in C way, e.g. slowest changing ndim goes first for (size_t i = 0; i < ndims; ++i) { - nd.push_back(self.getDimension(i)->getNBins()); + nd.emplace_back(self.getDimension(i)->getNBins()); } ndims = nd.size(); diff --git a/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp b/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp index 230e4b1c2bed3a06e5022c12f8005deb5c16129d..b14cd9f990589a58001da58c85f6677261c223e5 100644 --- a/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp +++ b/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp @@ -59,7 +59,7 @@ IFunction::Attribute createAttributeFromPythonValue(const object &value) { std::vector<double> vec; for (Py_ssize_t i = 0; i < n; ++i) { auto v = extract<double>(PyList_GetItem(rawptr, i))(); - vec.push_back(v); + vec.emplace_back(v); } attr = IFunction::Attribute(vec); } else { diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/CrystalStructure.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/CrystalStructure.cpp index 82f3e9583c9b702e6a751fd26bb7dea6d1fa0edd..aab760f27f64e8b92a54c8a51ee7ed5cb5e7bf30 100644 --- a/Framework/PythonInterface/mantid/geometry/src/Exports/CrystalStructure.cpp +++ b/Framework/PythonInterface/mantid/geometry/src/Exports/CrystalStructure.cpp @@ -27,7 +27,7 @@ std::vector<std::string> getScatterers(const CrystalStructure &self) { scattererStrings.reserve(scatterers->nScatterers()); for (size_t i = 0; i < scatterers->nScatterers(); ++i) { - scattererStrings.push_back( + scattererStrings.emplace_back( getIsotropicAtomBraggScattererString(scatterers->getScatterer(i))); } diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp index 2bcbdaa7ec9e08f4833ed7b65625fa23f0b57327..bf4688f187f69e17fd3e70e8d4fadd3b9192ffce 100644 --- a/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp +++ b/Framework/PythonInterface/mantid/geometry/src/Exports/Group.cpp @@ -50,7 +50,7 @@ Group_sptr constructGroupFromPythonList(const boost::python::list &symOpList) { std::vector<SymmetryOperation> operations; for (int i = 0; i < len(symOpList); ++i) { - operations.push_back( + operations.emplace_back( boost::python::extract<SymmetryOperation>(symOpList[i])); } diff --git a/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs.cpp b/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs.cpp index 0effbfc73ed9e77b0d0033c0d78de42c706a23b0..df9018b82e7975fb528d2782e133d6c47386ce05 100644 --- a/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs.cpp +++ b/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs.cpp @@ -114,22 +114,22 @@ void QueryAllRemoteJobs::exec() { JSONObject::const_iterator it = resp.begin(); while (it != resp.end()) { - jobIds.push_back((*it).first); + jobIds.emplace_back((*it).first); JSONObject jobData; (*it).second.getValue(jobData); std::string value; jobData["JobStatus"].getValue(value); - jobStatusStrs.push_back(value); + jobStatusStrs.emplace_back(value); jobData["JobName"].getValue(value); - jobNames.push_back(value); + jobNames.emplace_back(value); jobData["ScriptName"].getValue(value); - scriptNames.push_back(value); + scriptNames.emplace_back(value); jobData["TransID"].getValue(value); - transIds.push_back(value); + transIds.emplace_back(value); // The time stuff is actually an optional extension. We could check the // info @@ -138,13 +138,13 @@ void QueryAllRemoteJobs::exec() { // the output and see if the values are there... if (jobData.find("SubmitDate") != jobData.end()) { jobData["SubmitDate"].getValue(value); - submitDates.push_back(value); + submitDates.emplace_back(value); jobData["StartDate"].getValue(value); - startDates.push_back(value); + startDates.emplace_back(value); jobData["CompletionDate"].getValue(value); - completionDates.push_back(value); + completionDates.emplace_back(value); } else { // push back empty strings just so all the array properties have the // same diff --git a/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs2.cpp b/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs2.cpp index ff690b648b7f8c5b38cf109d72e184d4b68a827a..1bf87152444038441dad218d259d56c1d5be2111 100644 --- a/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs2.cpp +++ b/Framework/RemoteAlgorithms/src/QueryAllRemoteJobs2.cpp @@ -92,15 +92,15 @@ void QueryAllRemoteJobs2::exec() { std::vector<std::string> completionDates; std::vector<std::string> cmdLine; for (auto &info : infos) { - jobIds.push_back(info.id); - jobNames.push_back(info.name); - jobStatusStrs.push_back(info.status); - transIds.push_back(info.transactionID); - runNames.push_back(info.runnableName); - submitDates.push_back(info.submitDate.toISO8601String()); - startDates.push_back(info.startDate.toISO8601String()); - completionDates.push_back(info.completionTime.toISO8601String()); - cmdLine.push_back(info.cmdLine); + jobIds.emplace_back(info.id); + jobNames.emplace_back(info.name); + jobStatusStrs.emplace_back(info.status); + transIds.emplace_back(info.transactionID); + runNames.emplace_back(info.runnableName); + submitDates.emplace_back(info.submitDate.toISO8601String()); + startDates.emplace_back(info.startDate.toISO8601String()); + completionDates.emplace_back(info.completionTime.toISO8601String()); + cmdLine.emplace_back(info.cmdLine); } setProperty("JobID", jobIds); setProperty("JobStatusString", jobStatusStrs); diff --git a/Framework/RemoteAlgorithms/src/QueryRemoteFile.cpp b/Framework/RemoteAlgorithms/src/QueryRemoteFile.cpp index 426a3fce28d85c3e78fdbe21518d7a794b2d794d..6108fa4d0c93600ad387c2786c0aaff162d040ab 100644 --- a/Framework/RemoteAlgorithms/src/QueryRemoteFile.cpp +++ b/Framework/RemoteAlgorithms/src/QueryRemoteFile.cpp @@ -77,7 +77,7 @@ void QueryRemoteFile::exec() { resp["Files"].getValue(files); for (auto &file : files) { file.getValue(oneFile); - filenames.push_back(oneFile); + filenames.emplace_back(oneFile); } setProperty("FileNames", filenames); diff --git a/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp b/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp index 5ac5c7400ff3f5ce513f519bad7a8dafb359aec4..de7a375a3aea56815118c5fe3b129fe86a0015b2 100644 --- a/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp +++ b/Framework/RemoteJobManagers/src/MantidWebServiceAPIJobManager.cpp @@ -175,22 +175,22 @@ MantidWebServiceAPIJobManager::queryAllRemoteJobs() const { JSONObject::const_iterator it = resp.begin(); while (it != resp.end()) { - jobIds.push_back((*it).first); + jobIds.emplace_back((*it).first); JSONObject jobData; (*it).second.getValue(jobData); std::string value; jobData["JobStatus"].getValue(value); - jobStatusStrs.push_back(value); + jobStatusStrs.emplace_back(value); jobData["JobName"].getValue(value); - jobNames.push_back(value); + jobNames.emplace_back(value); jobData["ScriptName"].getValue(value); - scriptNames.push_back(value); + scriptNames.emplace_back(value); jobData["TransID"].getValue(value); - transIds.push_back(value); + transIds.emplace_back(value); // The time stuff is actually an optional extension. We could check the // info @@ -199,13 +199,13 @@ MantidWebServiceAPIJobManager::queryAllRemoteJobs() const { // the output and see if the values are there... if (jobData.find("SubmitDate") != jobData.end()) { jobData["SubmitDate"].getValue(value); - submitDates.push_back(value); + submitDates.emplace_back(value); jobData["StartDate"].getValue(value); - startDates.push_back(value); + startDates.emplace_back(value); jobData["CompletionDate"].getValue(value); - completionDates.push_back(value); + completionDates.emplace_back(value); } else { // push back empty strings just so all the array properties have the // same @@ -232,7 +232,7 @@ MantidWebServiceAPIJobManager::queryAllRemoteJobs() const { info.startDate = DateAndTime(startDates[i]); info.completionTime = DateAndTime(completionDates[i]); info.cmdLine = cmdLines[i]; - result.push_back(info); + result.emplace_back(info); } return result; @@ -264,7 +264,7 @@ std::vector<std::string> MantidWebServiceAPIJobManager::queryRemoteFile( resp["Files"].getValue(files); for (auto &file : files) { file.getValue(oneFile); - filenames.push_back(oneFile); + filenames.emplace_back(oneFile); } } else { diff --git a/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h b/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h index 74a64e459cc8ed71798c3db4c396dff0eaf98a8f..18850334d4e786c3286c5216668d58fae0d825db 100644 --- a/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h +++ b/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/PoldiSpectrumDomainFunction.h @@ -58,8 +58,8 @@ struct MANTID_SINQ_DLL Poldi2DHelper { for (const double offset : offsets) { double dEquivalent = Conversions::TOFtoD(offset, distance, sinTheta); double rounded = floor(dEquivalent / deltaD + 0.5); - dOffsets.push_back(static_cast<int>(rounded)); - dFractionalOffsets.push_back(dEquivalent - rounded * deltaD); + dOffsets.emplace_back(static_cast<int>(rounded)); + dFractionalOffsets.emplace_back(dEquivalent - rounded * deltaD); } } @@ -72,7 +72,7 @@ struct MANTID_SINQ_DLL Poldi2DHelper { current.reserve(dMaxN - dMinN); for (int i = dMinN; i <= dMaxN; ++i) { - current.push_back(static_cast<double>(i + 0.5) * deltaD); + current.emplace_back(static_cast<double>(i + 0.5) * deltaD); } domain = boost::make_shared<API::FunctionDomain1DVector>(current); @@ -86,7 +86,7 @@ struct MANTID_SINQ_DLL Poldi2DHelper { if (domain && timeTransformer) { factors.reserve(domain->size()); for (size_t i = 0; i < domain->size(); ++i) { - factors.push_back( + factors.emplace_back( timeTransformer->detectorElementIntensity((*domain)[i], index)); } } diff --git a/Framework/SINQ/src/InvertMDDim.cpp b/Framework/SINQ/src/InvertMDDim.cpp index cd090bc6aa36384972c2a022e72ac7b35b796123..4a69661aaf5ba7b581fee7046163707e1f6b36fb 100644 --- a/Framework/SINQ/src/InvertMDDim.cpp +++ b/Framework/SINQ/src/InvertMDDim.cpp @@ -42,7 +42,7 @@ void InvertMDDim::exec() { std::vector<IMDDimension_sptr> dimensions; for (int i = static_cast<int>(inWS->getNumDims()) - 1; i >= 0; i--) { boost::shared_ptr<const IMDDimension> dimi = inWS->getDimension(i); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dimi)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dimi)); } auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions); diff --git a/Framework/SINQ/src/LoadFlexiNexus.cpp b/Framework/SINQ/src/LoadFlexiNexus.cpp index 3d25c63ecfd193a8c90aa2d62b9a04e0f541f83b..4b0fbcb97b396cf0a45787e8334e237181054da7 100644 --- a/Framework/SINQ/src/LoadFlexiNexus.cpp +++ b/Framework/SINQ/src/LoadFlexiNexus.cpp @@ -217,7 +217,8 @@ void LoadFlexiNexus::loadMD(NeXus::File *fin) { std::vector<MDHistoDimension_sptr> dimensions; for (int k = static_cast<int>(inf.dims.size()) - 1; k >= 0; k--) { - dimensions.push_back(makeDimension(fin, k, static_cast<int>(inf.dims[k]))); + dimensions.emplace_back( + makeDimension(fin, k, static_cast<int>(inf.dims[k]))); } auto ws = boost::make_shared<MDHistoWorkspace>(dimensions); diff --git a/Framework/SINQ/src/PoldiFitPeaks1D2.cpp b/Framework/SINQ/src/PoldiFitPeaks1D2.cpp index 1c8f8610b23585e6ab488bed29941544a09654e8..7d63588e3fe22c6f46c87a0c21ff51612c488d09 100644 --- a/Framework/SINQ/src/PoldiFitPeaks1D2.cpp +++ b/Framework/SINQ/src/PoldiFitPeaks1D2.cpp @@ -193,7 +193,7 @@ std::vector<RefinedRange_sptr> PoldiFitPeaks1D2::getRefinedRanges( const PoldiPeakCollection_sptr &peaks) const { std::vector<RefinedRange_sptr> ranges; for (size_t i = 0; i < peaks->peakCount(); ++i) { - ranges.push_back( + ranges.emplace_back( boost::make_shared<RefinedRange>(peaks->peak(i), m_fwhmMultiples)); } @@ -206,7 +206,7 @@ std::vector<RefinedRange_sptr> PoldiFitPeaks1D2::getReducedRanges( std::sort(workingRanges.begin(), workingRanges.end()); std::vector<RefinedRange_sptr> reducedRanges; - reducedRanges.push_back( + reducedRanges.emplace_back( boost::make_shared<RefinedRange>(*(workingRanges.front()))); double allowedOverlap = getProperty("AllowedOverlap"); @@ -217,7 +217,7 @@ std::vector<RefinedRange_sptr> PoldiFitPeaks1D2::getReducedRanges( if (!lastReduced->contains(*current) && !lastReduced->overlaps(*current, allowedOverlap)) { - reducedRanges.push_back(boost::make_shared<RefinedRange>(*current)); + reducedRanges.emplace_back(boost::make_shared<RefinedRange>(*current)); } else { lastReduced->merge(*current); } diff --git a/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Framework/SINQ/src/PoldiFitPeaks2D.cpp index 3c814aa1a15d0074bdfa9504befd87d7af4db96b..74a4eef6c90ad845d286b2108c55f0d0d1e894e8 100644 --- a/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -163,7 +163,7 @@ PoldiFitPeaks2D::getNormalizedPeakCollections( PoldiPeakCollection_sptr integratedPeakCollection = getIntegratedPeakCollection(peakCollection); - normalizedPeakCollections.push_back( + normalizedPeakCollections.emplace_back( getNormalizedPeakCollection(integratedPeakCollection)); } @@ -326,7 +326,8 @@ std::vector<PoldiPeakCollection_sptr> PoldiFitPeaks2D::getCountPeakCollections( PoldiPeakCollection_sptr normalizedPeaks = getPeakCollectionFromFunction(localFunction); - countPeakCollections.push_back(getCountPeakCollection(normalizedPeaks)); + countPeakCollections.emplace_back( + getCountPeakCollection(normalizedPeaks)); } catch (const std::invalid_argument &) { // not a Poldi2DFunction - skip (the background functions) } @@ -675,7 +676,7 @@ PoldiFitPeaks2D::getUserSpecifiedTies(const IFunction_sptr &poldiFn) { for (auto ¶meter : parameters) { if (boost::algorithm::ends_with(parameter, tieParameter)) { - matchedParameters.push_back(parameter); + matchedParameters.emplace_back(parameter); } } @@ -692,7 +693,7 @@ PoldiFitPeaks2D::getUserSpecifiedTies(const IFunction_sptr &poldiFn) { for (auto par = matchedParameters.begin() + 1; par != matchedParameters.end(); ++par) { - tieComponents.push_back(*par + "=" + reference); + tieComponents.emplace_back(*par + "=" + reference); } break; } @@ -1320,7 +1321,7 @@ void PoldiFitPeaks2D::exec() { try { ITableWorkspace_sptr cell = getRefinedCellParameters(poldi2DFunction->getFunction(i)); - cells.push_back(cell); + cells.emplace_back(cell); } catch (const std::invalid_argument &) { // do nothing } diff --git a/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp b/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp index fed4f0750534fedadc1f5095d7cbc9e17c3b8db0..242f40a4db58c83e47d841b95c2145d2e82bb5f3 100644 --- a/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp +++ b/Framework/SINQ/src/PoldiIndexKnownCompounds.cpp @@ -171,7 +171,7 @@ void PoldiIndexKnownCompounds::initializeIndexedPeaks( newCollection->setProfileFunctionName( m_measuredPeaks->getProfileFunctionName()); - m_indexedPeaks.push_back(newCollection); + m_indexedPeaks.emplace_back(newCollection); } } @@ -240,7 +240,8 @@ PoldiIndexKnownCompounds::getPeakCollections( "Can only construct PoldiPeakCollection from a TableWorkspace."); } - peakCollections.push_back(boost::make_shared<PoldiPeakCollection>(tableWs)); + peakCollections.emplace_back( + boost::make_shared<PoldiPeakCollection>(tableWs)); } return peakCollections; @@ -337,7 +338,7 @@ std::vector<double> PoldiIndexKnownCompounds::getNormalizedContributions( throw std::invalid_argument("Contributions less than 0 are not allowed."); } - normalizedContributions.push_back(contribution / sum); + normalizedContributions.emplace_back(contribution / sum); } return normalizedContributions; @@ -558,7 +559,7 @@ PoldiIndexKnownCompounds::getIndexCandidatePairs( PoldiPeak_sptr currentCandidate = currentCandidateCollection->peak(p); if (isCandidate(peak, currentCandidate)) { - indexCandidates.push_back( + indexCandidates.emplace_back( IndexCandidatePair(peak, currentCandidate, i)); } } diff --git a/Framework/SINQ/src/PoldiPeakSearch.cpp b/Framework/SINQ/src/PoldiPeakSearch.cpp index e8adf33f45d0b34e5001e8067aefdbb566a3e856..f0a2e6f16dedf29387c966d1455cacce9334112e 100644 --- a/Framework/SINQ/src/PoldiPeakSearch.cpp +++ b/Framework/SINQ/src/PoldiPeakSearch.cpp @@ -82,9 +82,9 @@ PoldiPeakSearch::getNeighborSums(const HistogramY &correlationCounts) const { for (std::vector<size_t>::const_iterator index = validIndices.begin(); index != validIndices.end(); ++index) { - summedNeighborCounts.push_back(correlationCounts[(*index) - 1] + - correlationCounts[*index] + - correlationCounts[(*index) + 1]); + summedNeighborCounts.emplace_back(correlationCounts[(*index) - 1] + + correlationCounts[*index] + + correlationCounts[(*index) + 1]); } return summedNeighborCounts; @@ -157,7 +157,7 @@ PoldiPeakSearch::findPeaksRecursive(MantidVec::const_iterator begin, auto maxInRange = std::max_element(begin, end); std::list<MantidVec::const_iterator> peaks; - peaks.push_back(maxInRange); + peaks.emplace_back(maxInRange); // ...and perform same search on sub-list left of maximum... if (std::distance(begin, maxInRange) > m_minimumDistance) { @@ -201,7 +201,7 @@ PoldiPeakSearch::mapPeakPositionsToCorrelationData( for (std::list<MantidVec::const_iterator>::const_iterator peakPosition = peakPositions.begin(); peakPosition != peakPositions.end(); ++peakPosition) { - transformedIndices.push_back( + transformedIndices.emplace_back( originalDataStart + std::distance(baseDataStart, *peakPosition) + 1); } @@ -262,7 +262,7 @@ PoldiPeakSearch::getPeaks(const MantidVec::const_iterator &baseListStart, PoldiPeak_sptr newPeak = PoldiPeak::create( MillerIndices(), UncertainValue(xDataD), UncertainValue(**peak), fwhm); - peakData.push_back(newPeak); + peakData.emplace_back(newPeak); } return peakData; @@ -344,7 +344,7 @@ MantidVec PoldiPeakSearch::getBackground( for (auto point = correlationCounts.cbegin() + 1; point != correlationCounts.cend() - 1; ++point) { if (distanceToPeaksGreaterThanMinimum(peakPositions, point)) { - background.push_back(*point); + background.emplace_back(*point); } } @@ -477,7 +477,7 @@ double PoldiPeakSearch::getSn(MantidVec::const_iterator begin, temp.reserve(numberOfPoints - 1); for (int j = 0; j < static_cast<int>(numberOfPoints); ++j) { if (j != i) { - temp.push_back(fabs(*(begin + j) - currentValue)); + temp.emplace_back(fabs(*(begin + j) - currentValue)); } } std::sort(temp.begin(), temp.end()); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp index aabb3d9d721ffd6903e70e6713c096be742b9e01..9bfd8237ff9b6e2295d796e630611ddbc64a552c 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiAutoCorrelationCore.cpp @@ -322,7 +322,7 @@ PoldiAutoCorrelationCore::getRawCorrelatedIntensity(double dValue, std::accumulate(cmess.begin(), cmess.end(), UncertainValue(0.0, 0.0), &UncertainValue::plainAddition); - current.push_back(sum); + current.emplace_back(sum); } /* Finally, the list of I/sigma values is reduced to I. @@ -601,7 +601,7 @@ std::vector<double> PoldiAutoCorrelationCore::getTofsFor1Angstrom( sinThetas.reserve(elements.size()); for (std::vector<double>::const_iterator twoTheta = twoThetas.begin(); twoTheta != twoThetas.end(); ++twoTheta) { - sinThetas.push_back(sin(*twoTheta / 2.0)); + sinThetas.emplace_back(sin(*twoTheta / 2.0)); } // Same goes for distances diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiPeakCollection.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiPeakCollection.cpp index ccb1279de9850ea25fd2896d49bdb952edf67d6e..e5056b714c84a1a11b148a6d8f5ebdfaa634734b 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiPeakCollection.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiPeakCollection.cpp @@ -76,7 +76,7 @@ PoldiPeakCollection_sptr PoldiPeakCollection::clone() { size_t PoldiPeakCollection::peakCount() const { return m_peaks.size(); } void PoldiPeakCollection::addPeak(const PoldiPeak_sptr &newPeak) { - m_peaks.push_back(newPeak); + m_peaks.emplace_back(newPeak); } PoldiPeak_sptr PoldiPeakCollection::peak(size_t index) const { diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp index 614887734fd0e4f25a88dd54e2845f157c5c620a..d505029d93c10c753621872f353f8f5122b289de 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiSpectrumDomainFunction.cpp @@ -249,7 +249,7 @@ void PoldiSpectrumDomainFunction::initializeInstrumentParameters( Conversions::dtoTOF(dMin, distance, sinTheta) / m_deltaT); curr->setFactors(m_timeTransformer, static_cast<size_t>(i)); - m_2dHelpers.push_back(curr); + m_2dHelpers.emplace_back(curr); } } diff --git a/Framework/SINQ/src/ProjectMD.cpp b/Framework/SINQ/src/ProjectMD.cpp index 811caf648cd7e648c022653a072c5783be2b9319..73e39ec2f7f1766478b7d93b485074478222b48b 100644 --- a/Framework/SINQ/src/ProjectMD.cpp +++ b/Framework/SINQ/src/ProjectMD.cpp @@ -61,7 +61,7 @@ void ProjectMD::exec() { std::vector<IMDDimension_sptr> dimensions; for (size_t i = 0; i < inWS->getNumDims(); i++) { if (i != dimNo) { - dimensions.push_back( + dimensions.emplace_back( boost::const_pointer_cast<IMDDimension>(inWS->getDimension(i))); } else { boost::shared_ptr<const IMDDimension> dimi = inWS->getDimension(i); diff --git a/Framework/SINQ/src/SINQHMListener.cpp b/Framework/SINQ/src/SINQHMListener.cpp index d5ec0eb30ca4b6f073062dace678b60b789f26f6..835f7cae05aecd707acf974f452e0218a990fb78 100644 --- a/Framework/SINQ/src/SINQHMListener.cpp +++ b/Framework/SINQ/src/SINQHMListener.cpp @@ -109,7 +109,7 @@ boost::shared_ptr<Workspace> SINQHMListener::extractData() { std::vector<MDHistoDimension_sptr> dimensions; for (int i = 0; i < rank; i++) { Mantid::Geometry::GeneralFrame frame(dimNames[i], ""); - dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( + dimensions.emplace_back(MDHistoDimension_sptr(new MDHistoDimension( dimNames[i], dimNames[i], frame, .0, coord_t(dim[i]), dim[i]))); } auto ws = boost::make_shared<MDHistoWorkspace>(dimensions); diff --git a/Framework/SINQ/src/SINQTranspose3D.cpp b/Framework/SINQ/src/SINQTranspose3D.cpp index 7fc90b88547d677255ff0e7604f9de0b41e0280b..51593003dd6811967aa5f17a144c498617640d51 100644 --- a/Framework/SINQ/src/SINQTranspose3D.cpp +++ b/Framework/SINQ/src/SINQTranspose3D.cpp @@ -67,9 +67,9 @@ void SINQTranspose3D::doYXZ(IMDHistoWorkspace_sptr inWS) { z = inWS->getZDimension(); std::vector<IMDDimension_sptr> dimensions; - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(y)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(x)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(y)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(x)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(z)); auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions); @@ -104,9 +104,9 @@ void SINQTranspose3D::doXZY(IMDHistoWorkspace_sptr inWS) { z = inWS->getZDimension(); std::vector<IMDDimension_sptr> dimensions; - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(x)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(y)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(x)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(z)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(y)); auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions); @@ -143,9 +143,9 @@ void SINQTranspose3D::doTRICS(IMDHistoWorkspace_sptr inWS) { z = inWS->getZDimension(); std::vector<IMDDimension_sptr> dimensions; - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(x)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(y)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(x)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(z)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(y)); auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions); outWS->setTo(.0, .0, .0); @@ -182,9 +182,9 @@ void SINQTranspose3D::doAMOR(IMDHistoWorkspace_sptr inWS) { z = inWS->getZDimension(); std::vector<IMDDimension_sptr> dimensions; - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(y)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(x)); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(z)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(y)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(x)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(z)); auto outWS = boost::make_shared<MDHistoWorkspace>(dimensions); outWS->setTo(.0, .0, .0); diff --git a/Framework/SINQ/src/SliceMDHisto.cpp b/Framework/SINQ/src/SliceMDHisto.cpp index 192aded94b97724f3f2dd6b4c3075186a380b383..54f3981332c55877abae093a6a6f6d29cc2456de 100644 --- a/Framework/SINQ/src/SliceMDHisto.cpp +++ b/Framework/SINQ/src/SliceMDHisto.cpp @@ -46,7 +46,7 @@ void SliceMDHisto::exec() { m_rank = static_cast<unsigned int>(inWS->getNumDims()); for (unsigned int i = 0; i < m_rank; i++) { boost::shared_ptr<const IMDDimension> arDim = inWS->getDimension(i); - m_dim.push_back(static_cast<int>(arDim->getNBins())); + m_dim.emplace_back(static_cast<int>(arDim->getNBins())); } std::vector<int> start = getProperty("Start"); @@ -80,7 +80,7 @@ void SliceMDHisto::exec() { std::vector<MDHistoDimension_sptr> dimensions; for (unsigned int k = 0; k < m_rank; ++k) { boost::shared_ptr<const IMDDimension> arDim = inWS->getDimension(k); - dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( + dimensions.emplace_back(MDHistoDimension_sptr(new MDHistoDimension( arDim->getName(), arDim->getName(), arDim->getMDFrame(), arDim->getX(start[k]), arDim->getX(end[k]), end[k] - start[k]))); } diff --git a/Framework/SINQ/test/InvertMDDimTest.h b/Framework/SINQ/test/InvertMDDimTest.h index becc8d5b290c10190c42f6e807a39b0833fe3591..23d0aab197b41c5da38ee0aa1000474074a08e7f 100644 --- a/Framework/SINQ/test/InvertMDDimTest.h +++ b/Framework/SINQ/test/InvertMDDimTest.h @@ -122,15 +122,15 @@ private: dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("x"), std::string("ID0"), frame, coord_t(-5), coord_t(5), size_t(10))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("y"), std::string("ID1"), frame, coord_t(-6), coord_t(6), size_t(12))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("z"), std::string("ID2"), frame, coord_t(-10), coord_t(10), size_t(20))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions)); outWS->setTo(1., 1., .0); diff --git a/Framework/SINQ/test/MDHistoToWorkspace2DTest.h b/Framework/SINQ/test/MDHistoToWorkspace2DTest.h index 0aa0c3b5cecb04f7971e3d948427b56a6cf2bff6..ce4a24501f8fc5eab519b229bca9d5a43bda50d6 100644 --- a/Framework/SINQ/test/MDHistoToWorkspace2DTest.h +++ b/Framework/SINQ/test/MDHistoToWorkspace2DTest.h @@ -84,15 +84,15 @@ private: dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("x"), std::string("ID0"), frame, coord_t(-50), coord_t(50), size_t(100))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("y"), std::string("ID1"), frame, coord_t(-60), coord_t(60), size_t(120))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("z"), std::string("ID2"), frame, coord_t(-100), coord_t(100), size_t(200))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions)); outWS->setTo(1., 1., .0); diff --git a/Framework/SINQ/test/MillerIndicesTest.h b/Framework/SINQ/test/MillerIndicesTest.h index de277df69a294c22279ac96e502d4efcc393869a..998234e6f7a66a4d09d76ea93af9299340dc43b1 100644 --- a/Framework/SINQ/test/MillerIndicesTest.h +++ b/Framework/SINQ/test/MillerIndicesTest.h @@ -32,16 +32,16 @@ public: void testvectorConstructor() { std::vector<int> hkl; - hkl.push_back(2); - hkl.push_back(5); - hkl.push_back(4); + hkl.emplace_back(2); + hkl.emplace_back(5); + hkl.emplace_back(4); MillerIndices hklMI(hkl); TS_ASSERT_EQUALS(hklMI.h(), 2); TS_ASSERT_EQUALS(hklMI.k(), 5); TS_ASSERT_EQUALS(hklMI.l(), 4); - hkl.push_back(3); + hkl.emplace_back(3); TS_ASSERT_THROWS(MillerIndices fails(hkl), const std::runtime_error &); } diff --git a/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h b/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h index 459fcbfa91160a08c7178714246dceb8eae7c5f2..963b08e6e45ea3022b1614f793f9ea4a2df7bee7 100644 --- a/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h +++ b/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h @@ -304,16 +304,16 @@ public: UncertainValue pair2(0.0, 2.0); std::vector<UncertainValue> goodList; - goodList.push_back(pair0); - goodList.push_back(pair1); + goodList.emplace_back(pair0); + goodList.emplace_back(pair1); TS_ASSERT_DELTA(autoCorrelationCore.reduceChopperSlitList(goodList, 1.0), 3.428571428571428, 1e-6); std::vector<UncertainValue> badList; - badList.push_back(pair0); - badList.push_back(pair1); - badList.push_back(pair2); + badList.emplace_back(pair0); + badList.emplace_back(pair1); + badList.emplace_back(pair2); TS_ASSERT_EQUALS(autoCorrelationCore.reduceChopperSlitList(badList, 1.0), 0.0); diff --git a/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h b/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h index 38778141b928b45d6eff1c4182435ad38512f46a..29aba330b8368e1a816ffbf9d132fe7da0c1d7c4 100644 --- a/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h +++ b/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h @@ -126,9 +126,9 @@ public: void testSetExpectedPhases() { std::vector<PoldiPeakCollection_sptr> expectedPeaks; - expectedPeaks.push_back( + expectedPeaks.emplace_back( PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum()); - expectedPeaks.push_back( + expectedPeaks.emplace_back( PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum()); TestablePoldiIndexKnownCompounds alg; @@ -151,9 +151,9 @@ public: void testInitializeIndexedPeaks() { std::vector<PoldiPeakCollection_sptr> expectedPeaks; - expectedPeaks.push_back( + expectedPeaks.emplace_back( PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum()); - expectedPeaks.push_back( + expectedPeaks.emplace_back( PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum()); TestablePoldiIndexKnownCompounds alg; @@ -234,18 +234,18 @@ public: void testGetPeakCollections() { std::vector<Workspace_sptr> goodWorkspaces; - goodWorkspaces.push_back( + goodWorkspaces.emplace_back( PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace()); - goodWorkspaces.push_back( + goodWorkspaces.emplace_back( PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace()); TestablePoldiIndexKnownCompounds alg; TS_ASSERT_THROWS_NOTHING(alg.getPeakCollections(goodWorkspaces)); std::vector<Workspace_sptr> badWorkspaces; - badWorkspaces.push_back( + badWorkspaces.emplace_back( PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace()); - badWorkspaces.push_back( + badWorkspaces.emplace_back( WorkspaceCreationHelper::create1DWorkspaceRand(10, true)); TS_ASSERT_THROWS(alg.getPeakCollections(badWorkspaces), @@ -334,8 +334,8 @@ public: void testGetNormalizedContributions() { std::vector<double> contributions; - contributions.push_back(4.0); - contributions.push_back(1.0); + contributions.emplace_back(4.0); + contributions.emplace_back(1.0); TestablePoldiIndexKnownCompounds alg; TS_ASSERT_THROWS_NOTHING(alg.getNormalizedContributions(contributions)); diff --git a/Framework/SINQ/test/PoldiPeakSearchTest.h b/Framework/SINQ/test/PoldiPeakSearchTest.h index becb7b21893f585d611aff5495fc805e25d23d27..a4df2faeac8a20dee708caab586947093fa87577 100644 --- a/Framework/SINQ/test/PoldiPeakSearchTest.h +++ b/Framework/SINQ/test/PoldiPeakSearchTest.h @@ -159,22 +159,22 @@ public: TestablePoldiPeakSearch poldiPeakSearch; std::vector<double> firstVector; - firstVector.push_back(2.0); - firstVector.push_back(3.0); - firstVector.push_back(4.0); - firstVector.push_back(5.0); + firstVector.emplace_back(2.0); + firstVector.emplace_back(3.0); + firstVector.emplace_back(4.0); + firstVector.emplace_back(5.0); std::vector<double> secondVector; - secondVector.push_back(1.5); - secondVector.push_back(2.5); - secondVector.push_back(3.5); - secondVector.push_back(4.5); - secondVector.push_back(5.5); - secondVector.push_back(6.5); + secondVector.emplace_back(1.5); + secondVector.emplace_back(2.5); + secondVector.emplace_back(3.5); + secondVector.emplace_back(4.5); + secondVector.emplace_back(5.5); + secondVector.emplace_back(6.5); std::list<std::vector<double>::const_iterator> firstIterators; - firstIterators.push_back(firstVector.begin() + 2); - firstIterators.push_back(firstVector.begin() + 3); + firstIterators.emplace_back(firstVector.begin() + 2); + firstIterators.emplace_back(firstVector.begin() + 3); std::list<std::vector<double>::const_iterator> secondIterators = poldiPeakSearch.mapPeakPositionsToCorrelationData( diff --git a/Framework/SINQ/test/PoldiPeakTest.h b/Framework/SINQ/test/PoldiPeakTest.h index 9e73ad6ad2162d09ca95e341762f60522315c3d0..bf58d9a5e7fe3fcd73d4a88140018ee9e5b91cd0 100644 --- a/Framework/SINQ/test/PoldiPeakTest.h +++ b/Framework/SINQ/test/PoldiPeakTest.h @@ -139,9 +139,9 @@ public: void testSortingGreater() { std::vector<PoldiPeak_sptr> peaks; - peaks.push_back(PoldiPeak::create(1.0, 200.0)); - peaks.push_back(PoldiPeak::create(2.0, 20.0)); - peaks.push_back(PoldiPeak::create(3.0, 800.0)); + peaks.emplace_back(PoldiPeak::create(1.0, 200.0)); + peaks.emplace_back(PoldiPeak::create(2.0, 20.0)); + peaks.emplace_back(PoldiPeak::create(3.0, 800.0)); std::sort( peaks.begin(), peaks.end(), @@ -160,9 +160,9 @@ public: void testSortingLess() { std::vector<PoldiPeak_sptr> peaks; - peaks.push_back(PoldiPeak::create(1.0, 200.0)); - peaks.push_back(PoldiPeak::create(2.0, 20.0)); - peaks.push_back(PoldiPeak::create(3.0, 800.0)); + peaks.emplace_back(PoldiPeak::create(1.0, 200.0)); + peaks.emplace_back(PoldiPeak::create(2.0, 20.0)); + peaks.emplace_back(PoldiPeak::create(3.0, 800.0)); std::sort(peaks.begin(), peaks.end(), boost::bind<bool>(&PoldiPeak::lessThan, _1, _2, &PoldiPeak::q)); diff --git a/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h b/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h index a1aba0aad461c513f35b4d6384b8adc3a7fecfd9..68502c23b8dbea39c3c05aa97ec4dfe58a782487 100644 --- a/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h +++ b/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h @@ -94,8 +94,8 @@ public: UncertainValue pair1(3.0, 2.0); std::vector<UncertainValue> goodList; - goodList.push_back(pair0); - goodList.push_back(pair1); + goodList.emplace_back(pair0); + goodList.emplace_back(pair1); TS_ASSERT_EQUALS(core.reduceChopperSlitList(goodList, 1.0), 3.0625); } diff --git a/Framework/SINQ/test/ProjectMDTest.h b/Framework/SINQ/test/ProjectMDTest.h index ddb4a90d5f91b3642d335bacd62a66b57d751fca..393de3df906e9c4d24fa16791fc4ac4088d37586 100644 --- a/Framework/SINQ/test/ProjectMDTest.h +++ b/Framework/SINQ/test/ProjectMDTest.h @@ -240,15 +240,15 @@ private: dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("x"), std::string("ID0"), frame, coord_t(-5), coord_t(5), size_t(10))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("y"), std::string("ID1"), frame, coord_t(-6), coord_t(6), size_t(12))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("z"), std::string("ID2"), frame, coord_t(-10), coord_t(10), size_t(20))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions)); outWS->setTo(1., 1., .0); diff --git a/Framework/SINQ/test/SliceMDHistoTest.h b/Framework/SINQ/test/SliceMDHistoTest.h index 7d89251577850345bc26d58c261d71ff09cd96a9..fd2b94351948ebb0435362a06aebdbf129efdc51 100644 --- a/Framework/SINQ/test/SliceMDHistoTest.h +++ b/Framework/SINQ/test/SliceMDHistoTest.h @@ -101,15 +101,15 @@ private: dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("x"), std::string("ID0"), frame, coord_t(-50), coord_t(50), size_t(100))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("y"), std::string("ID1"), frame, coord_t(-60), coord_t(60), size_t(120))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); dim = MDHistoDimension_sptr( new MDHistoDimension(std::string("z"), std::string("ID2"), frame, coord_t(-100), coord_t(100), size_t(200))); - dimensions.push_back(boost::const_pointer_cast<IMDDimension>(dim)); + dimensions.emplace_back(boost::const_pointer_cast<IMDDimension>(dim)); MDHistoWorkspace_sptr outWS(new MDHistoWorkspace(dimensions)); outWS->setTo(1., 1., .0); diff --git a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp index b21bd4f70d15bcfe45e396b14269bf686a9c29ac..3ece26d526720bf92f8fb748142510f7fb7ec823 100644 --- a/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp +++ b/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp @@ -1262,7 +1262,7 @@ std::vector<std::string> ScriptRepositoryImpl::check4Update() { // THE SAME AS it->status in (REMOTE_CHANGED, BOTH_CHANGED) if (file.second.status & REMOTE_CHANGED) { download(file.first); - output_list.push_back(file.first); + output_list.emplace_back(file.first); g_log.debug() << "Update file " << file.first << " to more recently version available\n"; } @@ -1319,7 +1319,7 @@ int ScriptRepositoryImpl::setAutoUpdate(const std::string &input_path, RepositoryEntry &entry = it->second; if (entryPath.compare(0, path.size(), path) == 0 && entry.status != REMOTE_ONLY && entry.status != LOCAL_ONLY) - filesToUpdate.push_back(entryPath); + filesToUpdate.emplace_back(entryPath); } try { @@ -1515,13 +1515,13 @@ void ScriptRepositoryImpl::parseDownloadedEntries(Repository &repo) { // if the entry was not found locally or remotely, this means // that this entry was deleted (remotely or locally), // so it should not appear at local_repository json any more - entries_to_delete.push_back(filepath); + entries_to_delete.emplace_back(filepath); folders_of_deleted.insert(getParentFolder(filepath)); } } else { // this entry was never created before, so it should not // exist in local repository json - entries_to_delete.push_back(filepath); + entries_to_delete.emplace_back(filepath); } } // end loop FOREACH entry in local json @@ -1540,7 +1540,7 @@ void ScriptRepositoryImpl::parseDownloadedEntries(Repository &repo) { if (entry_it->second.auto_update) { entry_it->second.auto_update = false; - entries_to_delete.push_back(folder); + entries_to_delete.emplace_back(folder); } } @@ -1724,9 +1724,9 @@ std::string ScriptRepositoryImpl::getParentFolder(const std::string &file) { std::string ScriptRepositoryImpl::convertPath(const std::string &path) { std::vector<std::string> lookAfter; using Poco::Path; - lookAfter.push_back(Path::current()); - // lookAfter.push_back(Path::home()); - lookAfter.push_back(local_repository); + lookAfter.emplace_back(Path::current()); + // lookAfter.emplace_back(Path::home()); + lookAfter.emplace_back(local_repository); Path pathFound; bool file_is_local; diff --git a/Framework/TestHelpers/src/MDEventsTestHelper.cpp b/Framework/TestHelpers/src/MDEventsTestHelper.cpp index adfac1f7de89da64242e8ab9529a719a4f31704a..6410186ffd3658751e20c5c235f23a3061cf8b13 100644 --- a/Framework/TestHelpers/src/MDEventsTestHelper.cpp +++ b/Framework/TestHelpers/src/MDEventsTestHelper.cpp @@ -255,7 +255,7 @@ makeFakeMDHistoWorkspaceGeneral(size_t numDims, double signal, std::vector<Mantid::Geometry::MDHistoDimension_sptr> dimensions; for (size_t d = 0; d < numDims; d++) - dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( + dimensions.emplace_back(MDHistoDimension_sptr(new MDHistoDimension( names[d], names[d], frame, min[d], max[d], numBins[d]))); MDHistoWorkspace_sptr ws_sptr = @@ -289,7 +289,7 @@ MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( Mantid::Geometry::GeneralFrame frame( Mantid::Geometry::GeneralFrame::GeneralFrameDistance, "m"); for (size_t d = 0; d < numDims; d++) - dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( + dimensions.emplace_back(MDHistoDimension_sptr(new MDHistoDimension( names[d], names[d], frame, min[d], max[d], numBins[d]))); MDHistoWorkspace_sptr ws_sptr = diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp index d8493ceb9b53638ea0fc85dc8ab7a8558c35846d..69756b1b455a49de8ccc0322d067ac443a4a0f5c 100644 --- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp +++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp @@ -419,7 +419,7 @@ MatrixWorkspace_sptr create2DDetectorScanWorkspaceWithFullInstrument( std::vector<double> timeRanges; for (size_t i = 0; i < nTimeIndexes; ++i) { - timeRanges.push_back(double(i + firstInterval)); + timeRanges.emplace_back(double(i + firstInterval)); } builder.setTimeRanges(DateAndTime(int(startTime), 0), timeRanges); @@ -1099,7 +1099,7 @@ createProcessedInelasticWS(const std::vector<double> &L2, std::vector<double> E_transfer; E_transfer.reserve(numBins); for (size_t i = 0; i <= numBins; i++) { - E_transfer.push_back(Emin + static_cast<double>(i) * dE); + E_transfer.emplace_back(Emin + static_cast<double>(i) * dE); } ws->mutableX(j) = std::move(E_transfer); } diff --git a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp index 7a90e59b31a81ab25ef04ef6c208ea0945ec18a2..19a2cfbfcb27f09e8642d18c85e63967a8daeb10 100644 --- a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp +++ b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp @@ -381,9 +381,9 @@ void AlignAndFocusPowder::exec() { if (dmin > 0. && dmax > dmin) { double step = m_params[0]; m_params.clear(); - m_params.push_back(dmin); - m_params.push_back(step); - m_params.push_back(dmax); + m_params.emplace_back(dmin); + m_params.emplace_back(step); + m_params.emplace_back(dmax); g_log.information() << "d-Spacing binning updated: " << m_params[0] << " " << m_params[1] << " " << m_params[2] << "\n"; @@ -398,8 +398,8 @@ void AlignAndFocusPowder::exec() { if (tmin > 0. && tmax > tmin) { double step = m_params[0]; m_params[0] = tmin; - m_params.push_back(step); - m_params.push_back(tmax); + m_params.emplace_back(step); + m_params.emplace_back(tmax); g_log.information() << "TOF binning updated: " << m_params[0] << " " << m_params[1] << " " << m_params[2] << "\n"; } else { @@ -965,7 +965,7 @@ AlignAndFocusPowder::conjoinWorkspaces(API::MatrixWorkspace_sptr ws1, std::vector<specnum_t> origspecNos; for (size_t i = 0; i < nspec1; ++i) { specnum_t tmpspecNo = ws1->getSpectrum(i).getSpectrumNo(); - origspecNos.push_back(tmpspecNo); + origspecNos.emplace_back(tmpspecNo); if (tmpspecNo > maxspecNo1) maxspecNo1 = tmpspecNo; } diff --git a/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp b/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp index 99023bd6784f1b4121c1d958b4696e9c479ae95b..9db495f43be83ee6e6f01b629028a4cb745e26b6 100644 --- a/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp +++ b/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp @@ -133,9 +133,9 @@ void DgsConvertToEnergyTransfer::exec() { double emin = -0.5 * eiGuess; double deltaE = 0.01 * eiGuess; double emax = 0.99 * eiGuess; - etBinning.push_back(emin); - etBinning.push_back(deltaE); - etBinning.push_back(emax); + etBinning.emplace_back(emin); + etBinning.emplace_back(deltaE); + etBinning.emplace_back(emax); } double incidentEnergy = 0.0; diff --git a/Framework/WorkflowAlgorithms/src/EQSANSPatchSensitivity.cpp b/Framework/WorkflowAlgorithms/src/EQSANSPatchSensitivity.cpp index 678e4f04347ecd7cc6e8642f0f0ec3aecf091466..a02ea021e56293841e454bf74a503431909d9a69 100644 --- a/Framework/WorkflowAlgorithms/src/EQSANSPatchSensitivity.cpp +++ b/Framework/WorkflowAlgorithms/src/EQSANSPatchSensitivity.cpp @@ -79,7 +79,7 @@ void EQSANSPatchSensitivity::exec() { // If this detector is masked, skip to the next one if (spectrumInfo.isMasked(iDet)) - patched_ids.push_back(iDet); + patched_ids.emplace_back(iDet); else { if (!inSpectrumInfo.isMasked(iDet)) { double yPosition = spectrumInfo.position(iDet).Y(); diff --git a/Framework/WorkflowAlgorithms/src/SANSBeamFinder.cpp b/Framework/WorkflowAlgorithms/src/SANSBeamFinder.cpp index 8fdb153a3bf91d142430fbb11e6f835f98c4c762..9728bc2999b01e0f2d5c8426730c4debf9a1df90 100644 --- a/Framework/WorkflowAlgorithms/src/SANSBeamFinder.cpp +++ b/Framework/WorkflowAlgorithms/src/SANSBeamFinder.cpp @@ -268,12 +268,12 @@ void SANSBeamFinder::maskEdges(MatrixWorkspace_sptr beamCenterWS, int high, // right for (int i = 0; i < right * component->idstep(); i++) { - IDs.push_back(component->idstart() + i); + IDs.emplace_back(component->idstart() + i); } // left for (int i = component->maxDetectorID(); i > (component->maxDetectorID() - left * component->idstep()); i--) { - IDs.push_back(i); + IDs.emplace_back(i); } // low // 0,256,512,768,..,1,257,513 @@ -282,7 +282,7 @@ void SANSBeamFinder::maskEdges(MatrixWorkspace_sptr beamCenterWS, int high, i < component->nelements() * component->idstep() - component->idstep() + low + component->idstart(); i += component->idstep()) { - IDs.push_back(i); + IDs.emplace_back(i); } } // high @@ -292,7 +292,7 @@ void SANSBeamFinder::maskEdges(MatrixWorkspace_sptr beamCenterWS, int high, i < component->nelements() * component->idstep() + component->idstart(); i += component->idstep()) { - IDs.push_back(i); + IDs.emplace_back(i); } } diff --git a/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h b/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h index 24db7842b0c50a12dad2c4aadda3bf40deae4f5a..9889ffc0144b4144af77d727e93b2884bfc18b02 100644 --- a/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h +++ b/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h @@ -739,7 +739,7 @@ public: std::string delimiter = ",") { std::vector<std::string> vec; for (size_t i = 0; i < ws->getNumberHistograms(); i++) - vec.push_back(boost::lexical_cast<std::string>(val)); + vec.emplace_back(boost::lexical_cast<std::string>(val)); std::string joined = boost::algorithm::join(vec, delimiter + " "); return joined; } diff --git a/Framework/WorkflowAlgorithms/test/MuonProcessTest.h b/Framework/WorkflowAlgorithms/test/MuonProcessTest.h index bca49d1a1fcf492654111fdc1cce6a3c983f9dfd..b2b74891a98de177f9260ea597b5b5aafb332925 100644 --- a/Framework/WorkflowAlgorithms/test/MuonProcessTest.h +++ b/Framework/WorkflowAlgorithms/test/MuonProcessTest.h @@ -55,10 +55,10 @@ public: std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); @@ -111,10 +111,10 @@ public: std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); @@ -160,10 +160,10 @@ public: std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); @@ -209,9 +209,9 @@ public: std::vector<int> group1, group2; for (int i = 33; i <= 64; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 1; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); @@ -263,9 +263,9 @@ public: std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); @@ -322,9 +322,9 @@ public: std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); @@ -431,9 +431,9 @@ public: ScopedWorkspace output; std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); MuonProcess alg; @@ -461,9 +461,9 @@ public: ScopedWorkspace output; std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); MuonProcess alg; @@ -492,9 +492,9 @@ public: ScopedWorkspace output; std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); MuonProcess alg; @@ -521,9 +521,9 @@ public: ScopedWorkspace output; std::vector<int> group1, group2; for (int i = 1; i <= 16; ++i) - group1.push_back(i); + group1.emplace_back(i); for (int i = 17; i <= 32; ++i) - group2.push_back(i); + group2.emplace_back(i); TableWorkspace_sptr grouping = createGroupingTable(group1, group2); MuonProcess alg; diff --git a/MantidPlot/src/ApplicationWindow.cpp b/MantidPlot/src/ApplicationWindow.cpp index fc328bb42c6a65bac6ec452950aee5aa8ebea4d3..a403111cc381f952ab5a9833f4f60e0c5a4aac4f 100644 --- a/MantidPlot/src/ApplicationWindow.cpp +++ b/MantidPlot/src/ApplicationWindow.cpp @@ -6038,13 +6038,13 @@ int ApplicationWindow::execSaveProjectDialog() { for (auto window : getSerialisableWindows()) { auto win = dynamic_cast<IProjectSerialisable *>(window); if (win) - windows.push_back(win); + windows.emplace_back(win); } for (auto window : getAllWindows()) { auto win = dynamic_cast<IProjectSerialisable *>(window); if (win) - windows.push_back(win); + windows.emplace_back(win); } const QString pyInterfaceMarkerProperty("launcher"); diff --git a/MantidPlot/src/FunctionCurve.cpp b/MantidPlot/src/FunctionCurve.cpp index 9566e5a361b7ad374ea2b497e30fc7660a07d810..0d658b286bf99ff411c09a373e45db170af2c31e 100644 --- a/MantidPlot/src/FunctionCurve.cpp +++ b/MantidPlot/src/FunctionCurve.cpp @@ -157,7 +157,7 @@ void FunctionCurve::loadData(int points) { continue; if (x > d_to) break; - X.push_back(x); + X.emplace_back(x); } // Create the function and initialize it using fnInput which was saved in @@ -276,7 +276,7 @@ void FunctionCurve::loadMantidData(Mantid::API::MatrixWorkspace_const_sptr ws, continue; if (x > d_to) break; - X.push_back(x); + X.emplace_back(x); } // Create the function and initialize it using fnInput which was saved in diff --git a/MantidPlot/src/Graph.cpp b/MantidPlot/src/Graph.cpp index a2a27feee466eac6abce72806170c28f388eccfd..dade7c936cdfd2dce16ee714311fda56f6c0c4a4 100644 --- a/MantidPlot/src/Graph.cpp +++ b/MantidPlot/src/Graph.cpp @@ -4767,7 +4767,7 @@ Spectrogram *Graph::plotSpectrogram(Spectrogram *d_spectrogram, *d_plot->axisScaleDiv(QwtPlot::yRight)); for (int i = 0; i < QwtPlot::axisCnt; i++) { - updatedaxis.push_back(0); + updatedaxis.emplace_back(0); } enableFixedAspectRatio( diff --git a/MantidPlot/src/Graph3D.cpp b/MantidPlot/src/Graph3D.cpp index efa6bcd3fcab89cd53e3b90a27762b62484e55da..44a3a86a628cd82b894d37c3e3739db319df568c 100644 --- a/MantidPlot/src/Graph3D.cpp +++ b/MantidPlot/src/Graph3D.cpp @@ -541,12 +541,12 @@ void Graph3D::loadData(Table *table, int xCol, int yCol, int zCol, double xl, (x < xl || x > xr || y < yl || y > yr || z < zl || z > zr)) continue; - data.push_back(Triple(x, y, z)); + data.emplace_back(Triple(x, y, z)); Qwt3D::Cell cell; - cell.push_back(index); + cell.emplace_back(index); if (index > 0) - cell.push_back(index - 1); - cells.push_back(cell); + cell.emplace_back(index - 1); + cells.emplace_back(cell); index++; } } @@ -2253,7 +2253,7 @@ void Graph3D::setDataColors(const QColor &cMin, const QColor &cMax) { rgb.b = b1 - i * stepB; rgb.a = alpha; - cv.push_back(rgb); + cv.emplace_back(rgb); } col_ = new StandardColor(sp); @@ -2368,7 +2368,7 @@ bool Graph3D::openColorMap(ColorVector &cv, QString fname) { rgb.r /= 255; rgb.g /= 255; rgb.b /= 255; - cv.push_back(rgb); + cv.emplace_back(rgb); } } return true; diff --git a/MantidPlot/src/Mantid/MantidSurfaceContourPlotGenerator.cpp b/MantidPlot/src/Mantid/MantidSurfaceContourPlotGenerator.cpp index 83068dab3738624e7d7d9fcf28eb641cb6e53247..d4062f7ea8b655f47006fd11b41e4a3e6e09820c 100644 --- a/MantidPlot/src/Mantid/MantidSurfaceContourPlotGenerator.cpp +++ b/MantidPlot/src/Mantid/MantidSurfaceContourPlotGenerator.cpp @@ -189,9 +189,9 @@ MantidSurfaceContourPlotGenerator::createWorkspaceForGroupPlot( matrixWS->setSharedY(i, ws->sharedY(index)); matrixWS->setSharedE(i, ws->sharedE(index)); if (logName == MantidWSIndexWidget::CUSTOM) { - logValues.push_back(getSingleLogValue(i, customLogValues)); + logValues.emplace_back(getSingleLogValue(i, customLogValues)); } else { - logValues.push_back(getSingleLogValue(i, ws, logName)); + logValues.emplace_back(getSingleLogValue(i, ws, logName)); } } } diff --git a/MantidPlot/src/Mantid/MantidTable.cpp b/MantidPlot/src/Mantid/MantidTable.cpp index 5b4351b55ae3e987fa9b5ac04402f60e308d8f1e..de7fca3e4824045a84a2e30254a5669c4a8480f0 100644 --- a/MantidPlot/src/Mantid/MantidTable.cpp +++ b/MantidPlot/src/Mantid/MantidTable.cpp @@ -403,7 +403,7 @@ void MantidTable::sortColumn(int col, int order) { // Customized sorting routine for this TableWorkspace std::vector<std::pair<std::string, bool>> criteria; // Only one criterion in sorting - criteria.push_back(std::pair<std::string, bool>( + criteria.emplace_back(std::pair<std::string, bool>( m_ws->getColumn(col)->name(), (order == 0))); m_ws->sort(criteria); // Refresh the table @@ -437,7 +437,7 @@ void MantidTable::sortColumns(const QStringList &s, int type, int order, if (n != std::string::npos && n < col.size() - 1) col = col.substr(n + 1, col.size() - n - 1); // Only one criterion in sorting - criteria.push_back(std::pair<std::string, bool>(col, (order == 0))); + criteria.emplace_back(std::pair<std::string, bool>(col, (order == 0))); m_ws->sort(criteria); // Refresh the table this->fillTable(); diff --git a/MantidPlot/src/Mantid/MantidUI.cpp b/MantidPlot/src/Mantid/MantidUI.cpp index 5510c6c2a90ab5c137c3428b8b39a66e6efa4d3e..91c33995e2ce5c3827f1145e3a84891abdc97cb4 100644 --- a/MantidPlot/src/Mantid/MantidUI.cpp +++ b/MantidPlot/src/Mantid/MantidUI.cpp @@ -181,7 +181,7 @@ bool workspaceIsFitResult(const QString &wsName) { const auto specAxis = ws->getAxis(1); // y for (size_t iSpec = 0; iSpec < FIT_RESULTS_SPECTRA_NAMES.size(); ++iSpec) { - spectraNames.push_back(specAxis->label(iSpec)); + spectraNames.emplace_back(specAxis->label(iSpec)); } isFit = spectraNames == FIT_RESULTS_SPECTRA_NAMES; } @@ -209,7 +209,7 @@ getWorkspacesFromAds(const QList<QString> &workspaceNames) { boost::dynamic_pointer_cast<const Mantid::API::MatrixWorkspace>( Mantid::API::AnalysisDataService::Instance().retrieve( workspaceName.toStdString())); - workspaces.push_back(workspace); + workspaces.emplace_back(workspace); } return workspaces; } @@ -508,7 +508,7 @@ void MantidUI::deleteWorkspaces(const QStringList &wsNames) { std::vector<std::string> vecWsNames; vecWsNames.reserve(wsNames.size()); foreach (auto wsName, wsNames) { - vecWsNames.push_back(wsName.toStdString()); + vecWsNames.emplace_back(wsName.toStdString()); } alg->setProperty("WorkspaceList", vecWsNames); executeAlgorithmAsync(alg); @@ -1787,7 +1787,7 @@ void MantidUI::copyWorkspacestoVector( QList<QTreeWidgetItem *>::const_iterator itr; for (itr = selectedItems.begin(); itr != selectedItems.end(); ++itr) { std::string inputWSName = (*itr)->text(0).toStdString(); - inputWSVec.push_back(inputWSName); + inputWSVec.emplace_back(inputWSName); } // end of for loop for input workspaces } @@ -3257,7 +3257,7 @@ void MantidUI::putLogsIntoCurveSpecs(std::vector<CurveSpec> &curveSpecList, } curveSpec.wsName = it.key(); curveSpec.index = it.value(); - curveSpecList.push_back(curveSpec); + curveSpecList.emplace_back(curveSpec); } catch (Mantid::Kernel::Exception::NotFoundError &) { g_log.warning() << "Workspace " << it.key().toStdString() @@ -3959,7 +3959,7 @@ void countVirtual(vector<mem_block> &mem, int &total) { size += info.RegionSize; mem_block b = {info.RegionSize, state}; - mem.push_back(b); + mem.emplace_back(b); /*cerr<<"BaseAddress = "<< info.BaseAddress<<'\n'; cerr<<"AllocationBase = "<< info.AllocationBase<<'\n'; diff --git a/MantidPlot/src/MdPlottingCmapsProvider.cpp b/MantidPlot/src/MdPlottingCmapsProvider.cpp index d0ffa7c1f2f32a4eb588a675f4316b7729341cd5..5d00248172e5bce424d34fd540615921f9344451 100644 --- a/MantidPlot/src/MdPlottingCmapsProvider.cpp +++ b/MantidPlot/src/MdPlottingCmapsProvider.cpp @@ -113,7 +113,7 @@ MdPlottingCmapsProvider::getSliceViewerIndicesForCommonColorMaps( for (QStringList::iterator it = colorMapNamesSliceViewer.begin(); it != colorMapNamesSliceViewer.end(); ++it) { if (colorMapNamesVsi.indexOf(*it) != -1) { - indexVector.push_back(index); + indexVector.emplace_back(index); } index++; diff --git a/MantidPlot/src/MultiLayer.cpp b/MantidPlot/src/MultiLayer.cpp index 76ccce507377a15556a94d91c6cff77b2af8f581..13ea8f39184ad2d23a120b1d1df3cbfdaf74d277 100644 --- a/MantidPlot/src/MultiLayer.cpp +++ b/MantidPlot/src/MultiLayer.cpp @@ -1880,7 +1880,7 @@ std::vector<std::string> MultiLayer::getWorkspaceNames() { continue; name = mmc->workspaceName().toStdString(); - names.push_back(name); + names.emplace_back(name); break; case QwtPlotItem::Rtti_PlotSpectrogram: spec = dynamic_cast<Spectrogram *>(item); @@ -1888,7 +1888,7 @@ std::vector<std::string> MultiLayer::getWorkspaceNames() { continue; name = spec->workspaceName(); - names.push_back(name); + names.emplace_back(name); break; } } diff --git a/MantidPlot/src/ProjectSaveView.cpp b/MantidPlot/src/ProjectSaveView.cpp index aacbf46d85d53c8b53e474518a59a7571cc67992..0b8a041762b676d9f3b2d5ce1bbe1937f4a63697 100644 --- a/MantidPlot/src/ProjectSaveView.cpp +++ b/MantidPlot/src/ProjectSaveView.cpp @@ -312,7 +312,7 @@ ProjectSaveView::getItemsWithCheckState(const QTreeWidget &tree, auto item = tree.topLevelItem(i); if (item->checkState(0) == state) { auto name = item->data(0, Qt::UserRole).toString().toStdString(); - names.push_back(name); + names.emplace_back(name); } // now check the child items and append any that have the check state @@ -320,7 +320,7 @@ ProjectSaveView::getItemsWithCheckState(const QTreeWidget &tree, auto child = item->child(i); if (child->checkState(0) == state) { auto childName = child->text(0).toStdString(); - names.push_back(childName); + names.emplace_back(childName); } } } @@ -339,7 +339,7 @@ std::vector<std::string> ProjectSaveView::getIncludedWindowNames() const { for (int i = 0; i < m_ui.includedWindows->topLevelItemCount(); ++i) { auto item = m_ui.includedWindows->topLevelItem(i); auto name = item->text(0).toStdString(); - names.push_back(name); + names.emplace_back(name); } return names; } diff --git a/MantidPlot/src/ProjectSerialiser.cpp b/MantidPlot/src/ProjectSerialiser.cpp index 1780da0ed033afc156251067a469b48ca90d2873..fbdbc0ec422074c044edbaf1eda442f5d0451674 100644 --- a/MantidPlot/src/ProjectSerialiser.cpp +++ b/MantidPlot/src/ProjectSerialiser.cpp @@ -56,7 +56,7 @@ std::vector<std::string> splitByDelim(const std::string &s, const char delim) { // Split by \t char while (std::getline(sstream, wsName, delim)) { if (!wsName.empty()) { - foundWsNames.push_back(wsName); + foundWsNames.emplace_back(wsName); } } return foundWsNames; @@ -943,7 +943,7 @@ void ProjectSerialiser::loadWorkspacesIntoMantid( // execute the algorithm alg->execute(); - workspaceList.push_back(unusedName); + workspaceList.emplace_back(unusedName); } // Group the workspaces as they were when the project was saved @@ -1140,7 +1140,7 @@ MantidQt::API::ProjectSerialiser::parseWsNames(const std::string &wsNames) { if (workspaceName.find(groupWorkspaceChar) == std::string::npos) { // Normal workspace - allWsNames[ALL_WS].push_back(workspaceName); + allWsNames[ALL_WS].emplace_back(workspaceName); continue; } @@ -1154,8 +1154,8 @@ MantidQt::API::ProjectSerialiser::parseWsNames(const std::string &wsNames) { for (auto end = groupWorkspaceElements.end(); groupMember != end; ++groupMember) { - allWsNames[*groupName].push_back(*groupMember); - allWsNames[ALL_GROUP_NAMES].push_back(*groupName); + allWsNames[*groupName].emplace_back(*groupMember); + allWsNames[ALL_GROUP_NAMES].emplace_back(*groupName); } } diff --git a/MantidPlot/src/origin/OPJFile.cpp b/MantidPlot/src/origin/OPJFile.cpp index c3d11fcc3c0ebc55e2e764c40ff92eabd46741c0..c79268d25e2339bc4e56ad31f097f3bccea67f1f 100644 --- a/MantidPlot/src/origin/OPJFile.cpp +++ b/MantidPlot/src/origin/OPJFile.cpp @@ -155,13 +155,13 @@ vector<string> OPJFile::findDataByIndex(int index) const { for (const auto &spread : SPREADSHEET) for (const auto &i : spread.column) if (i.index == index) { - str.push_back(i.name); + str.emplace_back(i.name); str.emplace_back("T_" + spread.name); return str; } for (const auto &i : MATRIX) if (i.index == index) { - str.push_back(i.name); + str.emplace_back(i.name); str.emplace_back("M_" + i.name); return str; } @@ -169,13 +169,13 @@ vector<string> OPJFile::findDataByIndex(int index) const { for (const auto &j : i.sheet) for (const auto &k : j.column) if (k.index == index) { - str.push_back(k.name); + str.emplace_back(k.name); str.emplace_back("E_" + i.name); return str; } for (const auto &i : FUNCTION) if (i.index == index) { - str.push_back(i.name); + str.emplace_back(i.name); str.emplace_back("F_" + i.name); return str; } @@ -208,10 +208,10 @@ string OPJFile::findObjectByIndex(int index) { void OPJFile::convertSpreadToExcel(int spread) { // add new Excel sheet - EXCEL.push_back(excel(SPREADSHEET[spread].name, SPREADSHEET[spread].label, - SPREADSHEET[spread].maxRows, - SPREADSHEET[spread].bHidden, - SPREADSHEET[spread].bLoose)); + EXCEL.emplace_back(excel(SPREADSHEET[spread].name, SPREADSHEET[spread].label, + SPREADSHEET[spread].maxRows, + SPREADSHEET[spread].bHidden, + SPREADSHEET[spread].bLoose)); for (auto &i : SPREADSHEET[spread].column) { string name = i.name; int pos = static_cast<int>(name.find_last_of("@")); @@ -225,7 +225,7 @@ void OPJFile::convertSpreadToExcel(int spread) { if (EXCEL.back().sheet.size() <= index) EXCEL.back().sheet.resize(index + 1); i.name = col; - EXCEL.back().sheet[index].column.push_back(i); + EXCEL.back().sheet[index].column.emplace_back(i); } SPREADSHEET.erase(SPREADSHEET.begin() + spread); } @@ -415,7 +415,7 @@ int OPJFile::ParseFormatOld() { if (SPREADSHEET.size() == 0 || compareSpreadnames(sname) == -1) { fprintf(debug, "NEW SPREADSHEET\n"); current_col = 1; - SPREADSHEET.push_back(spreadSheet(sname)); + SPREADSHEET.emplace_back(spreadSheet(sname)); spread = static_cast<int>(SPREADSHEET.size()) - 1; SPREADSHEET.back().maxRows = 0; } else { @@ -491,9 +491,9 @@ int OPJFile::ParseFormatOld() { stmp[1] = char(i / 26 % 26 + 0x41); stmp[2] = char(i % 26 + 0x41); } - SPREADSHEET.back().column.push_back(stmp); + SPREADSHEET.back().column.emplace_back(stmp); CHECKED_FREAD(debug, &value, 8, 1, f); - SPREADSHEET.back().column[i].odata.push_back(originData(value)); + SPREADSHEET.back().column[i].odata.emplace_back(originData(value)); fprintf(debug, "%g ", value); } @@ -501,7 +501,7 @@ int OPJFile::ParseFormatOld() { fflush(debug); } else { // worksheet - SPREADSHEET[spread].column.push_back(spreadColumn(cname)); + SPREADSHEET[spread].column.emplace_back(spreadColumn(cname)); ////////////////////////////// SIZE of column //////////////////////////////////////////////// @@ -537,13 +537,13 @@ int OPJFile::ParseFormatOld() { if (IsBigEndian()) SwapBytes(a); fprintf(debug, "%g ", a); - SPREADSHEET[spread].column[(current_col - 1)].odata.push_back( + SPREADSHEET[spread].column[(current_col - 1)].odata.emplace_back( originData(a)); } else { // label char *stmp = new char[valuesize + 1]; CHECKED_FREAD(debug, stmp, valuesize, 1, f); fprintf(debug, "%s ", stmp); - SPREADSHEET[spread].column[(current_col - 1)].odata.push_back( + SPREADSHEET[spread].column[(current_col - 1)].odata.emplace_back( originData(stmp)); delete[] stmp; } @@ -961,7 +961,7 @@ int OPJFile::ParseFormatNew() { case 0x50F2: case 0x50E2: fprintf(debug, "NEW MATRIX\n"); - MATRIX.push_back(matrix(sname, dataIndex)); + MATRIX.emplace_back(matrix(sname, dataIndex)); dataIndex++; fprintf(debug, "VALUES :\n"); @@ -973,7 +973,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } break; @@ -983,7 +983,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } break; @@ -994,7 +994,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } else @@ -1003,7 +1003,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } break; @@ -1014,7 +1014,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } else @@ -1023,7 +1023,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } break; @@ -1034,7 +1034,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } else @@ -1043,7 +1043,7 @@ int OPJFile::ParseFormatNew() { CHECKED_FREAD(debug, &value, valuesize, 1, f); if (IsBigEndian()) SwapBytes(value); - MATRIX.back().data.push_back((double)value); + MATRIX.back().data.emplace_back((double)value); fprintf(debug, "%g ", MATRIX.back().data.back()); } break; @@ -1057,7 +1057,7 @@ int OPJFile::ParseFormatNew() { break; case 0x10C8: fprintf(debug, "NEW FUNCTION\n"); - FUNCTION.push_back(function(sname, dataIndex)); + FUNCTION.emplace_back(function(sname, dataIndex)); dataIndex++; char *cmd; @@ -1112,7 +1112,7 @@ int OPJFile::ParseFormatNew() { if (SPREADSHEET.size() == 0 || compareSpreadnames(sname) == -1) { fprintf(debug, "NEW SPREADSHEET\n"); current_col = 1; - SPREADSHEET.push_back(spreadSheet(sname)); + SPREADSHEET.emplace_back(spreadSheet(sname)); spread = static_cast<int>(SPREADSHEET.size()) - 1; SPREADSHEET.back().maxRows = 0; } else { @@ -1128,7 +1128,7 @@ int OPJFile::ParseFormatNew() { fprintf(debug, "SPREADSHEET = %s COLUMN NAME = %s (%d) (@0x%X)\n", sname, cname, current_col, (unsigned int)ftell(f)); fflush(debug); - SPREADSHEET[spread].column.push_back(spreadColumn(cname, dataIndex)); + SPREADSHEET[spread].column.emplace_back(spreadColumn(cname, dataIndex)); int sheetpos = static_cast<int>( SPREADSHEET[spread].column.back().name.find_last_of("@")); if (!SPREADSHEET[spread].bMultisheet && sheetpos != -1) @@ -1172,7 +1172,7 @@ int OPJFile::ParseFormatNew() { if (IsBigEndian()) SwapBytes(a); fprintf(debug, "%g ", a); - SPREADSHEET[spread].column[(current_col - 1)].odata.push_back( + SPREADSHEET[spread].column[(current_col - 1)].odata.emplace_back( originData(a)); } else if ((data_type & 0x100) == 0x100) // Text&Numeric { @@ -1185,7 +1185,7 @@ int OPJFile::ParseFormatNew() { if (IsBigEndian()) SwapBytes(a); fprintf(debug, "%g ", a); - SPREADSHEET[spread].column[(current_col - 1)].odata.push_back( + SPREADSHEET[spread].column[(current_col - 1)].odata.emplace_back( originData(a)); CHECKED_FSEEK(debug, f, valuesize - 10, SEEK_CUR); } else // text @@ -1195,7 +1195,7 @@ int OPJFile::ParseFormatNew() { if (strchr(stmp, 0x0E)) // try find non-printable symbol - garbage test stmp[0] = '\0'; - SPREADSHEET[spread].column[(current_col - 1)].odata.push_back( + SPREADSHEET[spread].column[(current_col - 1)].odata.emplace_back( originData(stmp)); fprintf(debug, "%s ", stmp); delete[] stmp; @@ -1207,7 +1207,7 @@ int OPJFile::ParseFormatNew() { if (strchr(stmp, 0x0E)) // try find non-printable symbol - garbage test stmp[0] = '\0'; - SPREADSHEET[spread].column[(current_col - 1)].odata.push_back( + SPREADSHEET[spread].column[(current_col - 1)].odata.emplace_back( originData(stmp)); fprintf(debug, "%s ", stmp); delete[] stmp; @@ -1356,7 +1356,7 @@ int OPJFile::ParseFormatNew() { delete[] stmp; break; } else { - NOTE.push_back(note(stmp)); + NOTE.emplace_back(note(stmp)); NOTE.back().objectID = objectIndex; NOTE.back().creation_date = creation_date; NOTE.back().modification_date = modification_date; @@ -2123,7 +2123,7 @@ void OPJFile::readGraphInfo(FILE *f, int file_size, FILE *debug) { CHECKED_FSEEK(debug, f, POS + 0x2, SEEK_SET); CHECKED_FREAD(debug, &name, 25, 1, f); - GRAPH.push_back(graph(name)); + GRAPH.emplace_back(graph(name)); readWindowProperties(GRAPH.back(), f, debug, POS, headersize); // char c = 0; @@ -2145,7 +2145,7 @@ void OPJFile::readGraphInfo(FILE *f, int file_size, FILE *debug) { int sec_size; while (true) // multilayer loop { - GRAPH.back().layer.push_back(graphLayer()); + GRAPH.back().layer.emplace_back(graphLayer()); // LAYER section LAYER += 0x5; double range = 0.0; @@ -2427,7 +2427,7 @@ void OPJFile::readGraphInfo(FILE *f, int file_size, FILE *debug) { { stmp[sec_size] = '\0'; CHECKED_FREAD(debug, &stmp, sec_size, 1, f); - GRAPH.back().layer.back().texts.push_back(text(stmp)); + GRAPH.back().layer.back().texts.emplace_back(text(stmp)); GRAPH.back().layer.back().texts.back().color = color; GRAPH.back().layer.back().texts.back().clientRect = r; GRAPH.back().layer.back().texts.back().tab = tab; @@ -2440,7 +2440,7 @@ void OPJFile::readGraphInfo(FILE *f, int file_size, FILE *debug) { GRAPH.back().layer.back().texts.back().border_type = None; } else if (size == 0x78 && type == 2) // line { - GRAPH.back().layer.back().lines.push_back(line()); + GRAPH.back().layer.back().lines.emplace_back(line()); GRAPH.back().layer.back().lines.back().color = color; GRAPH.back().layer.back().lines.back().clientRect = r; GRAPH.back().layer.back().lines.back().attach = attach; @@ -2451,7 +2451,7 @@ void OPJFile::readGraphInfo(FILE *f, int file_size, FILE *debug) { } else if (size == 0x28 && type == 4) // bitmap { unsigned long filesize = sec_size + 14; - GRAPH.back().layer.back().bitmaps.push_back(bitmap()); + GRAPH.back().layer.back().bitmaps.emplace_back(bitmap()); GRAPH.back().layer.back().bitmaps.back().left = bitmap_left; GRAPH.back().layer.back().bitmaps.back().top = bitmap_top; GRAPH.back().layer.back().bitmaps.back().width = @@ -2762,7 +2762,7 @@ void OPJFile::readGraphInfo(FILE *f, int file_size, FILE *debug) { CHECKED_FREAD(debug, &h, 1, 1, f); curve.point_offset = h; - GRAPH.back().layer.back().curve.push_back(curve); + GRAPH.back().layer.back().curve.emplace_back(curve); LAYER += 0x1E7 + 0x1; CHECKED_FSEEK(debug, f, LAYER, SEEK_SET); diff --git a/MantidPlot/src/origin/OPJFile.h b/MantidPlot/src/origin/OPJFile.h index 05ed8fe05ac8a5729070f349612cf9dd155a85e0..9ac38561374456646840f21a7270cfe91d184556 100644 --- a/MantidPlot/src/origin/OPJFile.h +++ b/MantidPlot/src/origin/OPJFile.h @@ -833,45 +833,45 @@ public: } //!< get Y-range of layer l of graph s std::vector<int> layerXTicks(int s, int l) const { std::vector<int> tick; - tick.push_back(GRAPH[s].layer[l].xAxis.majorTicks); - tick.push_back(GRAPH[s].layer[l].xAxis.minorTicks); + tick.emplace_back(GRAPH[s].layer[l].xAxis.majorTicks); + tick.emplace_back(GRAPH[s].layer[l].xAxis.minorTicks); return tick; } //!< get X-axis ticks of layer l of graph s std::vector<int> layerYTicks(int s, int l) const { std::vector<int> tick; - tick.push_back(GRAPH[s].layer[l].yAxis.majorTicks); - tick.push_back(GRAPH[s].layer[l].yAxis.minorTicks); + tick.emplace_back(GRAPH[s].layer[l].yAxis.majorTicks); + tick.emplace_back(GRAPH[s].layer[l].yAxis.minorTicks); return tick; } //!< get Y-axis ticks of layer l of graph s std::vector<graphGrid> layerGrid(int s, int l) const { std::vector<graphGrid> grid; - grid.push_back(GRAPH[s].layer[l].xAxis.majorGrid); - grid.push_back(GRAPH[s].layer[l].xAxis.minorGrid); - grid.push_back(GRAPH[s].layer[l].yAxis.majorGrid); - grid.push_back(GRAPH[s].layer[l].yAxis.minorGrid); + grid.emplace_back(GRAPH[s].layer[l].xAxis.majorGrid); + grid.emplace_back(GRAPH[s].layer[l].xAxis.minorGrid); + grid.emplace_back(GRAPH[s].layer[l].yAxis.majorGrid); + grid.emplace_back(GRAPH[s].layer[l].yAxis.minorGrid); return grid; } //!< get grid of layer l of graph s std::vector<graphAxisFormat> layerAxisFormat(int s, int l) const { std::vector<graphAxisFormat> format; - format.push_back(GRAPH[s].layer[l].yAxis.formatAxis[0]); // bottom - format.push_back(GRAPH[s].layer[l].yAxis.formatAxis[1]); // top - format.push_back(GRAPH[s].layer[l].xAxis.formatAxis[0]); // left - format.push_back(GRAPH[s].layer[l].xAxis.formatAxis[1]); // right + format.emplace_back(GRAPH[s].layer[l].yAxis.formatAxis[0]); // bottom + format.emplace_back(GRAPH[s].layer[l].yAxis.formatAxis[1]); // top + format.emplace_back(GRAPH[s].layer[l].xAxis.formatAxis[0]); // left + format.emplace_back(GRAPH[s].layer[l].xAxis.formatAxis[1]); // right return format; } //!< get title and format of axes of layer l of graph s std::vector<graphAxisTick> layerAxisTickLabels(int s, int l) const { std::vector<graphAxisTick> tick; - tick.push_back(GRAPH[s].layer[l].yAxis.tickAxis[0]); // bottom - tick.push_back(GRAPH[s].layer[l].yAxis.tickAxis[1]); // top - tick.push_back(GRAPH[s].layer[l].xAxis.tickAxis[0]); // left - tick.push_back(GRAPH[s].layer[l].xAxis.tickAxis[1]); // right + tick.emplace_back(GRAPH[s].layer[l].yAxis.tickAxis[0]); // bottom + tick.emplace_back(GRAPH[s].layer[l].yAxis.tickAxis[1]); // top + tick.emplace_back(GRAPH[s].layer[l].xAxis.tickAxis[0]); // left + tick.emplace_back(GRAPH[s].layer[l].xAxis.tickAxis[1]); // right return tick; } //!< get tick labels of axes of layer l of graph s std::vector<double> layerHistogram(int s, int l) const { std::vector<double> range; - range.push_back(GRAPH[s].layer[l].histogram_bin); - range.push_back(GRAPH[s].layer[l].histogram_begin); - range.push_back(GRAPH[s].layer[l].histogram_end); + range.emplace_back(GRAPH[s].layer[l].histogram_bin); + range.emplace_back(GRAPH[s].layer[l].histogram_begin); + range.emplace_back(GRAPH[s].layer[l].histogram_end); return range; } //!< get histogram bin of layer l of graph s int layerXScale(int s, int l) const { diff --git a/qt/scientific_interfaces/Direct/ALFView_presenter.cpp b/qt/scientific_interfaces/Direct/ALFView_presenter.cpp index e14498cefddae5b65513a8727944a8dc2057c734..baf5f8f77816675e5fe072f9e4c0a03d6e2bd5d3 100644 --- a/qt/scientific_interfaces/Direct/ALFView_presenter.cpp +++ b/qt/scientific_interfaces/Direct/ALFView_presenter.cpp @@ -68,8 +68,8 @@ ALFView_presenter::setupALFInstrument() { std::bind(&ALFView_model::averageTubeConditon, m_model, std::placeholders::_1); - binders.push_back(extractConditionBinder); - binders.push_back(averageTubeConditonBinder); + binders.emplace_back(extractConditionBinder); + binders.emplace_back(averageTubeConditonBinder); setUpContextConditions = std::make_pair(m_model->dataFileName(), binders); @@ -80,14 +80,14 @@ ALFView_presenter::setupALFInstrument() { extractSingleTubeBinder); // add slot to observer std::tuple<std::string, Observer *> tmp = std::make_tuple( "singleTube", m_extractSingleTubeObserver); // store observer for later - customInstrumentOptions.push_back(tmp); + customInstrumentOptions.emplace_back(tmp); // set up average tube std::function<void()> averageTubeBinder = std::bind(&ALFView_presenter::averageTube, this); m_averageTubeObserver->setSlot(averageTubeBinder); tmp = std::make_tuple("averageTube", m_averageTubeObserver); - customInstrumentOptions.push_back(tmp); + customInstrumentOptions.emplace_back(tmp); return std::make_pair(setUpContextConditions, customInstrumentOptions); } diff --git a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingModel.cpp b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingModel.cpp index fcc7056f46078614355557e0218aaa779133e987..4394d702ab19786fb3da54037f2803a59b9c24cf 100644 --- a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingModel.cpp +++ b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingModel.cpp @@ -505,7 +505,7 @@ void EnggDiffFittingModel::loadWorkspaces(const std::string &filenamesString) { RunLabel runLabel(runNumber, bank); addFocusedWorkspace(runLabel, ws, filename); - collectedRunLabels.push_back(runLabel); + collectedRunLabels.emplace_back(runLabel); } if (collectedRunLabels.size() == 1) { diff --git a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingViewQtWidget.cpp b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingViewQtWidget.cpp index 09d5146dc788cf2b19f928912b4467e8de5f2955..3e602bcedd31c5299bb96cb3e9608e5197acb7a5 100644 --- a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingViewQtWidget.cpp +++ b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingViewQtWidget.cpp @@ -335,7 +335,7 @@ void EnggDiffFittingViewQtWidget::dataCurvesFactory( } dataCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true); - dataVector.push_back(dataCurve); + dataVector.emplace_back(dataCurve); dataVector[i]->setData(*peak); dataVector[i]->attach(m_ui.dataPlot); diff --git a/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionPresenter.cpp b/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionPresenter.cpp index b08c79cfe73333b29be89295abe646bbf0085269..161c59f634c384446a25427e5f07caed863edc6a 100644 --- a/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionPresenter.cpp +++ b/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionPresenter.cpp @@ -424,7 +424,7 @@ void EnggDiffractionPresenter::processFocusBasic() { g_log.debug() << " focus mode selected Focus Sum Of Files \n"; g_sumOfFilesFocus = "basic"; std::vector<std::string> firstRun; - firstRun.push_back(multi_RunNo[0]); + firstRun.emplace_back(multi_RunNo[0]); // to avoid multiple loops, use firstRun instead as the // multi-run number is not required for sumOfFiles @@ -1059,12 +1059,12 @@ void EnggDiffractionPresenter::doCalib(const EnggDiffCalibSettings &cs, if (customName.empty()) { bankNames.emplace_back("cropped"); } else { - bankNames.push_back(customName); + bankNames.emplace_back(customName); } } else if (1 == selection) { - bankNames.push_back("North"); + bankNames.emplace_back("North"); } else { - bankNames.push_back("South"); + bankNames.emplace_back("South"); } } else { constexpr size_t bankNo2 = 2; @@ -1499,15 +1499,15 @@ void EnggDiffractionPresenter::doFocusRun(const std::string &runNo, if (!specNos.empty()) { // Cropped focusing // just to iterate once, but there's no real bank here - bankIDs.push_back(0); - specs.push_back(specNos); // one spectrum Nos list given by the user - effectiveFilenames.push_back(outputFocusCroppedFilename(runNo)); + bankIDs.emplace_back(0); + specs.emplace_back(specNos); // one spectrum Nos list given by the user + effectiveFilenames.emplace_back(outputFocusCroppedFilename(runNo)); } else { if (dgFile.empty()) { // Basic/normal focusing for (size_t bidx = 0; bidx < banks.size(); bidx++) { if (banks[bidx]) { - bankIDs.push_back(bidx + 1); + bankIDs.emplace_back(bidx + 1); specs.emplace_back(""); effectiveFilenames = outputFocusFilenames(runNo, banks); } @@ -1603,8 +1603,8 @@ void EnggDiffractionPresenter::loadDetectorGroupingCSV( } size_t bankID = boost::lexical_cast<size_t>(bstr); - bankIDs.push_back(bankID); - specs.push_back(spec); + bankIDs.emplace_back(bankID); + specs.emplace_back(spec); } catch (std::runtime_error &re) { throw std::runtime_error( "In file '" + dgFile + @@ -2876,7 +2876,7 @@ void EnggDiffractionPresenter::recordPathBrowsedTo( if (!directory.exists() || !directory.isDirectory()) return; - m_browsedToPaths.push_back(directory.path()); + m_browsedToPaths.emplace_back(directory.path()); } } // namespace CustomInterfaces diff --git a/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionViewQtGUI.cpp b/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionViewQtGUI.cpp index d52e43e72e3240a03cff18b5b92add9ae15ceffb..5a5e210361df42860f3599012f3c5d622ecc97b9 100644 --- a/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionViewQtGUI.cpp +++ b/qt/scientific_interfaces/EnggDiffraction/EnggDiffractionViewQtGUI.cpp @@ -724,7 +724,7 @@ void EnggDiffractionViewQtGUI::plotCalibOutput(const std::string &pyCode) { std::string status = runPythonCode(QString::fromStdString(pyCode), false).toStdString(); - m_logMsgs.push_back( + m_logMsgs.emplace_back( "Plotted output calibration vanadium curves, with status string " + status); m_presenter->notify(IEnggDiffractionPresenter::LogMsg); @@ -934,7 +934,7 @@ EnggDiffractionViewQtGUI::qListToVector(QStringList list, bool validator) const { std::vector<std::string> vec; if (validator) { - foreach (const QString &str, list) { vec.push_back(str.toStdString()); } + foreach (const QString &str, list) { vec.emplace_back(str.toStdString()); } } return vec; @@ -942,8 +942,8 @@ EnggDiffractionViewQtGUI::qListToVector(QStringList list, std::vector<bool> EnggDiffractionViewQtGUI::focusingBanks() const { std::vector<bool> res; - res.push_back(m_uiTabFocus.checkBox_focus_bank1->isChecked()); - res.push_back(m_uiTabFocus.checkBox_focus_bank2->isChecked()); + res.emplace_back(m_uiTabFocus.checkBox_focus_bank1->isChecked()); + res.emplace_back(m_uiTabFocus.checkBox_focus_bank2->isChecked()); return res; } diff --git a/qt/scientific_interfaces/General/MantidEV.cpp b/qt/scientific_interfaces/General/MantidEV.cpp index 69647e846e8a5bd4cf131026a3da87ef249baf0c..b128bfd74552bf86bd15d7d70df5e65f659f1292 100644 --- a/qt/scientific_interfaces/General/MantidEV.cpp +++ b/qt/scientific_interfaces/General/MantidEV.cpp @@ -1246,11 +1246,11 @@ void MantidEV::showInfo(bool lab_coords, Mantid::Kernel::V3D q_point) { if (lab_coords) { std::pair<std::string, std::string> QlabStr( "Qlab", boost::lexical_cast<std::string>(q_point)); - info.push_back(QlabStr); + info.emplace_back(QlabStr); } else { std::pair<std::string, std::string> QSampleStr( "QSample", boost::lexical_cast<std::string>(q_point)); - info.push_back(QSampleStr); + info.emplace_back(QSampleStr); } } else // get the info from the peaks workspace { @@ -1260,7 +1260,7 @@ void MantidEV::showInfo(bool lab_coords, Mantid::Kernel::V3D q_point) { double q_dist = (q_point - last_Q).norm(); std::pair<std::string, std::string> Q_dist_str( "|Q2-Q1|", boost::lexical_cast<std::string>(q_dist)); - info.push_back(Q_dist_str); + info.emplace_back(Q_dist_str); Mantid::Kernel::Matrix<double> UB(3, 3, false); if (worker->getUB(peaks_ws_name, lab_coords, @@ -1275,7 +1275,7 @@ void MantidEV::showInfo(bool lab_coords, Mantid::Kernel::V3D q_point) { double hkl_dist = (hkl_2 - hkl_1).norm(); std::pair<std::string, std::string> hkl_dist_str( "|hkl2-hkl1|", boost::lexical_cast<std::string>(hkl_dist)); - info.push_back(hkl_dist_str); + info.emplace_back(hkl_dist_str); } last_Q = q_point; diff --git a/qt/scientific_interfaces/General/MantidEVWorker.cpp b/qt/scientific_interfaces/General/MantidEVWorker.cpp index d7823ced244664d49221f3e91824e68100da4eca..413d7ebadef817271fe0933f870ebe1e4a3525a9 100644 --- a/qt/scientific_interfaces/General/MantidEVWorker.cpp +++ b/qt/scientific_interfaces/General/MantidEVWorker.cpp @@ -283,14 +283,14 @@ bool MantidEVWorker::convertToHKL(const std::string &ev_ws_name, Mantid::Geometry::OrientedLattice o_lattice = ev_ws->mutableSample().getOrientedLattice(); std::vector<V3D> hkl; - hkl.push_back(o_lattice.hklFromQ(V3D(Q, Q, Q))); - hkl.push_back(o_lattice.hklFromQ(V3D(Q, Q, -Q))); - hkl.push_back(o_lattice.hklFromQ(V3D(Q, -Q, Q))); - hkl.push_back(o_lattice.hklFromQ(V3D(-Q, Q, Q))); - hkl.push_back(o_lattice.hklFromQ(V3D(Q, -Q, -Q))); - hkl.push_back(o_lattice.hklFromQ(V3D(-Q, -Q, Q))); - hkl.push_back(o_lattice.hklFromQ(V3D(-Q, Q, -Q))); - hkl.push_back(o_lattice.hklFromQ(V3D(-Q, -Q, -Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(Q, Q, Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(Q, Q, -Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(Q, -Q, Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(-Q, Q, Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(Q, -Q, -Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(-Q, -Q, Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(-Q, Q, -Q))); + hkl.emplace_back(o_lattice.hklFromQ(V3D(-Q, -Q, -Q))); double hmin = 0; double kmin = 0; double lmin = 0; diff --git a/qt/scientific_interfaces/ISISReflectometry/Common/Clipboard.cpp b/qt/scientific_interfaces/ISISReflectometry/Common/Clipboard.cpp index b2111efbcca7360e89e70a9f89810b93b49e3d12..78d7d6943cc7ed1ea08102afe5cf2222678c9fba 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Common/Clipboard.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Common/Clipboard.cpp @@ -100,7 +100,7 @@ std::vector<boost::optional<Row>> Clipboard::createRowsForAllRoots() const { for (auto const &subtree : subtrees()) { auto rowsToAdd = createRowsForSubtree(subtree); for (auto &row : rowsToAdd) - result.push_back(row); + result.emplace_back(row); } return result; } diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchJobRunner.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchJobRunner.cpp index eddde67d8fc675192bfd26da9af421fbb7a6b7df..d25ad10bfa9940a3c0e9528d6b344f3ba03a0597 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchJobRunner.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchJobRunner.cpp @@ -262,7 +262,7 @@ BatchJobRunner::getWorkspacesToSave(Row const &row) const { return workspaces; // We currently only save the binned workspace in Q - workspaces.push_back(row.reducedWorkspaceNames().iVsQBinned()); + workspaces.emplace_back(row.reducedWorkspaceNames().iVsQBinned()); return workspaces; } diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/GroupProcessingAlgorithm.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/GroupProcessingAlgorithm.cpp index 9ea502693696668e66f350a79b337059d3a471ce..cea17629bf3777ac35affa4635f967e4fdae9d45 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/GroupProcessingAlgorithm.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/GroupProcessingAlgorithm.cpp @@ -42,7 +42,8 @@ void updateWorkspaceProperties(AlgorithmRuntimeProps &properties, std::for_each(group.rows().cbegin(), group.rows().cend(), [&workspaces](boost::optional<Row> const &row) -> void { if (row) - workspaces.push_back(row->reducedWorkspaceNames().iVsQ()); + workspaces.emplace_back( + row->reducedWorkspaceNames().iVsQ()); }); AlgorithmProperties::update("InputWorkspaces", workspaces, properties); diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Save/QtSaveView.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Save/QtSaveView.cpp index e9a6753a54072257e143e82d28eb5b2163debc35..e85bb561a20e28720eb40af173981b570c03ae45 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Save/QtSaveView.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Save/QtSaveView.cpp @@ -148,7 +148,7 @@ std::vector<std::string> QtSaveView::getSelectedWorkspaces() const { std::vector<std::string> itemNames; auto items = m_ui.listOfWorkspaces->selectedItems(); for (auto it = items.begin(); it != items.end(); it++) { - itemNames.push_back((*it)->text().toStdString()); + itemNames.emplace_back((*it)->text().toStdString()); } return itemNames; } @@ -160,7 +160,7 @@ std::vector<std::string> QtSaveView::getSelectedParameters() const { std::vector<std::string> paramNames; auto items = m_ui.listOfLoggedParameters->selectedItems(); for (auto it = items.begin(); it != items.end(); it++) { - paramNames.push_back((*it)->text().toStdString()); + paramNames.emplace_back((*it)->text().toStdString()); } return paramNames; } diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Save/SavePresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Save/SavePresenter.cpp index 79b87d974fe27604e87148dedd8dc7070919590f..d7939d871d0b1b89fe7d5cad199d0b645b6294bb 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Save/SavePresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Save/SavePresenter.cpp @@ -165,7 +165,7 @@ void SavePresenter::populateParametersList() { ->run() .getProperties(); for (auto it = properties.begin(); it != properties.end(); it++) { - logs.push_back((*it)->name()); + logs.emplace_back((*it)->name()); } m_view->setParametersList(logs); } diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp b/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp index d6d798ba33fb5f8ce33bbe650e8bf522aa491616..128c87ea06ddb7febd11ec33b7f0a021101b985f 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/Experiment.cpp @@ -76,7 +76,7 @@ std::vector<PerThetaDefaults::ValueArray> Experiment::perThetaDefaultsArray() const { auto result = std::vector<PerThetaDefaults::ValueArray>(); for (auto const &perThetaDefaults : m_perThetaDefaults) - result.push_back(perThetaDefaultsToArray(perThetaDefaults)); + result.emplace_back(perThetaDefaultsToArray(perThetaDefaults)); return result; } diff --git a/qt/scientific_interfaces/ISISSANS/SANSDiagnostics.cpp b/qt/scientific_interfaces/ISISSANS/SANSDiagnostics.cpp index 279925ab9d51b6c2708e0bb63c567a7f6ef7057f..ccca245fa37b441b4f12b5b4625c32930beec6fe 100644 --- a/qt/scientific_interfaces/ISISSANS/SANSDiagnostics.cpp +++ b/qt/scientific_interfaces/ISISSANS/SANSDiagnostics.cpp @@ -374,7 +374,7 @@ SANSDiagnostics::rectangularDetectorDetails( rect->setDetectorName(QString::fromStdString(det->getName())); rect->setMinimumDetectorId(det->minDetectorID()); rect->setMaximumDetectorId(det->maxDetectorID()); - rectDetectors.push_back(rect); + rectDetectors.emplace_back(rect); } else { @@ -390,7 +390,7 @@ SANSDiagnostics::rectangularDetectorDetails( rect->setDetectorName(QString::fromStdString(det->getName())); rect->setMinimumDetectorId(det->minDetectorID()); rect->setMaximumDetectorId(det->maxDetectorID()); - rectDetectors.push_back(rect); + rectDetectors.emplace_back(rect); } } } @@ -460,8 +460,8 @@ void SANSDiagnostics::getSpectraList( specList.clear(); // it is not really required, it could stay with the workspace id, just for // compatibility - specList.push_back(min_spec_index); - specList.push_back(max_spec_index); + specList.emplace_back(min_spec_index); + specList.emplace_back(max_spec_index); } /** This method returns the minimum and maximum spectrum Nos * @param specList - list of spectra. diff --git a/qt/scientific_interfaces/ISISSANS/SANSPlotSpecial.cpp b/qt/scientific_interfaces/ISISSANS/SANSPlotSpecial.cpp index 500d87fc294c4fbf4d49a78941f735d636de4c0d..d06dd23c7f31ebd0f354d1f99360f867ba583a90 100644 --- a/qt/scientific_interfaces/ISISSANS/SANSPlotSpecial.cpp +++ b/qt/scientific_interfaces/ISISSANS/SANSPlotSpecial.cpp @@ -894,7 +894,7 @@ std::vector<double> SANSPlotSpecial::Transform::functionConstants() { if (strcmp(item->metaObject()->className(), "QLineEdit") == 0) { item->setMaximumSize(25, 20); QString le = dynamic_cast<QLineEdit *>(item)->text(); - result.push_back(le.toDouble()); + result.emplace_back(le.toDouble()); } } @@ -902,7 +902,7 @@ std::vector<double> SANSPlotSpecial::Transform::functionConstants() { if (strcmp(item->metaObject()->className(), "QLineEdit") == 0) { item->setMaximumSize(25, 20); QString le = dynamic_cast<QLineEdit *>(item)->text(); - result.push_back(le.toDouble()); + result.emplace_back(le.toDouble()); } } return result; diff --git a/qt/scientific_interfaces/ISISSANS/SANSRunWindow.cpp b/qt/scientific_interfaces/ISISSANS/SANSRunWindow.cpp index 073c56e35fe273c7af7c4305a8e506c0690e69fc..920596f101e8468b32f877b1c39925c70a5d58d7 100644 --- a/qt/scientific_interfaces/ISISSANS/SANSRunWindow.cpp +++ b/qt/scientific_interfaces/ISISSANS/SANSRunWindow.cpp @@ -324,14 +324,14 @@ void SANSRunWindow::initLayout() { m_runFiles.reserve(6); // Text edit map - m_runFiles.push_back(m_uiForm.scatterSample); - m_runFiles.push_back(m_uiForm.scatCan); + m_runFiles.emplace_back(m_uiForm.scatterSample); + m_runFiles.emplace_back(m_uiForm.scatCan); - m_runFiles.push_back(m_uiForm.transmis); - m_runFiles.push_back(m_uiForm.transCan); + m_runFiles.emplace_back(m_uiForm.transmis); + m_runFiles.emplace_back(m_uiForm.transCan); - m_runFiles.push_back(m_uiForm.direct); - m_runFiles.push_back(m_uiForm.dirCan); + m_runFiles.emplace_back(m_uiForm.direct); + m_runFiles.emplace_back(m_uiForm.dirCan); std::vector<MWRunFiles *>::const_iterator it = m_runFiles.begin(); for (; it != m_runFiles.end(); ++it) { (*it)->doButtonOpt(MWRunFiles::Icon); @@ -2175,11 +2175,11 @@ bool SANSRunWindow::handleLoadButtonClick() { tuple<QLineEdit *, function<double(const Sample *)>, std::string>; std::vector<GeomSampleInfo> sampleInfoList; - sampleInfoList.push_back(make_tuple(m_uiForm.sample_thick, - &Sample::getThickness, "thickness")); - sampleInfoList.push_back( + sampleInfoList.emplace_back(make_tuple( + m_uiForm.sample_thick, &Sample::getThickness, "thickness")); + sampleInfoList.emplace_back( make_tuple(m_uiForm.sample_width, &Sample::getWidth, "width")); - sampleInfoList.push_back( + sampleInfoList.emplace_back( make_tuple(m_uiForm.sample_height, &Sample::getHeight, "height")); // Populate the sample geometry fields, but replace any zero values with diff --git a/qt/scientific_interfaces/Indirect/DensityOfStates.cpp b/qt/scientific_interfaces/Indirect/DensityOfStates.cpp index ad5c059b57d57e0784fe9a89d781851a585adf20..ea360ae855e325982d1bb7f7a5f6618b1edcfe8e 100644 --- a/qt/scientific_interfaces/Indirect/DensityOfStates.cpp +++ b/qt/scientific_interfaces/Indirect/DensityOfStates.cpp @@ -130,7 +130,7 @@ void DensityOfStates::run() { std::vector<std::string> selectedIons; auto items = m_uiForm.lwIons->selectedItems(); for (auto &item : items) - selectedIons.push_back(item->text().toStdString()); + selectedIons.emplace_back(item->text().toStdString()); dosAlgo->setProperty("Ions", selectedIons); } else if (specType == "IR") { dosAlgo->setProperty("SpectrumType", "IR_Active"); diff --git a/qt/scientific_interfaces/Indirect/ISISDiagnostics.cpp b/qt/scientific_interfaces/Indirect/ISISDiagnostics.cpp index c9a89964b41a98c1b15d1a1855d3d84ec425b8b1..a2de75a99753467d72f97f91f23ea897ee845014 100644 --- a/qt/scientific_interfaces/Indirect/ISISDiagnostics.cpp +++ b/qt/scientific_interfaces/Indirect/ISISDiagnostics.cpp @@ -158,14 +158,14 @@ void ISISDiagnostics::run() { QString filenames = m_uiForm.dsInputFiles->getFilenames().join(","); std::vector<long> spectraRange; - spectraRange.push_back( + spectraRange.emplace_back( static_cast<long>(m_dblManager->value(m_properties["SpecMin"]))); - spectraRange.push_back( + spectraRange.emplace_back( static_cast<long>(m_dblManager->value(m_properties["SpecMax"]))); std::vector<double> peakRange; - peakRange.push_back(m_dblManager->value(m_properties["PeakStart"])); - peakRange.push_back(m_dblManager->value(m_properties["PeakEnd"])); + peakRange.emplace_back(m_dblManager->value(m_properties["PeakStart"])); + peakRange.emplace_back(m_dblManager->value(m_properties["PeakEnd"])); IAlgorithm_sptr sliceAlg = AlgorithmManager::Instance().create("TimeSlice"); sliceAlg->initialize(); @@ -183,9 +183,9 @@ void ISISDiagnostics::run() { if (m_blnManager->value(m_properties["UseTwoRanges"])) { std::vector<double> backgroundRange; - backgroundRange.push_back( + backgroundRange.emplace_back( m_dblManager->value(m_properties["BackgroundStart"])); - backgroundRange.push_back( + backgroundRange.emplace_back( m_dblManager->value(m_properties["BackgroundEnd"])); sliceAlg->setProperty("BackgroundRange", backgroundRange); } diff --git a/qt/scientific_interfaces/Indirect/ISISEnergyTransfer.cpp b/qt/scientific_interfaces/Indirect/ISISEnergyTransfer.cpp index 7f3974d35b02538b632e2721d197760522eb90a9..ea82eced6a3a05a02caeca3e572a485b2df3f6ab 100644 --- a/qt/scientific_interfaces/Indirect/ISISEnergyTransfer.cpp +++ b/qt/scientific_interfaces/Indirect/ISISEnergyTransfer.cpp @@ -483,14 +483,14 @@ void ISISEnergyTransfer::run() { } std::vector<long> detectorRange; - detectorRange.push_back(m_uiForm.spSpectraMin->value()); - detectorRange.push_back(m_uiForm.spSpectraMax->value()); + detectorRange.emplace_back(m_uiForm.spSpectraMin->value()); + detectorRange.emplace_back(m_uiForm.spSpectraMax->value()); reductionAlg->setProperty("SpectraRange", detectorRange); if (m_uiForm.ckBackgroundRemoval->isChecked()) { std::vector<double> backgroundRange; - backgroundRange.push_back(m_uiForm.spBackgroundStart->value()); - backgroundRange.push_back(m_uiForm.spBackgroundEnd->value()); + backgroundRange.emplace_back(m_uiForm.spBackgroundStart->value()); + backgroundRange.emplace_back(m_uiForm.spBackgroundEnd->value()); reductionAlg->setProperty("BackgroundRange", backgroundRange); } @@ -831,12 +831,12 @@ void ISISEnergyTransfer::plotRaw() { std::vector<specnum_t> detectorList; for (specnum_t i = detectorMin; i <= detectorMax; i++) - detectorList.push_back(i); + detectorList.emplace_back(i); if (m_uiForm.ckBackgroundRemoval->isChecked()) { std::vector<double> range; - range.push_back(m_uiForm.spBackgroundStart->value()); - range.push_back(m_uiForm.spBackgroundEnd->value()); + range.emplace_back(m_uiForm.spBackgroundStart->value()); + range.emplace_back(m_uiForm.spBackgroundEnd->value()); IAlgorithm_sptr calcBackAlg = AlgorithmManager::Instance().create("CalculateFlatBackground"); diff --git a/qt/scientific_interfaces/Indirect/IndirectDataReductionTab.cpp b/qt/scientific_interfaces/Indirect/IndirectDataReductionTab.cpp index ddfa320d5c65e512de813ffdb135093ec11971b9..814f351ce600c77397b9bbae39742a80f068dddf 100644 --- a/qt/scientific_interfaces/Indirect/IndirectDataReductionTab.cpp +++ b/qt/scientific_interfaces/Indirect/IndirectDataReductionTab.cpp @@ -189,16 +189,16 @@ std::map<std::string, double> IndirectDataReductionTab::getRangesFromInstrument( double resolution = resParams[0]; std::vector<double> x; - x.push_back(-6 * resolution); - x.push_back(-5 * resolution); - x.push_back(-2 * resolution); - x.push_back(0); - x.push_back(2 * resolution); + x.emplace_back(-6 * resolution); + x.emplace_back(-5 * resolution); + x.emplace_back(-2 * resolution); + x.emplace_back(0); + x.emplace_back(2 * resolution); std::vector<double> y; - y.push_back(1); - y.push_back(2); - y.push_back(3); - y.push_back(4); + y.emplace_back(1); + y.emplace_back(2); + y.emplace_back(3); + y.emplace_back(4); std::vector<double> e(4, 0); IAlgorithm_sptr createWsAlg = diff --git a/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp b/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp index 499c2b87982cc43c4259d675c138e9448ea8903e..8999de43d127907d770895d97900e6f4164a5540 100644 --- a/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp +++ b/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp @@ -379,8 +379,8 @@ void IndirectDiffractionReduction::runGenericReduction(QString instName, // Get detector range std::vector<long> detRange; - detRange.push_back(static_cast<long>(m_uiForm.spSpecMin->value())); - detRange.push_back(static_cast<long>(m_uiForm.spSpecMax->value())); + detRange.emplace_back(static_cast<long>(m_uiForm.spSpecMin->value())); + detRange.emplace_back(static_cast<long>(m_uiForm.spSpecMax->value())); // Get generic reduction algorithm instance IAlgorithm_sptr msgDiffReduction = @@ -513,8 +513,8 @@ void IndirectDiffractionReduction::runOSIRISdiffonlyReduction() { m_batchAlgoRunner->addAlgorithm(convertUnits, inputFromReductionProps); m_plotWorkspaces.clear(); - m_plotWorkspaces.push_back(tofWsName.toStdString()); - m_plotWorkspaces.push_back(drangeWsName.toStdString()); + m_plotWorkspaces.emplace_back(tofWsName.toStdString()); + m_plotWorkspaces.emplace_back(drangeWsName.toStdString()); // Handles completion of the diffraction algorithm chain connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, diff --git a/qt/scientific_interfaces/Indirect/IndirectFitData.cpp b/qt/scientific_interfaces/Indirect/IndirectFitData.cpp index a3e63d5c55e8dce1d4f81c3bd6e083f0e3f618c7..0500f223c22e49e8e20b933802454fa2890f8dbb 100644 --- a/qt/scientific_interfaces/Indirect/IndirectFitData.cpp +++ b/qt/scientific_interfaces/Indirect/IndirectFitData.cpp @@ -144,7 +144,7 @@ workspaceIndexVectorFromString(const std::string &listString) { auto const intVec = vectorFromString<int>(listString); std::vector<MantidQt::CustomInterfaces::IDA::WorkspaceIndex> output; for (auto const i : intVec) { - output.push_back(MantidQt::CustomInterfaces::IDA::WorkspaceIndex{i}); + output.emplace_back(MantidQt::CustomInterfaces::IDA::WorkspaceIndex{i}); } return output; } @@ -359,7 +359,7 @@ void IndirectFitData::validateSpectra(Spectra const &spectra) { std::vector<int> notInRange; for (auto const i : spectra) { if (i.value < 0 || i.value > maxValue) - notInRange.push_back(i.value); + notInRange.emplace_back(i.value); } if (!notInRange.empty()) { if (notInRange.size() > 5) diff --git a/qt/scientific_interfaces/Indirect/IqtFitModel.cpp b/qt/scientific_interfaces/Indirect/IqtFitModel.cpp index 8a846cbab188ce3d3fdf2bcb844adc5e307f8924..9151a2a3351fd16da99ab4a0df2f139be407dd66 100644 --- a/qt/scientific_interfaces/Indirect/IqtFitModel.cpp +++ b/qt/scientific_interfaces/Indirect/IqtFitModel.cpp @@ -47,7 +47,7 @@ std::vector<std::string> getParameters(IFunction_sptr function, for (const auto &longName : function->getParameterNames()) { if (boost::algorithm::ends_with(longName, shortParameterName)) - parameters.push_back(longName); + parameters.emplace_back(longName); } return parameters; } diff --git a/qt/scientific_interfaces/Indirect/Quasi.cpp b/qt/scientific_interfaces/Indirect/Quasi.cpp index 019e5fa9ce1a3e61fc83122802d446af509a7c79..7cfab96b06758db73b837a6541b326eb37e7ec5b 100644 --- a/qt/scientific_interfaces/Indirect/Quasi.cpp +++ b/qt/scientific_interfaces/Indirect/Quasi.cpp @@ -560,7 +560,7 @@ void Quasi::plotClicked() { auto const found = axisLabel.find(paramName); if (found != std::string::npos) { - spectraIndices.push_back(i); + spectraIndices.emplace_back(i); if (program == "Lorentzians") { if (spectraIndices.size() == 3) { diff --git a/qt/scientific_interfaces/Indirect/ResNorm.cpp b/qt/scientific_interfaces/Indirect/ResNorm.cpp index 8e779e540c7eca9707b659fecd71fb348b5a4f44..4f9324c27c7b7d704361d9447a156a12bbc34024 100644 --- a/qt/scientific_interfaces/Indirect/ResNorm.cpp +++ b/qt/scientific_interfaces/Indirect/ResNorm.cpp @@ -470,18 +470,18 @@ void ResNorm::plotCurrentPreview() { if (m_uiForm.ppPlot->hasCurve("Vanadium")) { plotWorkspaces.emplace_back( m_uiForm.dsVanadium->getCurrentDataName().toStdString()); - plotIndices.push_back(m_previewSpec); + plotIndices.emplace_back(m_previewSpec); } if (m_uiForm.ppPlot->hasCurve("Resolution")) { plotWorkspaces.emplace_back( m_uiForm.dsResolution->getCurrentDataName().toStdString()); - plotIndices.push_back(0); + plotIndices.emplace_back(0); } if (m_uiForm.ppPlot->hasCurve("Fit")) { std::string fitWsGroupName(m_pythonExportWsName + "_Fit_Workspaces"); plotWorkspaces.emplace_back("__" + fitWsGroupName + "_scaled"); - plotIndices.push_back(0); + plotIndices.emplace_back(0); } m_plotter->plotCorrespondingSpectra(plotWorkspaces, plotIndices); } diff --git a/qt/scientific_interfaces/MultiDatasetFit/MDFDataController.cpp b/qt/scientific_interfaces/MultiDatasetFit/MDFDataController.cpp index 1b976caa9d33f4efe7ecd9957e860ebc85277f2a..8a5627e92f0b04f215ca75d795066ee81ea9f375 100644 --- a/qt/scientific_interfaces/MultiDatasetFit/MDFDataController.cpp +++ b/qt/scientific_interfaces/MultiDatasetFit/MDFDataController.cpp @@ -55,7 +55,7 @@ void DataController::addWorkspace() { Mantid::API::AnalysisDataService::Instance() .retrieveWS<Mantid::API::MatrixWorkspace>(wsName.toStdString()); if (mws) { - matrixWorkspaces.push_back(mws); + matrixWorkspaces.emplace_back(mws); } else { auto grp = Mantid::API::AnalysisDataService::Instance() @@ -66,7 +66,7 @@ void DataController::addWorkspace() { mws = boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>( grp->getItem(i)); if (mws) { - matrixWorkspaces.push_back(mws); + matrixWorkspaces.emplace_back(mws); } } } diff --git a/qt/scientific_interfaces/Muon/ALCBaselineModellingPresenter.cpp b/qt/scientific_interfaces/Muon/ALCBaselineModellingPresenter.cpp index 7bb58c083780679a4ed209d298fc406af6761256..ffe2ce36f42f2ecaf878dd534664c37481ed330e 100644 --- a/qt/scientific_interfaces/Muon/ALCBaselineModellingPresenter.cpp +++ b/qt/scientific_interfaces/Muon/ALCBaselineModellingPresenter.cpp @@ -56,7 +56,7 @@ void ALCBaselineModellingPresenter::fit() { IALCBaselineModellingModel::Section parsedSection(min, max); - parsedSections.push_back(parsedSection); + parsedSections.emplace_back(parsedSection); } std::string funcStr = m_view->function().toStdString(); @@ -113,7 +113,7 @@ void ALCBaselineModellingPresenter::removeSection(int row) { std::vector<IALCBaselineModellingView::SectionRow> allRows; for (int i = 0; i < m_view->noOfSectionRows(); ++i) { - allRows.push_back(m_view->sectionRow(i)); + allRows.emplace_back(m_view->sectionRow(i)); } allRows.erase(allRows.begin() + row); diff --git a/qt/scientific_interfaces/Muon/ALCDataLoadingPresenter.cpp b/qt/scientific_interfaces/Muon/ALCDataLoadingPresenter.cpp index 5185db71b2d060c8cf669aab852f52fdc3b7e8b0..3e3de2da0b2142be3058947915d36e9ce6bbfd4f 100644 --- a/qt/scientific_interfaces/Muon/ALCDataLoadingPresenter.cpp +++ b/qt/scientific_interfaces/Muon/ALCDataLoadingPresenter.cpp @@ -277,7 +277,7 @@ void ALCDataLoadingPresenter::updateAvailableInfo() { const auto &properties = ws->run().getProperties(); for (auto property : properties) { - logs.push_back(property->name()); + logs.emplace_back(property->name()); } m_view->setAvailableLogs(logs); @@ -287,7 +287,7 @@ void ALCDataLoadingPresenter::updateAvailableInfo() { for (size_t i = 0; i < numPeriods; i++) { std::stringstream buffer; buffer << i + 1; - periods.push_back(buffer.str()); + periods.emplace_back(buffer.str()); } m_view->setAvailablePeriods(periods); diff --git a/qt/scientific_interfaces/Muon/ALCLatestFileFinder.cpp b/qt/scientific_interfaces/Muon/ALCLatestFileFinder.cpp index 3eb42ffeaba8fbc2dee104ea5f852845041be28c..7bd6d552eecc5cba6266ca357a313fa3478c0c8f 100644 --- a/qt/scientific_interfaces/Muon/ALCLatestFileFinder.cpp +++ b/qt/scientific_interfaces/Muon/ALCLatestFileFinder.cpp @@ -34,7 +34,7 @@ std::string ALCLatestFileFinder::getMostRecentFile() const { Poco::DirectoryIterator end; // the end iterator while (iter != end) { if (isValid(iter->path())) { - fileNames.push_back(iter->path()); + fileNames.emplace_back(iter->path()); } ++iter; } diff --git a/qt/scientific_interfaces/Muon/IO_MuonGrouping.cpp b/qt/scientific_interfaces/Muon/IO_MuonGrouping.cpp index 5e63f4f344e5a9f8a1b48015834ab40c1709e666..bd085510cecd1cc6e98ffb4912a078ba16d6509e 100644 --- a/qt/scientific_interfaces/Muon/IO_MuonGrouping.cpp +++ b/qt/scientific_interfaces/Muon/IO_MuonGrouping.cpp @@ -254,7 +254,7 @@ std::vector<int> MuonGroupingHelper::whichGroupToWhichRow() const { continue; } - groupToRow.push_back(i); + groupToRow.emplace_back(i); } return groupToRow; } @@ -293,7 +293,7 @@ std::vector<int> MuonGroupingHelper::whichPairToWhichRow() const { if (qwF->count() < 2 || qwB->count() < 2) continue; - pairToRow.push_back(i); + pairToRow.emplace_back(i); } return pairToRow; } diff --git a/qt/scientific_interfaces/Muon/MuonAnalysis.cpp b/qt/scientific_interfaces/Muon/MuonAnalysis.cpp index 81ff06749819f3158b8f62ba001670d96c8baa1b..ab0ebca7752cdf3070710ce2049f4ba8c21c7e6c 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysis.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysis.cpp @@ -98,8 +98,8 @@ void zoomYAxis(const QString &wsName, QMap<QString, QString> ¶ms) { for (size_t index = 0; index < matrix_workspace->e(0).size(); index++) { const auto &yData = matrix_workspace->y(0)[index]; const auto &eData = matrix_workspace->e(0)[index]; - yPlusEData.push_back(yData + eData); - yMinusEData.push_back(yData - eData); + yPlusEData.emplace_back(yData + eData); + yMinusEData.emplace_back(yData - eData); } auto xN = std::distance(xData.begin(), @@ -486,7 +486,7 @@ void MuonAnalysis::moveUnNormWS(const std::string &name, } if (ads.doesExist("tmp_unNorm")) { ads.rename("tmp_unNorm", name + unnorm); - wsNames.push_back(name + unnorm); + wsNames.emplace_back(name + unnorm); } } /** diff --git a/qt/scientific_interfaces/Muon/MuonAnalysisDataLoader.cpp b/qt/scientific_interfaces/Muon/MuonAnalysisDataLoader.cpp index 21ff4e7daf9f75ec5a51d2ab58d7e1e7260db3ef..857d2ae65bd91e5e93079ba5befc079380b1de49 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysisDataLoader.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysisDataLoader.cpp @@ -157,7 +157,7 @@ LoadResult MuonAnalysisDataLoader::loadFiles(const QStringList &files) const { "All the files should be produced by the same instrument"); } - loadedWorkspaces.push_back(loadedWorkspace); + loadedWorkspaces.emplace_back(loadedWorkspace); } // Some of the ARGUS data files contain wrong information about the @@ -458,11 +458,11 @@ void MuonAnalysisDataLoader::updateCache() const { for (const auto &entry : m_loadedDataCache) { const auto &ws = entry.second.loadedWorkspace; if (!ws) { // Workspace has been deleted - invalidKeys.push_back(entry.first); + invalidKeys.emplace_back(entry.first); } else if (const auto wsGroup = boost::dynamic_pointer_cast<WorkspaceGroup>(ws)) { if (wsGroup->size() == 0) { // Group has been cleared - invalidKeys.push_back(entry.first); + invalidKeys.emplace_back(entry.first); } } } diff --git a/qt/scientific_interfaces/Muon/MuonAnalysisFitDataPresenter.cpp b/qt/scientific_interfaces/Muon/MuonAnalysisFitDataPresenter.cpp index 4c2d399044237bbbfe6ee3454aef3ffc9596dd41..5f967f67fe997fe99914f7ede0edea890471e6cb 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysisFitDataPresenter.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysisFitDataPresenter.cpp @@ -395,8 +395,8 @@ std::vector<std::string> MuonAnalysisFitDataPresenter::generateWorkspaceNames( const std::string wsName = overwrite ? MuonAnalysisHelper::generateWorkspaceName(params) : getUniqueName(params); - workspaceNames.push_back(m_fitRawData ? wsName + RAW_DATA_SUFFIX - : wsName); + workspaceNames.emplace_back(m_fitRawData ? wsName + RAW_DATA_SUFFIX + : wsName); } } } diff --git a/qt/scientific_interfaces/Muon/MuonAnalysisFitDataTab.cpp b/qt/scientific_interfaces/Muon/MuonAnalysisFitDataTab.cpp index 7eb3fcd0b50e3964c94923af237e306cd9dc82c2..ab43bc1df1ad5e5162dac5836fe4f29e6e675a8e 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysisFitDataTab.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysisFitDataTab.cpp @@ -72,13 +72,13 @@ void MuonAnalysisFitDataTab::groupFittedWorkspaces( std::vector<std::string> inputWorkspaces; if (Mantid::API::AnalysisDataService::Instance().doesExist(wsNormalised)) { - inputWorkspaces.push_back(wsNormalised); + inputWorkspaces.emplace_back(wsNormalised); } if (Mantid::API::AnalysisDataService::Instance().doesExist(wsParameters)) { - inputWorkspaces.push_back(wsParameters); + inputWorkspaces.emplace_back(wsParameters); } if (Mantid::API::AnalysisDataService::Instance().doesExist(wsWorkspace)) { - inputWorkspaces.push_back(wsWorkspace); + inputWorkspaces.emplace_back(wsWorkspace); } if (inputWorkspaces.size() > 1) { diff --git a/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp b/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp index 767dbcf5024d4d470d54402be6b3c48873e62518..421addb7b1c205d7e2c0403d9975c0d647b39be4 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysisHelper.cpp @@ -57,7 +57,7 @@ getKeysFromTable(const Mantid::API::ITableWorkspace_sptr &tab) { do { std::string key; row >> key; - keys.push_back(key); + keys.emplace_back(key); } while (row.next()); } return keys; @@ -421,7 +421,7 @@ std::string getRunLabel(const std::vector<Workspace_sptr> &wsList) { int numWorkspaces = static_cast<int>(wsList.size()); for (int i = 0; i < numWorkspaces; i++) { int runNumber = firstPeriod(wsList[i])->getRunNumber(); - runNumbers.push_back(runNumber); + runNumbers.emplace_back(runNumber); } return getRunLabel(instrument, runNumbers); @@ -719,7 +719,7 @@ std::vector<std::string> findLogValues(const Workspace_sptr ws, matrixWS = boost::dynamic_pointer_cast<MatrixWorkspace>(ws); if (matrixWS) { if (matrixWS->run().hasProperty(logName)) { - values.push_back(matrixWS->run().getProperty(logName)->value()); + values.emplace_back(matrixWS->run().getProperty(logName)->value()); } } else { // It could be a workspace group @@ -730,7 +730,7 @@ std::vector<std::string> findLogValues(const Workspace_sptr ws, groupWS->getItem(index)); if (matrixWS) { if (matrixWS->run().hasProperty(logName)) { - values.push_back(matrixWS->run().getProperty(logName)->value()); + values.emplace_back(matrixWS->run().getProperty(logName)->value()); } } } @@ -807,7 +807,7 @@ void appendTimeSeriesLogs(Workspace_sptr toAppend, Workspace_sptr resultant, MatrixWorkspace_sptr matrixWS = boost::dynamic_pointer_cast<MatrixWorkspace>(ws); if (matrixWS) { - workspaces.push_back(matrixWS); + workspaces.emplace_back(matrixWS); } else { // it's a workspace group auto groupWS = boost::dynamic_pointer_cast<WorkspaceGroup>(ws); if (groupWS && groupWS->getNumberOfEntries() > 0) { @@ -815,7 +815,7 @@ void appendTimeSeriesLogs(Workspace_sptr toAppend, Workspace_sptr resultant, matrixWS = boost::dynamic_pointer_cast<MatrixWorkspace>( groupWS->getItem(index)); if (matrixWS) { - workspaces.push_back(matrixWS); + workspaces.emplace_back(matrixWS); } } } @@ -1035,11 +1035,11 @@ void parseRunLabel(const std::string &label, std::string &instrument, const int start = boost::lexical_cast<int>(pairTokenizer[0]); const int end = boost::lexical_cast<int>(endRun); for (int run = start; run < end + 1; run++) { - runNumbers.push_back(run); + runNumbers.emplace_back(run); } } else if (pairTokenizer.count() == 1) { // Single run - runNumbers.push_back(boost::lexical_cast<int>(pairTokenizer[0])); + runNumbers.emplace_back(boost::lexical_cast<int>(pairTokenizer[0])); } else { throw std::invalid_argument("Failed to parse run label: " + label + " too many tokens "); diff --git a/qt/scientific_interfaces/Muon/MuonAnalysisResultTableCreator.cpp b/qt/scientific_interfaces/Muon/MuonAnalysisResultTableCreator.cpp index 3101b6be2c0fb68f0449f249e491e56b4eefd12b..327a9661109ec944456579bb5e372ee293c0299a 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysisResultTableCreator.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysisResultTableCreator.cpp @@ -172,7 +172,7 @@ MuonAnalysisResultTableCreator::getWorkspacesByLabel() const { for (const auto &name : group->getNames()) { const size_t pos = name.find("_Workspace"); if (pos != std::string::npos) { - names.push_back(name.substr(0, pos)); + names.emplace_back(name.substr(0, pos)); } } if (names.empty()) { @@ -729,7 +729,7 @@ bool MuonAnalysisResultTableCreator::haveSameParameters( do { std::string key; row >> key; - keys.push_back(key); + keys.emplace_back(key); } while (row.next()); } return keys; @@ -779,7 +779,7 @@ void MuonAnalysisResultTableCreator::removeFixedParameterErrors( } } if (allZeros) { - zeroErrorColumns.push_back(name); + zeroErrorColumns.emplace_back(name); } } diff --git a/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h b/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h index 4f141cc75b351dd29d970fd3e322ebdd73e0c1ec..421ce981f8e082e09b902d16304a73ddb1b7fce6 100644 --- a/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h +++ b/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h @@ -82,13 +82,13 @@ public: m_view.get(), std::move(mockModel), nullptr, nullptr)); // default banks - m_ex_enginx_banks.push_back(true); - m_ex_enginx_banks.push_back(false); + m_ex_enginx_banks.emplace_back(true); + m_ex_enginx_banks.emplace_back(false); // default run number m_ex_empty_run_num.emplace_back(""); m_invalid_run_number.emplace_back(""); - m_ex_run_number.push_back(g_validRunNo); + m_ex_run_number.emplace_back(g_validRunNo); g_vanNo.emplace_back("8899999988"); g_ceriaNo.emplace_back("9999999999"); diff --git a/qt/scientific_interfaces/test/EnggDiffractionPresenterTest.h b/qt/scientific_interfaces/test/EnggDiffractionPresenterTest.h index 7164d6d2d556e6a57b66b783ab0ec86b2bdbd0ec..e64a6406bc90fc2bdb1d34da0c6ec4323f6791ea 100644 --- a/qt/scientific_interfaces/test/EnggDiffractionPresenterTest.h +++ b/qt/scientific_interfaces/test/EnggDiffractionPresenterTest.h @@ -94,16 +94,16 @@ public: new MantidQt::CustomInterfaces::EnggDiffractionPresenter(m_view.get())); // default banks - m_ex_enginx_banks.push_back(true); - m_ex_enginx_banks.push_back(false); + m_ex_enginx_banks.emplace_back(true); + m_ex_enginx_banks.emplace_back(false); // default run number m_ex_empty_run_num.emplace_back(""); m_invalid_run_number.emplace_back(""); - m_ex_run_number.push_back(g_validRunNo); + m_ex_run_number.emplace_back(g_validRunNo); g_vanNo.emplace_back("8899999988"); g_ceriaNo.emplace_back("9999999999"); - g_rebinRunNo.push_back(g_eventModeRunNo); + g_rebinRunNo.emplace_back(g_eventModeRunNo); // provide personal directories in order to carry out the full disable tests m_basicCalibSettings.m_inputDirCalib = "GUI_calib_folder/"; diff --git a/qt/scientific_interfaces/test/ISISReflectometry/Experiment/PerThetaDefaultsTableValidatorTest.h b/qt/scientific_interfaces/test/ISISReflectometry/Experiment/PerThetaDefaultsTableValidatorTest.h index dc19ad49e1d40ab2a61f48efe31d03cfd121a709..91b264bdc8de4ad03fe902345f769f43a675a7da 100644 --- a/qt/scientific_interfaces/test/ISISReflectometry/Experiment/PerThetaDefaultsTableValidatorTest.h +++ b/qt/scientific_interfaces/test/ISISReflectometry/Experiment/PerThetaDefaultsTableValidatorTest.h @@ -178,7 +178,7 @@ private: std::vector<int> columns) { std::vector<InvalidDefaultsError> errors; for (auto row : rows) - errors.push_back(InvalidDefaultsError(row, columns)); + errors.emplace_back(InvalidDefaultsError(row, columns)); return errors; } diff --git a/qt/scientific_interfaces/test/ISISReflectometry/MainWindow/MainWindowPresenterTest.h b/qt/scientific_interfaces/test/ISISReflectometry/MainWindow/MainWindowPresenterTest.h index d0bf7862c3c68e554424f5faf32353284863f42e..44bfe1ec641fb4736d3b593fdbcdee52ace4ef0c 100644 --- a/qt/scientific_interfaces/test/ISISReflectometry/MainWindow/MainWindowPresenterTest.h +++ b/qt/scientific_interfaces/test/ISISReflectometry/MainWindow/MainWindowPresenterTest.h @@ -312,7 +312,7 @@ private: // factory for (auto batchView : m_batchViews) { auto batchPresenter = new NiceMock<MockBatchPresenter>(); - m_batchPresenters.push_back(batchPresenter); + m_batchPresenters.emplace_back(batchPresenter); ON_CALL(*m_makeBatchPresenter, makeProxy(batchView)) .WillByDefault(Return(batchPresenter)); } diff --git a/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h b/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h index 6387a87bd4f3867366d50c1820ae99ea24f52cd8..3309e0558c544c47d8fb9f3a4e1167c2b81ed15b 100644 --- a/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h +++ b/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h @@ -958,7 +958,7 @@ private: std::vector<std::string> expectedNames{groupName + "_NormalisedCovarianceMatrix"}; if (!extracted) { - expectedNames.push_back(baseName + "_Workspaces"); + expectedNames.emplace_back(baseName + "_Workspaces"); } for (const auto &name : inputNames) { std::ostringstream oss; @@ -968,9 +968,9 @@ private: oss << baseName << "_" << wsParams.label << "_" << wsParams.itemName << "_" << wsParams.periods; if (extracted) { - expectedNames.push_back(oss.str() + "_Workspace"); + expectedNames.emplace_back(oss.str() + "_Workspace"); } - expectedNames.push_back(oss.str() + "_Parameters"); + expectedNames.emplace_back(oss.str() + "_Parameters"); } // Check expected workspaces in group auto groupNames(baseGroup->getNames()); diff --git a/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h b/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h index 69bfe8939c546e89d3de965dcabcb5ef6fabb78c..9fc646101c088a9014bdefec21616e88d4dcc608 100644 --- a/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h +++ b/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h @@ -83,7 +83,7 @@ public: std::vector<Workspace_sptr> list; for (int i = 15189; i <= 15193; ++i) { - list.push_back(createWs("MUSR", i)); + list.emplace_back(createWs("MUSR", i)); } std::string label = getRunLabel(list); @@ -95,7 +95,7 @@ public: std::vector<Workspace_sptr> list; for (auto it = runNumbers.begin(); it != runNumbers.end(); ++it) { - list.push_back(createWs("EMU", *it)); + list.emplace_back(createWs("EMU", *it)); } std::string label = getRunLabel(list); @@ -106,7 +106,7 @@ public: std::vector<int> runNumbers{1, 2, 3, 5, 6, 8, 10, 11, 12, 13, 14}; std::vector<Workspace_sptr> list; for (auto it = runNumbers.begin(); it != runNumbers.end(); it++) { - list.push_back(createWs("EMU", *it)); + list.emplace_back(createWs("EMU", *it)); } std::string label = getRunLabel(list); TS_ASSERT_EQUALS(label, "EMU00000001-3, 5-6, 8, 10-4"); @@ -116,7 +116,7 @@ public: std::vector<int> runNumbers{5, 14, 8, 1, 11, 3, 10, 6, 13, 12, 2}; std::vector<Workspace_sptr> list; for (auto it = runNumbers.begin(); it != runNumbers.end(); it++) { - list.push_back(createWs("EMU", *it)); + list.emplace_back(createWs("EMU", *it)); } std::string label = getRunLabel(list); TS_ASSERT_EQUALS(label, "EMU00000001-3, 5-6, 8, 10-4"); diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeManager.h b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeManager.h index 4a67a3e97263b27998a49d4a3bae937eb42f2354..5ac4b23b47b3cb2871a82e279a0b9c1f2e41bf8e 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeManager.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/DataProcessorUI/TreeManager.h @@ -115,7 +115,7 @@ protected: /// Add a command to the list of available commands void addCommand(std::vector<std::unique_ptr<Command>> &commands, std::unique_ptr<Command> command) { - commands.push_back(std::move(command)); + commands.emplace_back(std::move(command)); } }; } // namespace DataProcessor diff --git a/qt/widgets/common/inc/MantidQtWidgets/Common/TSVSerialiser.h b/qt/widgets/common/inc/MantidQtWidgets/Common/TSVSerialiser.h index 0a3851c14fe76a6d801904cfad8b11303e7a2a47..de00dd672bc1ff52ee2c9f2e137248a2f1b1fe2c 100644 --- a/qt/widgets/common/inc/MantidQtWidgets/Common/TSVSerialiser.h +++ b/qt/widgets/common/inc/MantidQtWidgets/Common/TSVSerialiser.h @@ -53,7 +53,7 @@ public: std::stringstream valSS(valStr); T ret; valSS >> ret; - val.push_back(ret); + val.emplace_back(ret); } return *this; } @@ -96,7 +96,7 @@ public: size_t index = 0; while (selectLine(name, index)) { auto value = std::forward<Extractor>(extractor)(*this); - container.push_back(value); + container.emplace_back(value); ++index; } } diff --git a/qt/widgets/common/src/AlgorithmDialog.cpp b/qt/widgets/common/src/AlgorithmDialog.cpp index b2ef362565dc41b72716a618340030cc710e2dfa..a6ce59e63514a7eb28e6af720ef4207acf514755 100644 --- a/qt/widgets/common/src/AlgorithmDialog.cpp +++ b/qt/widgets/common/src/AlgorithmDialog.cpp @@ -1064,7 +1064,7 @@ void AlgorithmDialog::setPreviousValue(QWidget *widget, */ void AlgorithmDialog::addAlgorithmObserver( Mantid::API::AlgorithmObserver *observer) { - m_observers.push_back(observer); + m_observers.emplace_back(observer); // turn off the keep open option - it would only confuse things if someone is // watching setShowKeepOpen(false); diff --git a/qt/widgets/common/src/AlgorithmHistoryWindow.cpp b/qt/widgets/common/src/AlgorithmHistoryWindow.cpp index 85f155372b636d446b5af8a0281be1b632aee365..810212287f59de136efddeadc1da82152461b0ab 100644 --- a/qt/widgets/common/src/AlgorithmHistoryWindow.cpp +++ b/qt/widgets/common/src/AlgorithmHistoryWindow.cpp @@ -644,7 +644,7 @@ void AlgHistoryTreeWidget::itemChecked(QTreeWidgetItem *item, int index) { do { modelIndex = indexFromItem(item, index); - indicies.push_back(modelIndex.row() + 1); + indicies.emplace_back(modelIndex.row() + 1); if (item->flags().testFlag(Qt::ItemIsUserCheckable)) { item->setCheckState(index, Qt::Checked); diff --git a/qt/widgets/common/src/AlgorithmPropertiesWidget.cpp b/qt/widgets/common/src/AlgorithmPropertiesWidget.cpp index aeac465a5cef4952bcada5b6a3d533be783824c8..86469c2135b5ac56cd74b6db95259d8024dbd0a6 100644 --- a/qt/widgets/common/src/AlgorithmPropertiesWidget.cpp +++ b/qt/widgets/common/src/AlgorithmPropertiesWidget.cpp @@ -316,7 +316,7 @@ void AlgorithmPropertiesWidget::replaceWSClicked(const QString &propName) { wsName = otherWidget->getValue(); if (!wsName.isEmpty()) { // Add the candidate to the list of candidates. - candidateReplacementSources.push_back(otherWidget); + candidateReplacementSources.emplace_back(otherWidget); } } } diff --git a/qt/widgets/common/src/AlgorithmSelectorWidget.cpp b/qt/widgets/common/src/AlgorithmSelectorWidget.cpp index f16b0268204e5174eb78b0b9a2f0faf292de341a..d054a80a7dea94f9e885e4fa4909c458a243cc65 100644 --- a/qt/widgets/common/src/AlgorithmSelectorWidget.cpp +++ b/qt/widgets/common/src/AlgorithmSelectorWidget.cpp @@ -374,7 +374,7 @@ void FindAlgComboBox::addAliases(AlgNamesType &algNamesList) { if ((!i->alias.empty()) && (!boost::iequals(i->alias, i->name))) { AlgorithmDescriptor newAlias(*i); newAlias.name = i->alias + " [" + i->name + "]"; - aliasList.push_back(newAlias); + aliasList.emplace_back(newAlias); } } // add them to the list - unsorted diff --git a/qt/widgets/common/src/CatalogHelper.cpp b/qt/widgets/common/src/CatalogHelper.cpp index 9ef526096061c8704089f5ca27d920c8258d6acf..cbbea22fbec6957b6f7c818f94078ad35865c91a 100644 --- a/qt/widgets/common/src/CatalogHelper.cpp +++ b/qt/widgets/common/src/CatalogHelper.cpp @@ -176,8 +176,8 @@ const std::vector<std::string> CatalogHelper::downloadDataFiles( // For each pair in userSelectedFiles we want to add them to their related // vector to pass to the algorithm. for (const auto &userSelectedFile : userSelectedFiles) { - fileIDs.push_back(userSelectedFile.first); - fileNames.push_back(userSelectedFile.second); + fileIDs.emplace_back(userSelectedFile.first); + fileNames.emplace_back(userSelectedFile.second); } // End of the ugly! diff --git a/qt/widgets/common/src/CatalogSelector.cpp b/qt/widgets/common/src/CatalogSelector.cpp index cf3f6922d75b791de1f175cc2dcb64fe4f5a182d..e5f37985db5229da11578226c5d39ed546c43fc4 100644 --- a/qt/widgets/common/src/CatalogSelector.cpp +++ b/qt/widgets/common/src/CatalogSelector.cpp @@ -28,10 +28,10 @@ std::vector<std::string> CatalogSelector::getSelectedCatalogSessions() { std::vector<std::string> selectedSessions; for (int row = 0; row < m_uiForm.selectedCatalogs->count(); ++row) { if (m_uiForm.selectedCatalogs->item(row)->isSelected()) { - selectedSessions.push_back(m_uiForm.selectedCatalogs->item(row) - ->data(Qt::UserRole) - .toString() - .toStdString()); + selectedSessions.emplace_back(m_uiForm.selectedCatalogs->item(row) + ->data(Qt::UserRole) + .toString() + .toStdString()); } } return selectedSessions; diff --git a/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp b/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp index 60f5af1cd7cf5420f9be25044af526b0ac59eb90..792e2e2919490fb048657742bfebaa1ebdc6b429 100644 --- a/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp +++ b/qt/widgets/common/src/DataProcessorUI/GenericDataProcessorPresenter.cpp @@ -1796,7 +1796,7 @@ void GenericDataProcessorPresenter::addCommands() { auto commands = m_manager->publishCommands(); std::vector<std::unique_ptr<Command>> commandsToShow; for (auto comm = 10u; comm < commands.size(); comm++) - commandsToShow.push_back(std::move(commands.at(comm))); + commandsToShow.emplace_back(std::move(commands.at(comm))); m_view->addActions(std::move(commandsToShow)); } diff --git a/qt/widgets/common/src/DataProcessorUI/ProcessingAlgorithmBase.cpp b/qt/widgets/common/src/DataProcessorUI/ProcessingAlgorithmBase.cpp index c8419aecbf31512be69b1e9aa7eb585adbfb391b..a286fda0162859a2c9e3596253d0973576a68e95 100644 --- a/qt/widgets/common/src/DataProcessorUI/ProcessingAlgorithmBase.cpp +++ b/qt/widgets/common/src/DataProcessorUI/ProcessingAlgorithmBase.cpp @@ -42,17 +42,18 @@ void ProcessingAlgorithmBase::countWsProperties() { (prop->type() == "MatrixWorkspace" || prop->type() == "Workspace" || prop->type() == "Workspace2D")) { - m_inputWsProperties.push_back(QString::fromStdString(prop->name())); + m_inputWsProperties.emplace_back(QString::fromStdString(prop->name())); } if (prop->direction() == Mantid::Kernel::Direction::Input && prop->type() == "str list") { - m_inputStrListProperties.push_back(QString::fromStdString(prop->name())); + m_inputStrListProperties.emplace_back( + QString::fromStdString(prop->name())); } if (prop->direction() == Mantid::Kernel::Direction::Output && (prop->type() == "MatrixWorkspace" || prop->type() == "Workspace")) { - m_OutputWsProperties.push_back(QString::fromStdString(prop->name())); + m_OutputWsProperties.emplace_back(QString::fromStdString(prop->name())); } } } diff --git a/qt/widgets/common/src/DataProcessorUI/QDataProcessorWidget.cpp b/qt/widgets/common/src/DataProcessorUI/QDataProcessorWidget.cpp index daa359bde56bb69f82acdc6c21c1f91d54e99553..df6b5c5669cdc2513943a878933da82f857dbd5f 100644 --- a/qt/widgets/common/src/DataProcessorUI/QDataProcessorWidget.cpp +++ b/qt/widgets/common/src/DataProcessorUI/QDataProcessorWidget.cpp @@ -161,7 +161,7 @@ void QDataProcessorWidget::addActions( // Put the commands in the toolbar for (auto &command : commands) { - m_commands.push_back( + m_commands.emplace_back( std::make_unique<QtCommandAdapter>(ui.rowToolBar, std::move(command))); } diff --git a/qt/widgets/common/src/DataProcessorUI/TreeData.cpp b/qt/widgets/common/src/DataProcessorUI/TreeData.cpp index 3417569d3603448aad924b1910070bbdd4cd7685..dd8d2e7e35d1e1971b4208383b273516d37133ba 100644 --- a/qt/widgets/common/src/DataProcessorUI/TreeData.cpp +++ b/qt/widgets/common/src/DataProcessorUI/TreeData.cpp @@ -267,7 +267,7 @@ RowData::addSlice(const QString &sliceSuffix, } } // Add to list of slices - m_slices.push_back(sliceData); + m_slices.emplace_back(sliceData); return sliceData; } diff --git a/qt/widgets/common/src/DataProcessorUI/WhiteList.cpp b/qt/widgets/common/src/DataProcessorUI/WhiteList.cpp index 3a3edb11408590f3f3cbd930311161fd685efba0..462663985b9312e7486d3bac07789c3046201bbb 100644 --- a/qt/widgets/common/src/DataProcessorUI/WhiteList.cpp +++ b/qt/widgets/common/src/DataProcessorUI/WhiteList.cpp @@ -25,13 +25,13 @@ void WhiteList::addElement(const QString &colName, const QString &algProperty, const QString &prefix, bool isKey) { m_names.emplace_back(colName); m_algorithmProperties.emplace_back(algProperty); - m_isShown.push_back(isShown); + m_isShown.emplace_back(isShown); /* std::vector<bool> does not have emplace_back until c++14 (currently not * fully supported on RHEL7). * See: http://en.cppreference.com/w/cpp/container/vector/emplace_back */ m_prefixes.emplace_back(prefix); m_descriptions.emplace_back(description); - m_isKey.push_back(isKey); + m_isKey.emplace_back(isKey); } /** Returns the column index for a column specified via its name diff --git a/qt/widgets/common/src/FindFilesWorker.cpp b/qt/widgets/common/src/FindFilesWorker.cpp index 8acff071b932289d6fd5806f90c54eee14d67b47..99ff90c2c6ff2dfb9072fcb062ec785ac0dabe12 100644 --- a/qt/widgets/common/src/FindFilesWorker.cpp +++ b/qt/widgets/common/src/FindFilesWorker.cpp @@ -100,7 +100,7 @@ void FindFilesWorker::run() { std::string result = fileSearcher.getFullPath(*it); Poco::File test(result); if ((!result.empty()) && test.exists()) { - filenames.push_back(*it); + filenames.emplace_back(*it); valueForProperty += QString::fromStdString(*it) + ","; } else { throw std::invalid_argument("File \"" + (*it) + "\" not found"); @@ -151,7 +151,7 @@ FindFilesWorker::getFilesFromAlgorithm() { dynamic_cast<MultipleFileProperty *>(prop); if (fileProp) { - filenames.push_back(fileProp->value()); + filenames.emplace_back(fileProp->value()); } else if (multiFileProp) { // This flattens any summed files to a set of single files so that you lose // the information about diff --git a/qt/widgets/common/src/FitPropertyBrowser.cpp b/qt/widgets/common/src/FitPropertyBrowser.cpp index 89c71b5bcfbaca59eda411004db6aa8ea97a287a..2da773ef2168cf38f5c53c42f508d042a90556ca 100644 --- a/qt/widgets/common/src/FitPropertyBrowser.cpp +++ b/qt/widgets/common/src/FitPropertyBrowser.cpp @@ -544,9 +544,9 @@ void FitPropertyBrowser::addFitResultWorkspacesToTableWidget() { auto name = outputName(); std::vector<std::string> workspaceNames; workspaceNames.reserve(3); - workspaceNames.push_back(name + "_NormalisedCovarianceMatrix"); - workspaceNames.push_back(name + "_Parameters"); - workspaceNames.push_back(name + "_Workspace"); + workspaceNames.emplace_back(name + "_NormalisedCovarianceMatrix"); + workspaceNames.emplace_back(name + "_Parameters"); + workspaceNames.emplace_back(name + "_Workspace"); for (const auto &name : workspaceNames) { // check if already in the list @@ -751,7 +751,7 @@ void FitPropertyBrowser::addFunction() { m_registeredFunctions[i].toStdString()); std::vector<std::string> tempCategories = f->categories(); for (size_t j = 0; j < tempCategories.size(); ++j) { - categories[tempCategories[boost::lexical_cast<int>(j)]].push_back( + categories[tempCategories[boost::lexical_cast<int>(j)]].emplace_back( m_registeredFunctions[i].toStdString()); } } @@ -2010,7 +2010,7 @@ QVector<double> FitPropertyBrowser::getXRange() { auto col = tbl->getColumn(xColumnIndex); try { for (size_t i = 0; i < tbl->rowCount(); ++i) { - xColumnData.push_back(col->toDouble(i)); + xColumnData.emplace_back(col->toDouble(i)); } } catch (std::invalid_argument &err) { QMessageBox::critical(this, "Mantid - Error", diff --git a/qt/widgets/common/src/MantidTreeModel.cpp b/qt/widgets/common/src/MantidTreeModel.cpp index 245da7d39d0a94a7e3d0317a561ddf4195d489fc..dccf683c2ca6af63769dc1d9b4d3939151b18f28 100644 --- a/qt/widgets/common/src/MantidTreeModel.cpp +++ b/qt/widgets/common/src/MantidTreeModel.cpp @@ -33,7 +33,7 @@ void MantidTreeModel::deleteWorkspaces(const QStringList &wsNames) { std::vector<std::string> vecWsNames; vecWsNames.reserve(wsNames.size()); foreach (auto wsName, wsNames) { - vecWsNames.push_back(wsName.toStdString()); + vecWsNames.emplace_back(wsName.toStdString()); } alg->setProperty("WorkspaceList", vecWsNames); executeAlgorithmAsync(alg); diff --git a/qt/widgets/common/src/MantidTreeWidget.cpp b/qt/widgets/common/src/MantidTreeWidget.cpp index 2a529efb39be1b5c62934bf0fd09c12a6f6c0c20..5dce3cd8ed8385c167c7582a21184f336dafed87 100644 --- a/qt/widgets/common/src/MantidTreeWidget.cpp +++ b/qt/widgets/common/src/MantidTreeWidget.cpp @@ -190,13 +190,13 @@ MantidTreeWidget::getSelectedMatrixWorkspaces() const { if (selectedWsNameSet.find(QString::fromStdString(childWsName)) == selectedWsNameSet.end()) { selectedWsNameSet.insert(QString::fromStdString(childWsName)); - selectedWsNameList.push_back(QString::fromStdString(childWsName)); + selectedWsNameList.emplace_back(QString::fromStdString(childWsName)); } } } else { if (selectedWsNameSet.find(wsName) == selectedWsNameSet.end()) { selectedWsNameSet.insert(wsName); - selectedWsNameList.push_back(wsName); + selectedWsNameList.emplace_back(wsName); } } } diff --git a/qt/widgets/common/src/NonOrthogonal.cpp b/qt/widgets/common/src/NonOrthogonal.cpp index 4d40423a6590576c484109e8e8fd5fa21740adbc..8b49d72d88695812edf3eab0010e46820d0794dc 100644 --- a/qt/widgets/common/src/NonOrthogonal.cpp +++ b/qt/widgets/common/src/NonOrthogonal.cpp @@ -80,7 +80,7 @@ void normalizeColumns(Mantid::Kernel::DblMatrix &skewMatrix) { for (size_t row = 0; row < numberOfRows; ++row) { sumOverRow += std::pow(skewMatrix[row][column], 2); } - bNorm.push_back(std::sqrt(sumOverRow)); + bNorm.emplace_back(std::sqrt(sumOverRow)); } // Apply column normalisation to skew matrix @@ -163,7 +163,7 @@ void doProvideSkewMatrix(Mantid::Kernel::DblMatrix &skewMatrix, // Expand matrix to 4 dimensions if necessary if (4 == workspace.getNumDims()) { - basisNormalization.push_back(1.0); + basisNormalization.emplace_back(1.0); Mantid::Kernel::DblMatrix temp(4, 4, true); for (std::size_t i = 0; i < 3; i++) { for (std::size_t j = 0; j < 3; j++) { diff --git a/qt/widgets/common/src/ProjectSaveModel.cpp b/qt/widgets/common/src/ProjectSaveModel.cpp index b322f6a87a103bc375cd5c85983fa3bbe71fecd9..a6bdeeb6dcd79c4816b7fe1c3375ef4d4e64b5f8 100644 --- a/qt/widgets/common/src/ProjectSaveModel.cpp +++ b/qt/widgets/common/src/ProjectSaveModel.cpp @@ -40,14 +40,14 @@ ProjectSaveModel::ProjectSaveModel( // then track it so we can always add it to the included // window list if (wsNames.size() == 0) { - m_unattachedWindows.push_back(window); + m_unattachedWindows.emplace_back(window); continue; } // otherwise add a reference mapping the window to the // it's various connected workspaces for (auto &name : wsNames) { - m_workspaceWindows[name].push_back(window); + m_workspaceWindows[name].emplace_back(window); } } } @@ -146,13 +146,13 @@ ProjectSaveModel::getWindowInformation(const std::vector<std::string> &wsNames, for (auto window : getUniqueWindows(wsNames)) { auto info = makeWindowInfoObject(window); - winInfo.push_back(info); + winInfo.emplace_back(info); } if (includeUnattached) { for (const auto window : m_unattachedWindows) { auto info = makeWindowInfoObject(window); - winInfo.push_back(info); + winInfo.emplace_back(info); } } @@ -185,11 +185,11 @@ std::vector<WorkspaceInfo> ProjectSaveModel::getWorkspaceInformation() const { auto group = boost::dynamic_pointer_cast<WorkspaceGroup>(ws); for (int i = 0; i < group->getNumberOfEntries(); ++i) { auto subInfo = makeWorkspaceInfoObject(group->getItem(i)); - info.subWorkspaces.push_back(subInfo); + info.subWorkspaces.emplace_back(subInfo); } } - wsInfo.push_back(info); + wsInfo.emplace_back(info); } return wsInfo; diff --git a/qt/widgets/common/src/RenameParDialog.cpp b/qt/widgets/common/src/RenameParDialog.cpp index 7b07c744c73aa0475a667029c074c094dd18ba8b..7f47ef501dacbafc3ee49a7414eeb5e70cda03b5 100644 --- a/qt/widgets/common/src/RenameParDialog.cpp +++ b/qt/widgets/common/src/RenameParDialog.cpp @@ -97,7 +97,8 @@ std::vector<std::string> RenameParDialog::setOutput() const { std::vector<std::string> out; QAbstractItemModel *model = m_uiForm.tableWidget->model(); for (int row = 0; row < m_uiForm.tableWidget->rowCount(); ++row) { - out.push_back(model->data(model->index(row, 1)).toString().toStdString()); + out.emplace_back( + model->data(model->index(row, 1)).toString().toStdString()); } return out; } diff --git a/qt/widgets/common/src/SelectFunctionDialog.cpp b/qt/widgets/common/src/SelectFunctionDialog.cpp index a2f5ac76f43c4db0b0b6c686fabfb4278d0a6504..6f8433c4f2c32cf97dfa6e39b3c0e605a600ea5e 100644 --- a/qt/widgets/common/src/SelectFunctionDialog.cpp +++ b/qt/widgets/common/src/SelectFunctionDialog.cpp @@ -55,7 +55,7 @@ SelectFunctionDialog::SelectFunctionDialog( auto f = factory.createFunction(registeredFunction); std::vector<std::string> tempCategories = f->categories(); for (size_t j = 0; j < tempCategories.size(); ++j) { - categories[tempCategories[boost::lexical_cast<int>(j)]].push_back( + categories[tempCategories[boost::lexical_cast<int>(j)]].emplace_back( registeredFunction); } } diff --git a/qt/widgets/common/src/TSVSerialiser.cpp b/qt/widgets/common/src/TSVSerialiser.cpp index d373e9e88e80f3e651e94d64d08f8391fc09e62c..a9a612766401b592e8c37b74dc141f63142ea748 100644 --- a/qt/widgets/common/src/TSVSerialiser.cpp +++ b/qt/widgets/common/src/TSVSerialiser.cpp @@ -49,7 +49,7 @@ void TSVSerialiser::parseLines(const std::string &lines) { // Check if this is a value line if (boost::regex_match(line, matches, valueLineRegex)) { std::string name = matches[1].str(); - m_lines[name].push_back(line); + m_lines[name].emplace_back(line); } // Look for lines which open and close a section in one line: // <section>data</section> @@ -57,7 +57,7 @@ void TSVSerialiser::parseLines(const std::string &lines) { std::string name = matches[1].str(); std::string contents = matches[2].str(); - m_sections[name].push_back(contents); + m_sections[name].emplace_back(contents); } // Check if this is the start of a multiline section, if so, consume the // whole section. @@ -107,7 +107,7 @@ void TSVSerialiser::parseLines(const std::string &lines) { if (sectionStr.size() > 0) sectionStr.resize(sectionStr.size() - 1); - m_sections[name + num].push_back(sectionStr); + m_sections[name + num].emplace_back(sectionStr); // Skip parsing to the end of the section lineIt = secIt; @@ -182,8 +182,8 @@ bool TSVSerialiser::selectSection(const std::string &name, const size_t i) { return false; m_curValues.clear(); - m_curValues.push_back(name); - m_curValues.push_back(m_sections[name][i]); + m_curValues.emplace_back(name); + m_curValues.emplace_back(m_sections[name][i]); m_curIndex = 1; // 1 because we want to start on the values, not the name return true; } diff --git a/qt/widgets/common/test/FindFilesThreadPoolManagerTest.h b/qt/widgets/common/test/FindFilesThreadPoolManagerTest.h index 5c602384c9399c2c183b8749e677df0b4a4565e5..cc50d5fc4e2e342d1b31cd61bbfb128c051c34ff 100644 --- a/qt/widgets/common/test/FindFilesThreadPoolManagerTest.h +++ b/qt/widgets/common/test/FindFilesThreadPoolManagerTest.h @@ -45,7 +45,7 @@ public: // The results we should get back FindFilesSearchResults exp_results; - exp_results.filenames.push_back("FoundFile"); + exp_results.filenames.emplace_back("FoundFile"); auto fakeAllocator = [&exp_results](const FindFilesSearchParameters ¶meters) { @@ -84,7 +84,7 @@ public: // The results we should get back FindFilesSearchResults exp_results; - exp_results.filenames.push_back("FoundFile"); + exp_results.filenames.emplace_back("FoundFile"); auto fakeAllocatorNoResults = [](const FindFilesSearchParameters ¶meters) { diff --git a/qt/widgets/common/test/LogValueFinderTest.h b/qt/widgets/common/test/LogValueFinderTest.h index a2ac03e7b7f8a584509d6e2baf6c4fd4753ce4a1..c8639737464212b63f2dbb5a3fadfd232276bc97 100644 --- a/qt/widgets/common/test/LogValueFinderTest.h +++ b/qt/widgets/common/test/LogValueFinderTest.h @@ -157,8 +157,8 @@ private: DateAndTime t; const std::string &time = "2016-08-24T14:26:0" + std::to_string(i); t.setFromISO8601(time); - times.push_back(t); - values.push_back(static_cast<double>(i + logValue)); + times.emplace_back(t); + values.emplace_back(static_cast<double>(i + logValue)); } tsp->addValues(times, values); run.addLogData(std::move(tsp)); diff --git a/qt/widgets/common/test/NonOrthogonalTest.h b/qt/widgets/common/test/NonOrthogonalTest.h index f9b106aee270bc633c87c7a33c3b863db3f99869..a3efd7f908148f8f9ec8df28c0968d8397648000 100644 --- a/qt/widgets/common/test/NonOrthogonalTest.h +++ b/qt/widgets/common/test/NonOrthogonalTest.h @@ -225,13 +225,13 @@ private: alg->setProperty("beta", 90.0); alg->setProperty("gamma", 120.0); std::vector<double> uVec; - uVec.push_back(1 * scale); - uVec.push_back(1); - uVec.push_back(0); + uVec.emplace_back(1 * scale); + uVec.emplace_back(1); + uVec.emplace_back(0); std::vector<double> vVec; - vVec.push_back(0); - vVec.push_back(0); - vVec.push_back(1); + vVec.emplace_back(0); + vVec.emplace_back(0); + vVec.emplace_back(1); alg->setProperty("u", uVec); alg->setProperty("v", vVec); alg->execute(); diff --git a/qt/widgets/common/test/ProjectSaveModelTest.h b/qt/widgets/common/test/ProjectSaveModelTest.h index b5c5902501491b574eebd22b1e22c065200b62eb..d620980862af321ece4dbfe0538c7103b2fd92b7 100644 --- a/qt/widgets/common/test/ProjectSaveModelTest.h +++ b/qt/widgets/common/test/ProjectSaveModelTest.h @@ -90,7 +90,7 @@ public: void testGetWindowsForWorkspaceOneWindow() { std::vector<MantidQt::API::IProjectSerialisable *> windows; WindowStub win1("window1", {"ws1"}); - windows.push_back(&win1); + windows.emplace_back(&win1); ProjectSaveModel model(windows); TS_ASSERT(model.hasWindows("ws1")); @@ -101,8 +101,8 @@ public: std::vector<MantidQt::API::IProjectSerialisable *> windows; WindowStub win1("window1", {"ws1"}); WindowStub win2("window2", {"ws1"}); - windows.push_back(&win1); - windows.push_back(&win2); + windows.emplace_back(&win1); + windows.emplace_back(&win2); ProjectSaveModel model(windows); TS_ASSERT(model.hasWindows("ws1")); @@ -113,8 +113,8 @@ public: std::vector<MantidQt::API::IProjectSerialisable *> windows; WindowStub win1("window1", {"ws1"}); WindowStub win2("window2", {"ws2"}); - windows.push_back(&win1); - windows.push_back(&win2); + windows.emplace_back(&win1); + windows.emplace_back(&win2); ProjectSaveModel model(windows); TS_ASSERT(model.hasWindows("ws1")); @@ -155,10 +155,10 @@ public: WindowStub win2("window2", {"ws2"}); WindowStub win3("window3", {"ws1", "ws2"}); WindowStub win4("window4", {}); - windows.push_back(&win1); - windows.push_back(&win2); - windows.push_back(&win3); - windows.push_back(&win4); + windows.emplace_back(&win1); + windows.emplace_back(&win2); + windows.emplace_back(&win3); + windows.emplace_back(&win4); ProjectSaveModel model(windows); auto names = model.getWindowNames({"ws1", "ws2"}); @@ -185,10 +185,10 @@ public: WindowStub win2("window2", {"ws2"}); WindowStub win3("window3", {"ws1", "ws2"}); WindowStub win4("window4", {}); - windows.push_back(&win1); - windows.push_back(&win2); - windows.push_back(&win3); - windows.push_back(&win4); + windows.emplace_back(&win1); + windows.emplace_back(&win2); + windows.emplace_back(&win3); + windows.emplace_back(&win4); ProjectSaveModel model(windows); auto windowsSubset = model.getUniqueWindows({"ws1", "ws2"}); @@ -277,10 +277,10 @@ public: WindowStub win2("window2", {"ws2"}); WindowStub win3("window3", {"ws1", "ws2"}); WindowStub win4("window4", {}); - windows.push_back(&win1); - windows.push_back(&win2); - windows.push_back(&win3); - windows.push_back(&win4); + windows.emplace_back(&win1); + windows.emplace_back(&win2); + windows.emplace_back(&win3); + windows.emplace_back(&win4); ProjectSaveModel model(windows); diff --git a/qt/widgets/common/test/ProjectSavePresenterTest.h b/qt/widgets/common/test/ProjectSavePresenterTest.h index d8bf4f27ef442e44315ad9b493f8dd30993c4faa..556b546cd1993a1560f86846b22e9ac4f275cdf5 100644 --- a/qt/widgets/common/test/ProjectSavePresenterTest.h +++ b/qt/widgets/common/test/ProjectSavePresenterTest.h @@ -346,7 +346,7 @@ public: WorkspaceCreationHelper::storeWS(name, ws); WorkspaceInfo info; info.name = name; - wsInfo.push_back(info); + wsInfo.emplace_back(info); } return wsInfo; diff --git a/qt/widgets/factory/src/WidgetFactory.cpp b/qt/widgets/factory/src/WidgetFactory.cpp index c20de9fe917c0671594a83acc69b10abba2a9ae1..7f17902026a0ba5a8aca17769c39902514bf71ab 100644 --- a/qt/widgets/factory/src/WidgetFactory.cpp +++ b/qt/widgets/factory/src/WidgetFactory.cpp @@ -62,7 +62,7 @@ WidgetFactory::createSliceViewerWindow(const QString &wsName, QPointer<MantidQt::SliceViewer::SliceViewerWindow> pWindow(window); // Save in a list for later use - m_windows.push_back(pWindow); + m_windows.emplace_back(pWindow); return window; } diff --git a/qt/widgets/instrumentview/src/InstrumentActor.cpp b/qt/widgets/instrumentview/src/InstrumentActor.cpp index 7d9e91d1c6924cc7ccb1aa3ff317f270a85d0435..90eaf2a3a7da5c80725a020e4e95d3e710cbf074 100644 --- a/qt/widgets/instrumentview/src/InstrumentActor.cpp +++ b/qt/widgets/instrumentview/src/InstrumentActor.cpp @@ -95,9 +95,9 @@ InstrumentActor::InstrumentActor(const QString &wsName, bool autoscaling, m_numGridLayers = 0; for (size_t i = 0; i < componentInfo().size(); ++i) { if (!componentInfo().isDetector(i)) - m_components.push_back(i); + m_components.emplace_back(i); else if (detectorInfo().isMonitor(i)) - m_monitors.push_back(i); + m_monitors.emplace_back(i); if (componentInfo().componentType(i) == Mantid::Beamline::ComponentType::Grid) { m_hasGrid = true; diff --git a/qt/widgets/instrumentview/src/InstrumentWidget.cpp b/qt/widgets/instrumentview/src/InstrumentWidget.cpp index 1fd8a10e6c4ead604bbb521dfa1eaaf8ab9b06de..b73f90f72778327fc168d44cd9b9a6f1d5b031c1 100644 --- a/qt/widgets/instrumentview/src/InstrumentWidget.cpp +++ b/qt/widgets/instrumentview/src/InstrumentWidget.cpp @@ -1226,10 +1226,10 @@ void InstrumentWidget::createTabs(QSettings &settings) { connect(mControlsTab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); - m_stateOfTabs.push_back(std::make_pair(std::string("Render"), true)); - m_stateOfTabs.push_back(std::make_pair(std::string("Pick"), true)); - m_stateOfTabs.push_back(std::make_pair(std::string("Draw"), true)); - m_stateOfTabs.push_back(std::make_pair(std::string("Instrument"), true)); + m_stateOfTabs.emplace_back(std::make_pair(std::string("Render"), true)); + m_stateOfTabs.emplace_back(std::make_pair(std::string("Pick"), true)); + m_stateOfTabs.emplace_back(std::make_pair(std::string("Draw"), true)); + m_stateOfTabs.emplace_back(std::make_pair(std::string("Instrument"), true)); addSelectedTabs(); m_tabs << m_renderTab << m_pickTab << m_maskTab << m_treeTab; } diff --git a/qt/widgets/instrumentview/src/InstrumentWidgetDecoder.cpp b/qt/widgets/instrumentview/src/InstrumentWidgetDecoder.cpp index 038fe9c49b2f59e539cdfb1b77c2414575f7c0a0..bca67b7364814049d2dc43d468033a6fbcc02eb2 100644 --- a/qt/widgets/instrumentview/src/InstrumentWidgetDecoder.cpp +++ b/qt/widgets/instrumentview/src/InstrumentWidgetDecoder.cpp @@ -349,7 +349,7 @@ void InstrumentWidgetDecoder::decodeAlignmentInfo( qLabMap[QString("y")].toDouble(), qLabMap[QString("z")].toDouble()); - alignmentPlane.push_back(std::make_pair(qValue, marker)); + alignmentPlane.emplace_back(std::make_pair(qValue, marker)); } obj->m_selectedAlignmentPlane = alignmentPlane; } diff --git a/qt/widgets/instrumentview/src/InstrumentWidgetPickTab.cpp b/qt/widgets/instrumentview/src/InstrumentWidgetPickTab.cpp index 13b391584cf6b12f7c5d0ae0f1b86b530c458ff6..ccd43d92bdb5d3dfbb8da6c35ad2f845891cf2c1 100644 --- a/qt/widgets/instrumentview/src/InstrumentWidgetPickTab.cpp +++ b/qt/widgets/instrumentview/src/InstrumentWidgetPickTab.cpp @@ -643,7 +643,7 @@ void InstrumentWidgetPickTab::addToContextMenu( QAction *action, std::function<bool(std::map<std::string, bool>)> &actionCondition) { auto pair = std::make_pair(action, actionCondition); - m_addedActions.push_back(pair); + m_addedActions.emplace_back(pair); } /** * Fill in the context menu. @@ -1611,7 +1611,7 @@ void DetectorPlotController::savePlotToWorkspace() { prepareDataForSinglePlot(actor.getDetectorByDetID(detid), x, y, &e); unitX = parentWorkspace->getAxis(0)->unit()->unitID(); // save det ids for the output workspace - detids.push_back(static_cast<Mantid::detid_t>(detid)); + detids.emplace_back(static_cast<Mantid::detid_t>(detid)); } else { continue; } diff --git a/qt/widgets/instrumentview/src/MaskBinsData.cpp b/qt/widgets/instrumentview/src/MaskBinsData.cpp index 96bd8b4611afe978b5ce18801aa591cd049ba803..23a17fb1e2d0faa89255c357376f439194c8282b 100644 --- a/qt/widgets/instrumentview/src/MaskBinsData.cpp +++ b/qt/widgets/instrumentview/src/MaskBinsData.cpp @@ -87,7 +87,7 @@ void MaskBinsData::loadFromProject(const std::string &lines) { for (size_t i = 0; i < numSpectra; ++i) { size_t spectrum; mask >> spectrum; - spectra.push_back(spectrum); + spectra.emplace_back(spectrum); } addXRange(start, end, spectra); diff --git a/qt/widgets/instrumentview/src/PanelsSurface.cpp b/qt/widgets/instrumentview/src/PanelsSurface.cpp index 2f5b363e6675ee21e1c9467f32e9ca8d53e3196c..38b3ad111f3360dbd6c3c9b9e425d71357c6cede 100644 --- a/qt/widgets/instrumentview/src/PanelsSurface.cpp +++ b/qt/widgets/instrumentview/src/PanelsSurface.cpp @@ -521,7 +521,7 @@ PanelsSurface::processUnstructured(size_t rootIndex, break; } } - detectors.push_back(child); + detectors.emplace_back(child); } setBankVisited(componentInfo, rootIndex, visited); return std::make_pair(detectors, normal); diff --git a/qt/widgets/instrumentview/src/PeakOverlay.cpp b/qt/widgets/instrumentview/src/PeakOverlay.cpp index e153ea63659f7dbcebf7cd86e81dc7952106f7fd..e57f6e3fa383b85ff06a8e48fa0b69ae0a1ab209 100644 --- a/qt/widgets/instrumentview/src/PeakOverlay.cpp +++ b/qt/widgets/instrumentview/src/PeakOverlay.cpp @@ -120,7 +120,7 @@ void AbstractIntensityScale::setPeaksWorkspace( intensities.reserve(peakCount); for (int i = 0; i < peakCount; ++i) { - intensities.push_back(pws->getPeak(i).getIntensity()); + intensities.emplace_back(pws->getPeak(i).getIntensity()); } auto minMaxIntensity = @@ -202,7 +202,7 @@ void PeakOverlay::removeShapes(const QList<Shape2D *> &shapeList) { PeakMarker2D *marker = dynamic_cast<PeakMarker2D *>(shape); if (!marker) throw std::logic_error("Wrong shape type found."); - rows.push_back(static_cast<size_t>(marker->getRow())); + rows.emplace_back(static_cast<size_t>(marker->getRow())); } // Run the DeleteTableRows algorithm to delete the peak. diff --git a/qt/widgets/instrumentview/src/Projection3D.cpp b/qt/widgets/instrumentview/src/Projection3D.cpp index 7b28061f6f089d7fe895eac3cc3bd1a8eec080e0..23689a7033021b6ce04c6aa1df1854c3ad079ae6 100644 --- a/qt/widgets/instrumentview/src/Projection3D.cpp +++ b/qt/widgets/instrumentview/src/Projection3D.cpp @@ -227,7 +227,7 @@ void Projection3D::getSelectedDetectors(std::vector<size_t> &detIndices) { m_viewport.transform(pos); if (pos.X() >= xLeft && pos.X() <= xRight && pos.Y() >= yBottom && pos.Y() <= yTop) { - detIndices.push_back(i); + detIndices.emplace_back(i); } } } @@ -276,7 +276,7 @@ void Projection3D::getMaskedDetectors(std::vector<size_t> &detIndices) const { if (pos.Z() < zmin || pos.Z() > zmax) continue; if (m_maskShapes.isMasked(pos.X(), pos.Y())) { - detIndices.push_back(i); + detIndices.emplace_back(i); } } } diff --git a/qt/widgets/instrumentview/src/ProjectionSurface.cpp b/qt/widgets/instrumentview/src/ProjectionSurface.cpp index ebab224261900e1d6627c968b7d8e03c7348290d..581a9a50ee1038966a1cc4f780171644286843de 100644 --- a/qt/widgets/instrumentview/src/ProjectionSurface.cpp +++ b/qt/widgets/instrumentview/src/ProjectionSurface.cpp @@ -908,7 +908,7 @@ void ProjectionSurface::comparePeaks(const QRect &rect) { // only collect peaks in the same detector & with the same origin if (marker->origin() == origin) { auto peak = po->getPeaksWorkspace()->getPeakPtr(marker->getRow()); - peaks.push_back(peak); + peaks.emplace_back(peak); } } } @@ -968,7 +968,7 @@ void ProjectionSurface::alignPeaks(const QRect &rect) { }); if (result == m_selectedAlignmentPlane.cend()) { - m_selectedAlignmentPlane.push_back( + m_selectedAlignmentPlane.emplace_back( std::make_pair(peak->getQSampleFrame(), origin)); } } else { diff --git a/qt/widgets/instrumentview/src/UnwrappedSurface.cpp b/qt/widgets/instrumentview/src/UnwrappedSurface.cpp index 7ef2b77ffece0b9e53c97b714b6ced07b698705b..6990522cea5e4ac96c360fa3951e5fefea8e18b2 100644 --- a/qt/widgets/instrumentview/src/UnwrappedSurface.cpp +++ b/qt/widgets/instrumentview/src/UnwrappedSurface.cpp @@ -323,7 +323,7 @@ void UnwrappedSurface::getSelectedDetectors(std::vector<size_t> &detIndices) { for (auto &udet : m_unwrappedDetectors) { if (udet.u >= uleft && udet.u <= uright && udet.v >= vbottom && udet.v <= vtop) { - detIndices.push_back(udet.detIndex); + detIndices.emplace_back(udet.detIndex); } } } @@ -335,7 +335,7 @@ void UnwrappedSurface::getMaskedDetectors( return; for (const auto &udet : m_unwrappedDetectors) { if (!udet.empty() && m_maskShapes.isMasked(udet.u, udet.v)) { - detIndices.push_back(udet.detIndex); + detIndices.emplace_back(udet.detIndex); } } } diff --git a/qt/widgets/plotting/src/Qwt/ContourPreviewPlot.cpp b/qt/widgets/plotting/src/Qwt/ContourPreviewPlot.cpp index 668f894eba43265fa5a04d3628b646e6b62ed620..2d40b18009a35a34b18fd87e47c75a564f8a0fbf 100644 --- a/qt/widgets/plotting/src/Qwt/ContourPreviewPlot.cpp +++ b/qt/widgets/plotting/src/Qwt/ContourPreviewPlot.cpp @@ -301,7 +301,7 @@ void ContourPreviewPlot::setVectorDimensions() { for (auto i = 0u; i < m_workspace->getNumDims(); ++i) { MDHistoDimension_sptr dimension(std::make_unique<MDHistoDimension>( m_workspace->getDimension(i).get())); - m_dimensions.push_back(dimension); + m_dimensions.emplace_back(dimension); } } } diff --git a/qt/widgets/plotting/src/Qwt/DisplayCurveFit.cpp b/qt/widgets/plotting/src/Qwt/DisplayCurveFit.cpp index 8b311c252a44cb57f12ccafe7e940b1b75473997..dbfec4fed65e0fa681ba0fea02ca71fdd1633e68 100644 --- a/qt/widgets/plotting/src/Qwt/DisplayCurveFit.cpp +++ b/qt/widgets/plotting/src/Qwt/DisplayCurveFit.cpp @@ -218,7 +218,7 @@ DisplayCurveFit::curveTypes DisplayCurveFit::namesToTypes(const QStringList &curveNames) const { DisplayCurveFit::curveTypes typesFound; for (const auto &curveName : curveNames) { - typesFound.push_back(this->nameToType(curveName)); + typesFound.emplace_back(this->nameToType(curveName)); } return typesFound; } diff --git a/qt/widgets/plotting/src/Qwt/MWView.cpp b/qt/widgets/plotting/src/Qwt/MWView.cpp index fbddb6130a0cde02d035515198b89970e1d94969..31c72c7aa36dd7e9c36c3b2bded9b3660963e438 100644 --- a/qt/widgets/plotting/src/Qwt/MWView.cpp +++ b/qt/widgets/plotting/src/Qwt/MWView.cpp @@ -272,7 +272,7 @@ void MWView::setVectorDimensions() { Mantid::Geometry::MDHistoDimension_sptr dimension( new Mantid::Geometry::MDHistoDimension( m_workspace->getDimension(d).get())); - m_dimensions.push_back(dimension); + m_dimensions.emplace_back(dimension); } } @@ -292,9 +292,9 @@ void MWView::spawnWellcomeWorkspace() { auto dataY = std::vector<double>(); for (int i = 0; i < numberSpectra; i++) { for (int j = 0; j < numberSpectra; j++) { - dataX.push_back(j * 1.); - dataY.push_back(intensity * (i * i + j * j) / - (2 * numberSpectra * numberSpectra)); + dataX.emplace_back(j * 1.); + dataY.emplace_back(intensity * (i * i + j * j) / + (2 * numberSpectra * numberSpectra)); } } auto createWsAlg = diff --git a/qt/widgets/plotting/src/Qwt/QwtHelper.cpp b/qt/widgets/plotting/src/Qwt/QwtHelper.cpp index fd40f415857353fd6431e284291d41a63615f70a..682bc756f94d774070e8913f0bad8cf8e8f8fd67 100644 --- a/qt/widgets/plotting/src/Qwt/QwtHelper.cpp +++ b/qt/widgets/plotting/src/Qwt/QwtHelper.cpp @@ -47,7 +47,7 @@ curveDataFromWs(MatrixWorkspace_const_sptr ws) { for (size_t wsIndex = 0; wsIndex < histograms; wsIndex++) { auto wsIdxData = curveDataFromWs(ws, wsIndex); - dataVector.push_back(wsIdxData); + dataVector.emplace_back(wsIdxData); } return dataVector; } diff --git a/qt/widgets/sliceviewer/src/CompositePeaksPresenter.cpp b/qt/widgets/sliceviewer/src/CompositePeaksPresenter.cpp index e6a1aa2b7c181c35a4201f0757b955384567af1a..c68f2ad07283e1005b773740ca55db9bdb30211a 100644 --- a/qt/widgets/sliceviewer/src/CompositePeaksPresenter.cpp +++ b/qt/widgets/sliceviewer/src/CompositePeaksPresenter.cpp @@ -158,7 +158,7 @@ void CompositePeaksPresenter::addPeaksPresenter(PeaksPresenter_sptr presenter) { // Only add a peaks presenter if the contents are different. The presenter may // be different, but manage the same workspace set. if (result_it == m_subjects.end() && presenter->contentsDifferent(this)) { - m_subjects.push_back(presenter); + m_subjects.emplace_back(presenter); presenter->registerOwningPresenter(this); } } diff --git a/qt/widgets/sliceviewer/src/ConcretePeaksPresenter.cpp b/qt/widgets/sliceviewer/src/ConcretePeaksPresenter.cpp index a71259a53e5f5ee3432d2f4a97f28be4c60bb0cd..54d9d98f2e7cb603fe1ac72fee68986a0e6491d9 100644 --- a/qt/widgets/sliceviewer/src/ConcretePeaksPresenter.cpp +++ b/qt/widgets/sliceviewer/src/ConcretePeaksPresenter.cpp @@ -616,7 +616,7 @@ ConcretePeaksPresenter::findVisiblePeakIndexes(const PeakBoundingBox &box) { for (size_t i = 0; i < outTable->rowCount(); ++i) { const bool insideRegion = outTable->cell<Boolean>(i, 1); if (insideRegion) { - indexes.push_back(i); + indexes.emplace_back(i); } } } diff --git a/qt/widgets/sliceviewer/src/LineViewer.cpp b/qt/widgets/sliceviewer/src/LineViewer.cpp index c2e6c03683ae873317fb0ac6a534192945d805ff..7077547d7107905a079eb1101d7aa9e49fc5a957 100644 --- a/qt/widgets/sliceviewer/src/LineViewer.cpp +++ b/qt/widgets/sliceviewer/src/LineViewer.cpp @@ -499,15 +499,15 @@ LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) { // The X basis vector alg->setPropertyValue("BasisVector0", "X,units," + basisX.toString(",")); - OutputExtents.push_back(0); - OutputExtents.push_back(length); - OutputBins.push_back(int(numBins)); + OutputExtents.emplace_back(0); + OutputExtents.emplace_back(length); + OutputBins.emplace_back(int(numBins)); // The Y basis vector, with one bin alg->setPropertyValue("BasisVector1", "Y,units," + basisY.toString(",")); - OutputExtents.push_back(-planeWidth); - OutputExtents.push_back(+planeWidth); - OutputBins.push_back(1); + OutputExtents.emplace_back(-planeWidth); + OutputExtents.emplace_back(+planeWidth); + OutputBins.emplace_back(1); // Now each remaining dimension std::string dimChars = "012345"; // SlicingAlgorithm::getDimensionChars(); @@ -523,9 +523,9 @@ LineViewer::applyMDWorkspace(Mantid::API::IMDWorkspace_sptr ws) { // Set the basis vector with the width *2 and 1 bin alg->setPropertyValue("BasisVector" + dim, dim + ",units," + basis.toString(",")); - OutputExtents.push_back(-0.5 * m_thickness[d]); - OutputExtents.push_back(+0.5 * m_thickness[d]); - OutputBins.push_back(1); + OutputExtents.emplace_back(-0.5 * m_thickness[d]); + OutputExtents.emplace_back(+0.5 * m_thickness[d]); + OutputBins.emplace_back(1); propNum++; if (propNum > dimChars.size()) diff --git a/qt/widgets/sliceviewer/src/QPeaksTableModel.cpp b/qt/widgets/sliceviewer/src/QPeaksTableModel.cpp index ab20dccdd559abd1ad488aca1edb6cf8c6b09715..31c376a25bda345a98fa5c0b572114efddde9932 100644 --- a/qt/widgets/sliceviewer/src/QPeaksTableModel.cpp +++ b/qt/widgets/sliceviewer/src/QPeaksTableModel.cpp @@ -365,7 +365,7 @@ std::vector<int> QPeaksTableModel::defaultHideCols() { Mantid::Kernel::InstrumentInfo instrInfo = Mantid::Kernel::ConfigService::Instance().getInstrument(instrName); if (instrInfo.facility().name() != "SNS") - result.push_back(COL_BANKNAME); + result.emplace_back(COL_BANKNAME); // hide some columns based on the techniques { // shrink variable scope @@ -376,15 +376,15 @@ std::vector<int> QPeaksTableModel::defaultHideCols() { const std::string DGS("TOF Direct Geometry Spectroscopy"); bool showEnergy(false); if (techniques.find(DGS) == techniques.end()) - result.push_back(COL_FINAL_ENERGY); + result.emplace_back(COL_FINAL_ENERGY); else showEnergy = true; if (techniques.find(IGS) == techniques.end()) - result.push_back(COL_INITIAL_ENERGY); + result.emplace_back(COL_INITIAL_ENERGY); else showEnergy = true; if (!showEnergy) - result.push_back(COL_ENERGY_TRANSFER); + result.emplace_back(COL_ENERGY_TRANSFER); } } catch (Mantid::Kernel::Exception::NotFoundError &) { // Unable to fetch instrument info, so continue without it. diff --git a/qt/widgets/sliceviewer/src/SliceViewer.cpp b/qt/widgets/sliceviewer/src/SliceViewer.cpp index ba4d4665f4e018f11d3124aea0e797d0df3d606f..9691328edc75b63f621ed5cecf9899d4b5185612 100644 --- a/qt/widgets/sliceviewer/src/SliceViewer.cpp +++ b/qt/widgets/sliceviewer/src/SliceViewer.cpp @@ -644,7 +644,7 @@ void SliceViewer::updateDimensionSliceWidgets() { SLOT(rebinParamsChanged())); // Save in this list - m_dimWidgets.push_back(widget); + m_dimWidgets.emplace_back(widget); } } // Hide unnecessary ones @@ -815,7 +815,7 @@ void SliceViewer::setWorkspace(Mantid::API::IMDWorkspace_sptr ws) { MDHistoDimension_sptr dim( new MDHistoDimension(m_ws->getDimension(d).get())); dim->setRange(numBins, min, max); - m_dimensions.push_back(dim); + m_dimensions.emplace_back(dim); } if (!mess.str().empty()) { @@ -1640,7 +1640,7 @@ void SliceViewer::updateDisplay(bool resetAxes) { } else if (widget->getShownDim() == 1) { m_dimY = d; } - slicePoint.push_back(VMD_t(widget->getSlicePoint())); + slicePoint.emplace_back(VMD_t(widget->getSlicePoint())); } // Avoid going out of range if (m_dimX >= m_ws->getNumDims()) @@ -2320,9 +2320,9 @@ void SliceViewer::rebinParamsChanged() { numBins = widget->getNumBins(); } - OutputExtents.push_back(min); - OutputExtents.push_back(max); - OutputBins.push_back(numBins); + OutputExtents.emplace_back(min); + OutputExtents.emplace_back(max); + OutputBins.emplace_back(numBins); // Set the BasisVector property... VMD basis(m_ws->getNumDims()); diff --git a/qt/widgets/sliceviewer/test/CoordinateTransformTest.h b/qt/widgets/sliceviewer/test/CoordinateTransformTest.h index af6d589998ff0bfe882b9d153bed6c6dc8a018ca..fe1cf160fa964178e73cffcbab628cf4d382c8b8 100644 --- a/qt/widgets/sliceviewer/test/CoordinateTransformTest.h +++ b/qt/widgets/sliceviewer/test/CoordinateTransformTest.h @@ -71,13 +71,13 @@ private: alg->setProperty("beta", 90.0); alg->setProperty("gamma", 120.0); std::vector<double> uVec; - uVec.push_back(1 * scale); - uVec.push_back(1); - uVec.push_back(0); + uVec.emplace_back(1 * scale); + uVec.emplace_back(1); + uVec.emplace_back(0); std::vector<double> vVec; - vVec.push_back(0); - vVec.push_back(0); - vVec.push_back(1); + vVec.emplace_back(0); + vVec.emplace_back(0); + vVec.emplace_back(1); alg->setProperty("u", uVec); alg->setProperty("v", vVec); alg->execute(); diff --git a/qt/widgets/sliceviewer/test/PeakRepresentationCrossTest.h b/qt/widgets/sliceviewer/test/PeakRepresentationCrossTest.h index 4e8ff9287786c273f08a93440b40bd99ac9fcb0f..ee1159de1130036bfcda0b1d00895017ad5001b8 100644 --- a/qt/widgets/sliceviewer/test/PeakRepresentationCrossTest.h +++ b/qt/widgets/sliceviewer/test/PeakRepresentationCrossTest.h @@ -215,8 +215,8 @@ public: for (int y = 0; y < sizeInAxis; ++y) { for (int z = 0; z < sizeInAxis; ++z) { Mantid::Kernel::V3D peakOrigin(x, y, z); - m_peaks.push_back(boost::make_shared< - MantidQt::SliceViewer::PeakRepresentationCross>( + m_peaks.emplace_back(boost::make_shared< + MantidQt::SliceViewer::PeakRepresentationCross>( peakOrigin, maxZ, minZ)); } } diff --git a/qt/widgets/sliceviewer/test/PeakRepresentationSphereTest.h b/qt/widgets/sliceviewer/test/PeakRepresentationSphereTest.h index 2453c54602b9f606c3f67015c27e889618642806..c96855c99980f669f6dab86d5e4193567a2b006a 100644 --- a/qt/widgets/sliceviewer/test/PeakRepresentationSphereTest.h +++ b/qt/widgets/sliceviewer/test/PeakRepresentationSphereTest.h @@ -264,8 +264,8 @@ public: for (int y = 0; y < sizeInAxis; ++y) { for (int z = 0; z < sizeInAxis; ++z) { Mantid::Kernel::V3D peakOrigin(x, y, z); - m_peaks.push_back(boost::make_shared< - PeakRepresentationSphereExposeProtectedWrapper>( + m_peaks.emplace_back(boost::make_shared< + PeakRepresentationSphereExposeProtectedWrapper>( peakOrigin, radius, innerBackgroundRadius, outerBackgroundRadius)); } diff --git a/qt/widgets/spectrumviewer/src/GraphDisplay.cpp b/qt/widgets/spectrumviewer/src/GraphDisplay.cpp index 9f485be8d2576cdf12f3e0307a4b70b5664f6be4..5ba1fff44ecec6f1223678e76ff25bf16714b730 100644 --- a/qt/widgets/spectrumviewer/src/GraphDisplay.cpp +++ b/qt/widgets/spectrumviewer/src/GraphDisplay.cpp @@ -40,10 +40,10 @@ GraphDisplay::GraphDisplay(QwtPlot *graphPlot, QTableWidget *graphTable, if (isVertical) graphPlot->setAxisMaxMajor(QwtPlot::xBottom, 3); - g_curveColors.push_back(Qt::black); - g_curveColors.push_back(Qt::red); - g_curveColors.push_back(Qt::green); - g_curveColors.push_back(Qt::blue); + g_curveColors.emplace_back(Qt::black); + g_curveColors.emplace_back(Qt::red); + g_curveColors.emplace_back(Qt::green); + g_curveColors.emplace_back(Qt::blue); } GraphDisplay::~GraphDisplay() { clearCurves(); } diff --git a/qt/widgets/spectrumviewer/src/MatrixWSDataSource.cpp b/qt/widgets/spectrumviewer/src/MatrixWSDataSource.cpp index ac4b0f4917559dbc3c0e1cf2b4cd809641c67be9..30c1f67b2ddf54a92c7815cf31954d8409e9c994 100644 --- a/qt/widgets/spectrumviewer/src/MatrixWSDataSource.cpp +++ b/qt/widgets/spectrumviewer/src/MatrixWSDataSource.cpp @@ -257,7 +257,7 @@ std::vector<std::string> MatrixWSDataSource::getInfoList(double x, double y) { if (!ids.empty()) { list.emplace_back("Det ID"); const int64_t id = static_cast<int64_t>(*(ids.begin())); - list.push_back(boost::lexical_cast<std::string>(id)); + list.emplace_back(boost::lexical_cast<std::string>(id)); } /* Now try to do various unit conversions to get equivalent info */ diff --git a/qt/widgets/spectrumviewer/src/SVConnections.cpp b/qt/widgets/spectrumviewer/src/SVConnections.cpp index b96996e2b035b11b9c284a2fa1f49348a59fbf97..3c37604cb47c79967d0a399ce5cb0a76bbce0c92 100644 --- a/qt/widgets/spectrumviewer/src/SVConnections.cpp +++ b/qt/widgets/spectrumviewer/src/SVConnections.cpp @@ -546,7 +546,7 @@ void SVConnections::loadColorMap(const QString &file_name) { std::vector<QRgb> positive_color_table; for (int i = 1; i < mantid_color_table.size(); i++) // NO NaN Color { - positive_color_table.push_back(mantid_color_table[i]); + positive_color_table.emplace_back(mantid_color_table[i]); } int n_colors = (int)positive_color_table.size(); diff --git a/qt/widgets/spectrumviewer/src/SVUtils.cpp b/qt/widgets/spectrumviewer/src/SVUtils.cpp index bdd75b8ca7b168cf19ca5b9fe065d724da9a1b2b..68b51de1032f73fbc2bf34e87c34e12b56ab08c5 100644 --- a/qt/widgets/spectrumviewer/src/SVUtils.cpp +++ b/qt/widgets/spectrumviewer/src/SVUtils.cpp @@ -50,11 +50,11 @@ void SVUtils::Format(int width, int precision, double value, std::string &str) { */ void SVUtils::PushNameValue(const std::string &name, int width, int precision, double value, std::vector<std::string> &list) { - list.push_back(name); + list.emplace_back(name); std::string value_str; Format(width, precision, value, value_str); - list.push_back(value_str); + list.emplace_back(value_str); } /** diff --git a/qt/widgets/spectrumviewer/src/SpectrumView.cpp b/qt/widgets/spectrumviewer/src/SpectrumView.cpp index 861d67e922d7c6da2fc2a9f68e14671fdcf98dec..96f2cfab50995beaa00ea098697d10c660400237 100644 --- a/qt/widgets/spectrumviewer/src/SpectrumView.cpp +++ b/qt/widgets/spectrumviewer/src/SpectrumView.cpp @@ -106,7 +106,7 @@ void SpectrumView::renderWorkspace( return; auto dataSource = MatrixWSDataSource_sptr(new MatrixWSDataSource(wksp)); - m_dataSource.push_back(dataSource); + m_dataSource.emplace_back(dataSource); // If we have a MatrixWSDataSource give it the handler for the // EMode, so the user can set EMode and EFixed. NOTE: we could avoid @@ -471,7 +471,7 @@ std::string SpectrumView::getWindowName() { std::vector<std::string> SpectrumView::getWorkspaceNames() { std::vector<std::string> names; for (const auto &source : m_dataSource) { - names.push_back(source->getWorkspace()->getName()); + names.emplace_back(source->getWorkspace()->getName()); } return names; }