diff --git a/Framework/API/src/AnalysisDataService.cpp b/Framework/API/src/AnalysisDataService.cpp index a297e893ca04850afacd93f13e76159a0912c74d..3dc8a983bfabe92474b1026564b87b5511dbe6e3 100644 --- a/Framework/API/src/AnalysisDataService.cpp +++ b/Framework/API/src/AnalysisDataService.cpp @@ -240,7 +240,7 @@ AnalysisDataServiceImpl::topLevelItems() const { try { const std::string &name = *it; auto ws = this->retrieve(*it); - topLevel.insert(std::make_pair(name, ws)); + topLevel.emplace(name, ws); if (auto group = boost::dynamic_pointer_cast<WorkspaceGroup>(ws)) { group->reportMembers(groupMembers); } diff --git a/Framework/API/src/CatalogManager.cpp b/Framework/API/src/CatalogManager.cpp index 06123f0fdea8e716b9602d0e99b4024c7e594152..82d458c4274e2087417e9d2319e2149143409ff5 100644 --- a/Framework/API/src/CatalogManager.cpp +++ b/Framework/API/src/CatalogManager.cpp @@ -36,7 +36,7 @@ CatalogSession_sptr CatalogManagerImpl::login(const std::string &username, catalog->login(username, password, endpoint, facility); // Creates a new catalog and adds it to the compositeCatalog and activeCatalog // list. - m_activeCatalogs.insert(std::make_pair(session, catalog)); + m_activeCatalogs.emplace(session, catalog); return session; } diff --git a/Framework/API/test/ExperimentInfoTest.h b/Framework/API/test/ExperimentInfoTest.h index c4acb15b37c1f02d0bf9407281fc405ec5383d2e..da4aa3a1fadf781d3d27150298718841d4f140f7 100644 --- a/Framework/API/test/ExperimentInfoTest.h +++ b/Framework/API/test/ExperimentInfoTest.h @@ -494,8 +494,7 @@ public: else ft.to.setFromISO8601("2100-01-01T00:00:00"); - idfFiles.insert(std::pair<std::string, fromToEntry>( - l_filenamePart.substr(0, found), ft)); + idfFiles.emplace(l_filenamePart.substr(0, found), ft); idfIdentifiers.insert(l_filenamePart.substr(0, found)); } } diff --git a/Framework/Algorithms/src/ChangeTimeZero.cpp b/Framework/Algorithms/src/ChangeTimeZero.cpp index 78a8651b507653a127725c228a9d0db969cd4f1f..d6f6b8ae6b6008cc6405dc630b6447f3fb2d9cf3 100644 --- a/Framework/Algorithms/src/ChangeTimeZero.cpp +++ b/Framework/Algorithms/src/ChangeTimeZero.cpp @@ -281,23 +281,23 @@ std::map<std::string, std::string> ChangeTimeZero::validateInputs() { // If both inputs are being used, then return straight away. if (isRelative && absoluteTimeInput) { - invalidProperties.insert(std::make_pair( - "RelativeTimeOffset", "You can either sepcify a relative time shift or " - "an absolute time shift.")); - invalidProperties.insert(std::make_pair( - "AbsoluteTimeOffset", "You can either sepcify a relative time shift or " - "an absolute time shift.")); + invalidProperties.emplace("RelativeTimeOffset", + "You can either sepcify a relative time shift or " + "an absolute time shift."); + invalidProperties.emplace("AbsoluteTimeOffset", + "You can either sepcify a relative time shift or " + "an absolute time shift."); return invalidProperties; } else if (!isRelative && !isAbsolute) { - invalidProperties.insert(std::make_pair( + invalidProperties.emplace( "RelativeTimeOffset", "TimeOffset must either be a numeric " - "value or a ISO8601 (YYYY-MM-DDTHH:MM::SS) date-time stamp.")); - invalidProperties.insert(std::make_pair( + "value or a ISO8601 (YYYY-MM-DDTHH:MM::SS) date-time stamp."); + invalidProperties.emplace( "AbsoluteTimeOffset", "TimeOffset must either be a numeric " - "value or a ISO8601 (YYYY-MM-DDTHH:MM::SS) date-time stamp.")); + "value or a ISO8601 (YYYY-MM-DDTHH:MM::SS) date-time stamp."); } // If we are dealing with an absolute time we need to ensure that the diff --git a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp index 77b7a209f5df67c0a4e515e94df82f327ad8da35..a6a21a9d8380ba2fce140608e0a6efc913cb16e8 100644 --- a/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp +++ b/Framework/Algorithms/src/ConvertAxesToRealSpace.cpp @@ -309,7 +309,7 @@ void ConvertAxesToRealSpace::fillUnitMap( std::vector<std::string> &orderedVector, std::map<std::string, std::string> &unitMap, const std::string &caption, const std::string &unit) { - unitMap.insert(std::make_pair(caption, unit)); + unitMap.emplace(caption, unit); orderedVector.push_back(caption); } diff --git a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp index b96a7de9c9b50dbdf41f0f0336c5c928c9cd321b..638ba06d41548fe7a606e1f510f99142c6812e11 100644 --- a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp +++ b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp @@ -116,7 +116,7 @@ void ConvertSpectrumAxis::exec() { toUnit->fromTOF(xval, emptyVector, l1val, l2, twoTheta, emode, efixed, delta); double value = (xval.front() + xval.back()) / 2; - indexMap.insert(std::make_pair(value, i)); + indexMap.emplace(value, i); } } else { // Set up binding to memeber funtion. Avoids condition as part of loop over @@ -135,7 +135,7 @@ void ConvertSpectrumAxis::exec() { try { IDetector_const_sptr det = inputWS->getDetector(i); // Invoke relevant member function. - indexMap.insert(std::make_pair(thetaFunction(det) * 180.0 / M_PI, i)); + indexMap.emplace(thetaFunction(det) * 180.0 / M_PI, i); } catch (Exception::NotFoundError &) { if (!warningGiven) g_log.warning("The instrument definition is incomplete - spectra " diff --git a/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp b/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp index 9c7eb77b14d8e463fdf103ad4f54da74d242ddd3..e96b993b22dc5c7a05c21ecf6d51c619470e2c94 100644 --- a/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp +++ b/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp @@ -129,7 +129,7 @@ void ConvertSpectrumAxis2::createThetaMap(API::Progress &progress, try { IDetector_const_sptr det = inputWS->getDetector(i); // Invoke relevant member function. - m_indexMap.insert(std::make_pair(thetaFunction(det) * 180.0 / M_PI, i)); + m_indexMap.emplace(thetaFunction(det) * 180.0 / M_PI, i); } catch (Exception::NotFoundError &) { if (!warningGiven) g_log.warning("The instrument definition is incomplete - spectra " @@ -176,13 +176,13 @@ void ConvertSpectrumAxis2::createElasticQMap(API::Progress &progress, double elasticQInAngstroms = Kernel::UnitConversion::run(twoTheta, efixed); if (targetUnit == "ElasticQ") { - m_indexMap.insert(std::make_pair(elasticQInAngstroms, i)); + m_indexMap.emplace(elasticQInAngstroms, i); } else if (targetUnit == "ElasticQSquared") { // The QSquared value. double elasticQSquaredInAngstroms = elasticQInAngstroms * elasticQInAngstroms; - m_indexMap.insert(std::make_pair(elasticQSquaredInAngstroms, i)); + m_indexMap.emplace(elasticQSquaredInAngstroms, i); } progress.report("Converting to Elastic Q..."); diff --git a/Framework/Algorithms/src/CreateLogPropertyTable.cpp b/Framework/Algorithms/src/CreateLogPropertyTable.cpp index ca716941326bc32f200ac4fbbfa445992ae6f85d..d2e05949367d1fb331a5d1029c25c7cb0deccc1f 100644 --- a/Framework/Algorithms/src/CreateLogPropertyTable.cpp +++ b/Framework/Algorithms/src/CreateLogPropertyTable.cpp @@ -237,9 +237,9 @@ const std::map<std::string, GroupPolicy> &getGroupPolicyMap() { // Populate the map if empty. if (map.empty()) { - map.insert(std::make_pair("All", ALL)); - map.insert(std::make_pair("First", FIRST)); - map.insert(std::make_pair("None", NONE)); + map.emplace("All", ALL); + map.emplace("First", FIRST); + map.emplace("None", NONE); } return map; @@ -292,12 +292,12 @@ const std::map<std::string, Math::StatisticType> &getStatisticTypeMap() { // Populate the map if empty. if (map.empty()) { - map.insert(std::make_pair("FirstValue", Math::StatisticType::FirstValue)); - map.insert(std::make_pair("LastValue", Math::StatisticType::LastValue)); - map.insert(std::make_pair("Minimum", Math::StatisticType::Minimum)); - map.insert(std::make_pair("Maximum", Math::StatisticType::Maximum)); - map.insert(std::make_pair("Mean", Math::StatisticType::Mean)); - map.insert(std::make_pair("Median", Math::StatisticType::Median)); + map.emplace("FirstValue", Math::StatisticType::FirstValue); + map.emplace("LastValue", Math::StatisticType::LastValue); + map.emplace("Minimum", Math::StatisticType::Minimum); + map.emplace("Maximum", Math::StatisticType::Maximum); + map.emplace("Mean", Math::StatisticType::Mean); + map.emplace("Median", Math::StatisticType::Median); } return map; diff --git a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp index 4652655b238a0dd0130e7c75e78c0219e19a592f..af34e115b26676747089958fc8fda88995b96264 100644 --- a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp +++ b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp @@ -112,7 +112,7 @@ void CreateLogTimeCorrection::getInstrumentSetup() { IDetector_const_sptr detector = m_instrument->getDetector(detids[i]); V3D detpos = detector->getPos(); double l2 = detpos.distance(samplepos); - m_l2map.insert(make_pair(detids[i], l2)); + m_l2map.emplace(detids[i], l2); } // 3. Output information @@ -134,7 +134,7 @@ void CreateLogTimeCorrection::calculateCorrection() { int detid = miter->first; double l2 = miter->second; double corrfactor = m_L1 / (m_L1 + l2); - m_correctionMap.insert(make_pair(detid, corrfactor)); + m_correctionMap.emplace(detid, corrfactor); } } diff --git a/Framework/Algorithms/src/CreatePSDBleedMask.cpp b/Framework/Algorithms/src/CreatePSDBleedMask.cpp index c2c563d3968365e9e3358a87f1aeb32dd88a1571..63317cf6ad48bb64abc8d5b9c4257053374b095e 100644 --- a/Framework/Algorithms/src/CreatePSDBleedMask.cpp +++ b/Framework/Algorithms/src/CreatePSDBleedMask.cpp @@ -143,8 +143,7 @@ void CreatePSDBleedMask::exec() { } // New tube else { - tubeMap.insert(std::pair<TubeIndex::key_type, TubeIndex::mapped_type>( - parentID, TubeIndex::mapped_type(1, i))); + tubeMap.emplace(parentID, TubeIndex::mapped_type(1, i)); } progress.report(); diff --git a/Framework/Algorithms/src/CreateSampleWorkspace.cpp b/Framework/Algorithms/src/CreateSampleWorkspace.cpp index caf599fbcf30d3250fa0c21d1ee49bb3d62104fa..57aba280dd0699b88033e1a8d01fccfd53ca58ba 100644 --- a/Framework/Algorithms/src/CreateSampleWorkspace.cpp +++ b/Framework/Algorithms/src/CreateSampleWorkspace.cpp @@ -71,18 +71,18 @@ void CreateSampleWorkspace::init() { //$PC0$ is the far left of the data, and $PC10$ is the far right, and // therefore will often not be used //$PC5$ is the centre of the data - m_preDefinedFunctionmap.insert(std::pair<std::string, std::string>( + m_preDefinedFunctionmap.emplace( "One Peak", "name=LinearBackground, A0=0.3; name=Gaussian, " - "PeakCentre=$PC5$, Height=10, Sigma=0.7;")); - m_preDefinedFunctionmap.insert(std::pair<std::string, std::string>( + "PeakCentre=$PC5$, Height=10, Sigma=0.7;"); + m_preDefinedFunctionmap.emplace( "Multiple Peaks", "name=LinearBackground, A0=0.3;name=Gaussian, " "PeakCentre=$PC3$, Height=10, Sigma=0.7;name=Gaussian, " - "PeakCentre=$PC6$, Height=8, Sigma=0.5")); - m_preDefinedFunctionmap.insert(std::pair<std::string, std::string>( - "Flat background", "name=LinearBackground, A0=1;")); - m_preDefinedFunctionmap.insert(std::pair<std::string, std::string>( - "Exp Decay", "name=ExpDecay, Height=100, Lifetime=1000;")); - m_preDefinedFunctionmap.insert(std::pair<std::string, std::string>( + "PeakCentre=$PC6$, Height=8, Sigma=0.5"); + m_preDefinedFunctionmap.emplace("Flat background", + "name=LinearBackground, A0=1;"); + m_preDefinedFunctionmap.emplace("Exp Decay", + "name=ExpDecay, Height=100, Lifetime=1000;"); + m_preDefinedFunctionmap.emplace( "Powder Diffraction", "name= LinearBackground,A0=0.0850208,A1=-4.89583e-06;" "name=Gaussian,Height=0.584528,PeakCentre=$PC1$,Sigma=14.3772;" @@ -93,22 +93,22 @@ void CreateSampleWorkspace::init() { "name=Gaussian,Height=3.64069,PeakCentre=$PC6$,Sigma=19.2404;" "name=Gaussian,Height=2.8998,PeakCentre=$PC7$,Sigma=21.1127;" "name=Gaussian,Height=2.05237,PeakCentre=$PC8$,Sigma=21.9932;" - "name=Gaussian,Height=8.40976,PeakCentre=$PC9$,Sigma=25.2751;")); - m_preDefinedFunctionmap.insert(std::pair<std::string, std::string>( + "name=Gaussian,Height=8.40976,PeakCentre=$PC9$,Sigma=25.2751;"); + m_preDefinedFunctionmap.emplace( "Quasielastic", "name=Lorentzian,FWHM=0.3,PeakCentre=$PC5$,Amplitude=0.8;" "name=Lorentzian,FWHM=0.1,PeakCentre=$PC5$,Amplitude=1;" - "name=LinearBackground,A0=0.1")); - m_preDefinedFunctionmap.insert(std::pair<std::string, std::string>( + "name=LinearBackground,A0=0.1"); + m_preDefinedFunctionmap.emplace( "Quasielastic Tunnelling", "name=LinearBackground,A0=0.1;" "name=Lorentzian,FWHM=0.1,PeakCentre=$PC5$,Amplitude=1;" "name=Lorentzian,FWHM=0.05,PeakCentre=$PC7$,Amplitude=0.04;" "name=Lorentzian,FWHM=0.05,PeakCentre=$PC3$,Amplitude=0.04;" "name=Lorentzian,FWHM=0.05,PeakCentre=$PC8$,Amplitude=0.02;" - "name=Lorentzian,FWHM=0.05,PeakCentre=$PC2$,Amplitude=0.02")); - m_preDefinedFunctionmap.insert( - std::pair<std::string, std::string>("User Defined", "")); + "name=Lorentzian,FWHM=0.05,PeakCentre=$PC2$,Amplitude=0.02"); + m_preDefinedFunctionmap.emplace("User Defined", ""); std::vector<std::string> functionOptions; + functionOptions.reserve(m_preDefinedFunctionmap.size()); for (auto iterator = m_preDefinedFunctionmap.begin(); iterator != m_preDefinedFunctionmap.end(); iterator++) { functionOptions.push_back(iterator->first); diff --git a/Framework/Algorithms/src/DetectorDiagnostic.cpp b/Framework/Algorithms/src/DetectorDiagnostic.cpp index 35dafe442d1123b564500d52c744a7b9fa1489de..ce72c899bdcf38f868a0b8492dd59bf1b4cbec05 100644 --- a/Framework/Algorithms/src/DetectorDiagnostic.cpp +++ b/Framework/Algorithms/src/DetectorDiagnostic.cpp @@ -572,8 +572,7 @@ DetectorDiagnostic::makeMap(API::MatrixWorkspace_sptr countsWS) { m_parents = 0; return makeInstrumentMap(countsWS); } - mymap.insert(std::pair<Mantid::Geometry::ComponentID, size_t>( - anc[m_parents - 1]->getComponentID(), i)); + mymap.emplace(anc[m_parents - 1]->getComponentID(), i); } std::vector<std::vector<size_t>> speclist; diff --git a/Framework/Algorithms/src/DetectorEfficiencyCor.cpp b/Framework/Algorithms/src/DetectorEfficiencyCor.cpp index 2cd1a198b892ca8c854f48593226f17e9d0d9f7a..e0e98dc7d3a7c5dc6b2e3fa77bd5c8e0478b8222 100644 --- a/Framework/Algorithms/src/DetectorEfficiencyCor.cpp +++ b/Framework/Algorithms/src/DetectorEfficiencyCor.cpp @@ -317,8 +317,8 @@ void DetectorEfficiencyCor::getDetectorGeometry( detAxis = V3D(0, 1, 0); // assume radi in z and x and the axis is in the y PARALLEL_CRITICAL(deteff_shapecachea) { - m_shapeCache.insert(std::pair<const Object *, std::pair<double, V3D>>( - shape_sptr.get(), std::pair<double, V3D>(detRadius, detAxis))); + m_shapeCache.emplace(shape_sptr.get(), + std::make_pair(detRadius, detAxis)); } return; } @@ -330,8 +330,8 @@ void DetectorEfficiencyCor::getDetectorGeometry( // assume that y and z are radi of the cylinder's circular cross-section // and the axis is perpendicular, in the x direction PARALLEL_CRITICAL(deteff_shapecacheb) { - m_shapeCache.insert(std::pair<const Object *, std::pair<double, V3D>>( - shape_sptr.get(), std::pair<double, V3D>(detRadius, detAxis))); + m_shapeCache.emplace(shape_sptr.get(), + std::make_pair(detRadius, detAxis)); } return; } @@ -340,8 +340,8 @@ void DetectorEfficiencyCor::getDetectorGeometry( detRadius = xDist / 2.0; detAxis = V3D(0, 0, 1); PARALLEL_CRITICAL(deteff_shapecachec) { - m_shapeCache.insert(std::pair<const Object *, std::pair<double, V3D>>( - shape_sptr.get(), std::pair<double, V3D>(detRadius, detAxis))); + m_shapeCache.emplace(shape_sptr.get(), + std::make_pair(detRadius, detAxis)); } return; } diff --git a/Framework/Algorithms/src/DiffractionFocussing.cpp b/Framework/Algorithms/src/DiffractionFocussing.cpp index c15108f3b89c4f2602b1e1dd134e0218393a1a82..1a342155ce1ac6401702c11d4caae0a6762e5dc9 100644 --- a/Framework/Algorithms/src/DiffractionFocussing.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing.cpp @@ -264,7 +264,7 @@ bool DiffractionFocussing::readGroupingFile( // if ( ! istr.good() ) return false; // only allow groups with +ve ids if ((sel) && (group > 0)) { - detectorGroups.insert(std::make_pair(group, udet)); + detectorGroups.emplace(group, udet); } } return true; diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp index 8ba970a8d09eaa3ebffccf424080182a2f72f1b9..d06198dab577561677444e25484843ec52ee1f10 100644 --- a/Framework/Algorithms/src/DiffractionFocussing2.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp @@ -605,9 +605,8 @@ void DiffractionFocussing2::determineRebinParameters() { // Create the group range in the map if it isn't already there if (gpit == group2minmax.end()) { - gpit = group2minmax.insert(std::make_pair( - group, std::make_pair( - BIGGEST, -1. * BIGGEST))).first; + gpit = group2minmax.emplace(group, std::make_pair(BIGGEST, -1. * BIGGEST)) + .first; } const double min = (gpit->second).first; const double max = (gpit->second).second; diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index a05080ed6eaae91badecd0fb5e7ea6c052a1b259..9a79de853dd96a256aa481f9a59e8aa940f9ff9d 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -742,7 +742,7 @@ void FilterEvents::setupCustomizedTOFCorrection() { row >> detid >> offset_factor; if (offset_factor >= 0 && offset_factor <= 1) { // Valid offset (factor value) - toffactormap.insert(make_pair(detid, offset_factor)); + toffactormap.emplace(detid, offset_factor); } else { // Error, throw! stringstream errss; @@ -756,7 +756,7 @@ void FilterEvents::setupCustomizedTOFCorrection() { if (hasshift) { double shift; row >> shift; - tofshiftmap.insert(make_pair(detid, shift)); + tofshiftmap.emplace(detid, shift); } } // ENDFOR(row i) diff --git a/Framework/Algorithms/src/FitPeak.cpp b/Framework/Algorithms/src/FitPeak.cpp index 0e7e377b2d57c7cf5d2852f57735753f7f869502..f6e8ad8be97f7b76a9db5f3bacde3fed725e37ee 100644 --- a/Framework/Algorithms/src/FitPeak.cpp +++ b/Framework/Algorithms/src/FitPeak.cpp @@ -592,7 +592,7 @@ void FitOneSinglePeak::push(IFunction_const_sptr func, size_t nParam = funcparnames.size(); for (size_t i = 0; i < nParam; ++i) { double parvalue = func->getParameter(i); - funcparammap.insert(make_pair(funcparnames[i], parvalue)); + funcparammap.emplace(funcparnames[i], parvalue); } return; @@ -615,7 +615,7 @@ void FitOneSinglePeak::storeFunctionError( size_t nParam = funcparnames.size(); for (size_t i = 0; i < nParam; ++i) { double parerror = func->getError(i); - paramerrormap.insert(make_pair(funcparnames[i], parerror)); + paramerrormap.emplace(funcparnames[i], parerror); } return; @@ -1630,10 +1630,10 @@ void FitPeak::push(IFunction_const_sptr func, size_t nParam = funcparnames.size(); for (size_t i = 0; i < nParam; ++i) { double parvalue = func->getParameter(i); - funcparammap.insert(make_pair(funcparnames[i], parvalue)); + funcparammap.emplace(funcparnames[i], parvalue); double parerror = func->getError(i); - paramerrormap.insert(make_pair(funcparnames[i], parerror)); + paramerrormap.emplace(funcparnames[i], parerror); } return; diff --git a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp index 8c078c51d93efaac0403abce51dd68ddfe6c1fac..54c74c1ab3754c8fb46055db139d69fb6af46861 100644 --- a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp +++ b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp @@ -164,7 +164,7 @@ void GetTimeSeriesLogInformation::exec() { */ void GetTimeSeriesLogInformation::processTimeRange() { // Orignal - m_intInfoMap.insert(make_pair("Items", m_log->size())); + m_intInfoMap.emplace("Items", m_log->size()); // Input time double t0r = this->getProperty("FilterStartTime"); @@ -454,10 +454,9 @@ void GetTimeSeriesLogInformation::checkLogBasicInforamtion() { size_t f = m_timeVec.size()-1; */ - m_intInfoMap.insert(make_pair("Number of Time Stamps", m_timeVec.size())); - m_intInfoMap.insert(make_pair("Number of Equal Time Stamps", countsame)); - m_intInfoMap.insert( - make_pair("Number of Reversed Time Stamps", countinverse)); + m_intInfoMap.emplace("Number of Time Stamps", m_timeVec.size()); + m_intInfoMap.emplace("Number of Equal Time Stamps", countsame); + m_intInfoMap.emplace("Number of Reversed Time Stamps", countinverse); // 2. Average and standard deviation (delta t) double runduration_sec = static_cast<double>(m_endtime.totalNanoseconds() - @@ -506,10 +505,10 @@ void GetTimeSeriesLogInformation::checkLogBasicInforamtion() { double std_dt = sqrt(sum_deltaT2 / static_cast<double>(numpts - 1) - avg_dt * avg_dt); - m_dblInfoMap.insert(make_pair("Average(dT)", avg_dt)); - m_dblInfoMap.insert(make_pair("Sigma(dt)", std_dt)); - m_dblInfoMap.insert(make_pair("Min(dT)", min_dt)); - m_dblInfoMap.insert(make_pair("Max(dT)", max_dt)); + m_dblInfoMap.emplace("Average(dT)", avg_dt); + m_dblInfoMap.emplace("Sigma(dt)", std_dt); + m_dblInfoMap.emplace("Min(dT)", min_dt); + m_dblInfoMap.emplace("Max(dT)", max_dt); // 3. Count number of time intervals beyond 10% of deviation /* Temporarily disabled diff --git a/Framework/Algorithms/src/IntegrateByComponent.cpp b/Framework/Algorithms/src/IntegrateByComponent.cpp index 104713732b2aefb44f91e81125f1483a752da01d..369e061bbb0a3cd79c4bcd797c9bee351f63dac4 100644 --- a/Framework/Algorithms/src/IntegrateByComponent.cpp +++ b/Framework/Algorithms/src/IntegrateByComponent.cpp @@ -214,8 +214,7 @@ IntegrateByComponent::makeMap(API::MatrixWorkspace_sptr countsWS, int parents) { parents = 0; return makeInstrumentMap(countsWS); } - mymap.insert(std::pair<Mantid::Geometry::ComponentID, size_t>( - anc[parents - 1]->getComponentID(), i)); + mymap.emplace(anc[parents - 1]->getComponentID(), i); } catch (Mantid::Kernel::Exception::NotFoundError &e) { // do nothing g_log.debug(e.what()); diff --git a/Framework/Algorithms/test/CheckWorkspacesMatchTest.h b/Framework/Algorithms/test/CheckWorkspacesMatchTest.h index 28fa4e4554cad68dc53953d40c6607a8a2752cde..bf9cab3942578c43cde87a85dab6a0754351bad5 100644 --- a/Framework/Algorithms/test/CheckWorkspacesMatchTest.h +++ b/Framework/Algorithms/test/CheckWorkspacesMatchTest.h @@ -938,8 +938,7 @@ public: zero->mutableRun().addProperty( new PropertyWithValue<double>("ExtraLog", 10)); - std::map<std::string, std::string> otherProps; - otherProps.insert(std::make_pair("CheckSample", "1")); + std::map<std::string, std::string> otherProps{{"CheckSample", "1"}}; doGroupTest( groupOneName, groupTwoName, diff --git a/Framework/Algorithms/test/CompareWorkspacesTest.h b/Framework/Algorithms/test/CompareWorkspacesTest.h index 3d21ac5d2931c3e4e57a7831a8385be8237fc464..c5bf8699fa3ecad5ee20d15231f70737e0e698f0 100644 --- a/Framework/Algorithms/test/CompareWorkspacesTest.h +++ b/Framework/Algorithms/test/CompareWorkspacesTest.h @@ -1008,7 +1008,7 @@ public: new PropertyWithValue<double>("ExtraLog", 10)); std::map<std::string, std::string> otherProps; - otherProps.insert(std::make_pair("CheckSample", "1")); + otherProps.emplace("CheckSample", "1"); doGroupTest(groupOneName, groupTwoName, "Different numbers of logs", otherProps); diff --git a/Framework/Algorithms/test/FindPeaksTest.h b/Framework/Algorithms/test/FindPeaksTest.h index 6aca47a444c9624945e1cad772f76e6964bcc212..b4aa14948cb674ca8e872eb59f3027ff426d9f75 100644 --- a/Framework/Algorithms/test/FindPeaksTest.h +++ b/Framework/Algorithms/test/FindPeaksTest.h @@ -199,7 +199,7 @@ public: string parname = vecnames[i]; if (parname != "spectrum") { double parvalue = tablews->cell<double>(rowindex, i); - parammap.insert(make_pair(parname, parvalue)); + parammap.emplace(parname, parvalue); cout << "Add parameter " << parname << " = " << parvalue << "\n"; } } diff --git a/Framework/Crystal/src/ClusterRegister.cpp b/Framework/Crystal/src/ClusterRegister.cpp index dd105e27c7d38975f5e93461d3612e5691fe0013..a94bc0b635078d16ccdbff8ef6140dc600055810 100644 --- a/Framework/Crystal/src/ClusterRegister.cpp +++ b/Framework/Crystal/src/ClusterRegister.cpp @@ -131,8 +131,8 @@ ClusterRegister::~ClusterRegister() {} */ void ClusterRegister::add(const size_t &label, const boost::shared_ptr<ICluster> &cluster) { - m_Impl->m_register.insert(std::make_pair(label, cluster)); - m_Impl->m_unique.insert(std::make_pair(label, cluster)); + m_Impl->m_register.emplace(label, cluster); + m_Impl->m_unique.emplace(label, cluster); } /** @@ -170,7 +170,7 @@ ClusterRegister::MapCluster ClusterRegister::clusters() const { auto mergedClusters = m_Impl->makeCompositeClusters(); for (auto i = mergedClusters.begin(); i != mergedClusters.end(); ++i) { const auto &merged = *i; - temp.insert(std::make_pair(merged->getLabel(), merged)); + temp.emplace(merged->getLabel(), merged); } return temp; } @@ -189,7 +189,7 @@ ClusterRegister::clusters(std::vector<DisjointElement> &elements) const { for (auto i = mergedClusters.begin(); i != mergedClusters.end(); ++i) { const auto &merged = *i; merged->toUniformMinimum(elements); - temp.insert(std::make_pair(merged->getLabel(), merged)); + temp.emplace(merged->getLabel(), merged); } return temp; } diff --git a/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp index 2586dd49c2a092a6643104f1118a88319c0d76e2..0e142a07109dc78ec29251accb0ea8a10566577c 100644 --- a/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp @@ -458,13 +458,13 @@ void CalculateGammaBackground::retrieveInputs() { std::vector<int> requestedIndices = getProperty("WorkspaceIndexList"); if (requestedIndices.empty()) { for (size_t i = 0; i < m_inputWS->getNumberHistograms(); ++i) { - m_indices.insert(std::make_pair(i, i)); // 1-to-1 + m_indices.emplace(i, i); // 1-to-1 } } else { for (size_t i = 0; i < requestedIndices.size(); ++i) { - m_indices.insert(std::make_pair( + m_indices.emplace( i, static_cast<size_t>( - requestedIndices[i]))); // user-requested->increasing on output + requestedIndices[i])); // user-requested->increasing on output } } diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index ad467ccb52f529c4b0fe04a3111b44b4ea95415c..638606c948389a5023e9014fe4f4e6a59fa095ac 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -1048,8 +1048,8 @@ bool FitPowderDiffPeaks::fitSinglePeakSimulatedAnnealing( // i. Store parameters; map<string,double> parammap; for (size_t i = 0; i < peakparnames.size(); ++i) - parammap.insert(make_pair(peakparnames[i], - peak->getParameter(peakparnames[i]))); + parammap.emplace(peakparnames[i], + peak->getParameter(peakparnames[i])); fitparammaps.push_back(make_pair(newchi2, parammap)); // ii. sort @@ -2383,11 +2383,11 @@ void FitPowderDiffPeaks::parseBraggPeakTable( if (coltype.compare("int") == 0) { // Integer int temp = peakws->cell<int>(irow, icol); - intmap.insert(make_pair(colname, temp)); + intmap.emplace(colname, temp); } else if (coltype.compare("double") == 0) { // Double double temp = peakws->cell<double>(irow, icol); - doublemap.insert(make_pair(colname, temp)); + doublemap.emplace(colname, temp); } } // ENDFOR Column @@ -2693,13 +2693,9 @@ void FitPowderDiffPeaks::genPeaksFromTable(TableWorkspace_sptr peakparamws) { // Create a map to convert the Bragg peak Table paramter name to Back to back // exponential+pseudo-voigt - map<string, string> bk2bk2braggmap; - bk2bk2braggmap.insert(make_pair("A", "Alpha")); - bk2bk2braggmap.insert(make_pair("B", "Beta")); - bk2bk2braggmap.insert(make_pair("X0", "TOF_h")); - bk2bk2braggmap.insert(make_pair("I", "Height")); - bk2bk2braggmap.insert(make_pair("S", "Sigma")); - bk2bk2braggmap.insert(make_pair("S2", "Sigma2")); + map<string, string> bk2bk2braggmap{{"A", "Alpha"}, {"B", "Beta"}, + {"X0", "TOF_h"}, {"I", "Height"}, + {"S", "Sigma"}, {"S2", "Sigma2"}}; // Generate Peaks size_t numbadrows = 0; diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 91212a986eaf449bda0939a2c4f71dde3be92ace..5be45298bda89d3139e5ff99f755d22dccf4cb22 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -1815,9 +1815,7 @@ void LeBailFit::setupRandomWalkStrategyFromTable( giter->second.push_back(parname); } else { // First instance in the new group. - vector<string> newpars; - newpars.push_back(parname); - m_MCGroups.insert(make_pair(group, newpars)); + m_MCGroups.emplace(group, vector<string>{parname}); } // 3. Set up MC parameters, A0, A1, non-negative @@ -1865,7 +1863,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() { addParameterToMCMinimize(geomparams, "Zerot"); addParameterToMCMinimize(geomparams, "Width"); addParameterToMCMinimize(geomparams, "Tcross"); - m_MCGroups.insert(make_pair(0, geomparams)); + m_MCGroups.emplace(0, geomparams); dboutss << "Geometry parameters: "; for (size_t i = 0; i < geomparams.size(); ++i) @@ -1878,7 +1876,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() { addParameterToMCMinimize(alphs, "Alph1"); addParameterToMCMinimize(alphs, "Alph0t"); addParameterToMCMinimize(alphs, "Alph1t"); - m_MCGroups.insert(make_pair(1, alphs)); + m_MCGroups.emplace(1, alphs); dboutss << "Alpha parameters"; for (size_t i = 0; i < alphs.size(); ++i) @@ -1891,7 +1889,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() { addParameterToMCMinimize(betas, "Beta1"); addParameterToMCMinimize(betas, "Beta0t"); addParameterToMCMinimize(betas, "Beta1t"); - m_MCGroups.insert(make_pair(2, betas)); + m_MCGroups.emplace(2, betas); dboutss << "Beta parameters"; for (size_t i = 0; i < betas.size(); ++i) @@ -1903,7 +1901,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() { addParameterToMCMinimize(sigs, "Sig0"); addParameterToMCMinimize(sigs, "Sig1"); addParameterToMCMinimize(sigs, "Sig2"); - m_MCGroups.insert(make_pair(3, sigs)); + m_MCGroups.emplace(3, sigs); dboutss << "Sig parameters"; for (size_t i = 0; i < sigs.size(); ++i) diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp index 117213f9dee96aad191768b1501ab7eb214f63b3..5bfcc1c65e6d14fd7ac8dc836cc7d9b15ab1aa6d 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp @@ -69,7 +69,7 @@ LeBailFunction::LeBailFunction(std::string peaktype) { // Peak parameter values for (size_t i = 0; i < m_peakParameterNameVec.size(); ++i) { string parname = m_peakParameterNameVec[i]; - m_functionParameters.insert(make_pair(parname, 0.0)); + m_functionParameters.emplace(parname, 0.0); } // Importing peak position tolerance @@ -296,7 +296,7 @@ void LeBailFunction::addPeaks(std::vector<std::vector<int>> peakhkls) { m_vecPeaks.push_back(newpeak); // FIXME - Refining lattice size is not considered here! m_dspPeakVec.push_back(make_pair(dsp, newpeak)); - m_mapHKLPeak.insert(make_pair(hkl, newpeak)); + m_mapHKLPeak.emplace(hkl, newpeak); } } diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index 80d4fdec61c340ed49b564399931f1824e76dc26..168180b854a1cff1004c3d49750c4dfbe4c3a70b 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -943,9 +943,9 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( hkl.push_back(k); hkl.push_back(l); - m_Peaks.insert(std::make_pair(hkl, newpeakptr)); + m_Peaks.emplace(hkl, newpeakptr); - m_PeakErrors.insert(make_pair(hkl, chi2)); + m_PeakErrors.emplace(hkl, chi2); g_log.information() << "[Generatem_Peaks] Peak " << ir << " HKL = [" << hkl[0] << ", " << hkl[1] << ", " << hkl[2] @@ -1073,7 +1073,7 @@ void RefinePowderInstrumentParameters::importMonteCarloParametersFromTable( tmpvec.push_back(tmin); tmpvec.push_back(tmax); tmpvec.push_back(tstepsize); - mcparameters.insert(make_pair(parname, tmpvec)); + mcparameters.emplace(parname, tmpvec); } // 3. Retrieve the information for geometry parameters diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index 42c6259065eddf7d814a3e184632e6f470ab60f6..ad8b03a8c3c5b8b1206d35e2a88f5044fa433596 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -592,7 +592,7 @@ void ProcessBackground::selectFromGivenFunction() { double parvalue; row >> parname >> parvalue; if (parname[0] == 'A') - parmap.insert(make_pair(parname, parvalue)); + parmap.emplace(parname, parvalue); } int bkgdorder = diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h index 363ef9c91010ca6812518c889f784cbca4f3f335..9939e449cfcb0a877d4294f257a85136a2461ae9 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h @@ -349,18 +349,18 @@ public: // Profile parameter std::map<std::string, double> parammodifymap; if (testplan.compare("zero") == 0) { - parammodifymap.insert(std::make_pair("Zero", 2.0)); + parammodifymap.emplace("Zero", 2.0); } else if (testplan.compare("alpha") == 0) { double alph0 = 4.026; double newalph0 = alph0 * 0.05; - parammodifymap.insert(std::make_pair("Alph0", newalph0)); + parammodifymap.emplace("Alph0", newalph0); } else if (testplan.compare("sigma") == 0) { double sig1 = 9.901; double newsig1 = sig1 * 0.1; double sig0 = 127.37; double newsig0 = sig0 * 0.1; - parammodifymap.insert(std::make_pair("Sig0", newsig0)); - parammodifymap.insert(std::make_pair("Sig1", newsig1)); + parammodifymap.emplace("Sig0", newsig0); + parammodifymap.emplace("Sig1", newsig1); } parameterws = createPeakParameterWorkspace(parammodifymap, 1); // c) Reflection (111) and (110) @@ -507,8 +507,8 @@ public: // c) Generate TableWorkspaces std::vector<double> pkheights(numpeaks, 1.0); map<string, double> modmap; - modmap.insert(make_pair("Alph0", 5.0)); - modmap.insert(make_pair("Beta0", 5.0)); + modmap.emplace("Alph0", 5.0); + modmap.emplace("Beta0", 5.0); parameterws = createPeakParameterWorkspace(modmap, 2); hklws = createInputHKLWorkspace(hkls, pkheights); bkgdws = createBackgroundParameterWorksapce(1); @@ -759,7 +759,7 @@ public: std::map<std::string, double>::iterator mit; for (mit = paramvaluemap.begin(); mit != paramvaluemap.end(); ++mit) { std::string parname = mit->first; - paramfitmap.insert(std::make_pair(parname, "t")); + paramfitmap.emplace(parname, "t"); } std::cout << "Parameter Fit Map Size = " << paramfitmap.size() << std::endl; @@ -816,30 +816,29 @@ public: void genPeakParametersBackgroundLessData( std::map<std::string, double> ¶mvaluemap) { // a) Value - paramvaluemap.insert(std::make_pair("Dtt1", 29671.7500)); - paramvaluemap.insert(std::make_pair("Dtt2", 0.0)); - paramvaluemap.insert(std::make_pair("Dtt1t", 29671.750)); - paramvaluemap.insert(std::make_pair("Dtt2t", 0.30)); - paramvaluemap.insert(std::make_pair("Zero", 0.0)); - paramvaluemap.insert(std::make_pair("Zerot", 33.70)); - paramvaluemap.insert(std::make_pair("Alph0", 4.026)); - paramvaluemap.insert(std::make_pair("Alph1", 7.362)); - paramvaluemap.insert(std::make_pair("Beta0", 3.489)); - paramvaluemap.insert(std::make_pair("Beta1", 19.535)); - paramvaluemap.insert(std::make_pair("Alph0t", 60.683)); - paramvaluemap.insert(std::make_pair("Alph1t", 39.730)); - paramvaluemap.insert(std::make_pair("Beta0t", 96.864)); - paramvaluemap.insert(std::make_pair("Beta1t", 96.864)); - paramvaluemap.insert(std::make_pair("Sig2", sqrt(11.380))); - paramvaluemap.insert(std::make_pair("Sig1", sqrt(9.901))); - paramvaluemap.insert(std::make_pair("Sig0", sqrt(17.370))); - paramvaluemap.insert(std::make_pair("Width", 1.0055)); - paramvaluemap.insert(std::make_pair("Tcross", 0.4700)); - paramvaluemap.insert(std::make_pair("Gam0", 0.0)); - paramvaluemap.insert(std::make_pair("Gam1", 0.0)); - paramvaluemap.insert(std::make_pair("Gam2", 0.0)); - paramvaluemap.insert(std::make_pair("LatticeConstant", 4.156890)); - + paramvaluemap.emplace("Dtt1", 29671.7500); + paramvaluemap.emplace("Dtt2", 0.0); + paramvaluemap.emplace("Dtt1t", 29671.750); + paramvaluemap.emplace("Dtt2t", 0.30); + paramvaluemap.emplace("Zero", 0.0); + paramvaluemap.emplace("Zerot", 33.70); + paramvaluemap.emplace("Alph0", 4.026); + paramvaluemap.emplace("Alph1", 7.362); + paramvaluemap.emplace("Beta0", 3.489); + paramvaluemap.emplace("Beta1", 19.535); + paramvaluemap.emplace("Alph0t", 60.683); + paramvaluemap.emplace("Alph1t", 39.730); + paramvaluemap.emplace("Beta0t", 96.864); + paramvaluemap.emplace("Beta1t", 96.864); + paramvaluemap.emplace("Sig2", sqrt(11.380)); + paramvaluemap.emplace("Sig1", sqrt(9.901)); + paramvaluemap.emplace("Sig0", sqrt(17.370)); + paramvaluemap.emplace("Width", 1.0055); + paramvaluemap.emplace("Tcross", 0.4700); + paramvaluemap.emplace("Gam0", 0.0); + paramvaluemap.emplace("Gam1", 0.0); + paramvaluemap.emplace("Gam2", 0.0); + paramvaluemap.emplace("LatticeConstant", 4.156890); return; } @@ -849,35 +848,35 @@ public: void genPeakParameterBank7(std::map<std::string, double> ¶mvaluemap) { paramvaluemap.clear(); - paramvaluemap.insert(std::make_pair("Alph0", 0.5)); - paramvaluemap.insert(std::make_pair("Alph0t", 128.96)); - paramvaluemap.insert(std::make_pair("Alph1", 0.)); - paramvaluemap.insert(std::make_pair("Alph1t", 15.702)); - paramvaluemap.insert(std::make_pair("Beta0", 2.0)); - paramvaluemap.insert(std::make_pair("Beta0t", 202.28)); - paramvaluemap.insert(std::make_pair("Beta1", 0.)); - paramvaluemap.insert(std::make_pair("Beta1t", 0.)); - paramvaluemap.insert(std::make_pair("CWL", 4.797)); - paramvaluemap.insert(std::make_pair("Dtt1", 22777.1)); - paramvaluemap.insert(std::make_pair("Dtt1t", 22785.4)); - paramvaluemap.insert(std::make_pair("Dtt2", 0.0)); - paramvaluemap.insert(std::make_pair("Dtt2t", 0.3)); - paramvaluemap.insert(std::make_pair("Gam0", 0)); - paramvaluemap.insert(std::make_pair("Gam1", 0)); - paramvaluemap.insert(std::make_pair("Gam2", 0)); - paramvaluemap.insert(std::make_pair("Profile", 10)); - paramvaluemap.insert(std::make_pair("Sig0", 0)); - paramvaluemap.insert(std::make_pair("Sig1", sqrt(10.0))); - paramvaluemap.insert(std::make_pair("Sig2", sqrt(15.48))); - paramvaluemap.insert(std::make_pair("Tcross", 0.25)); - paramvaluemap.insert(std::make_pair("Width", 5.8675)); - paramvaluemap.insert(std::make_pair("Zero", 0)); - paramvaluemap.insert(std::make_pair("Zerot", 62.5)); - paramvaluemap.insert(std::make_pair("step", 0.005)); - paramvaluemap.insert(std::make_pair("tof-max", 233.8)); - paramvaluemap.insert(std::make_pair("tof-min", 50.2919)); - paramvaluemap.insert(std::make_pair("twotheta", 90.807)); - paramvaluemap.insert(std::make_pair("LatticeConstant", 9.438)); + paramvaluemap.emplace("Alph0", 0.5); + paramvaluemap.emplace("Alph0t", 128.96); + paramvaluemap.emplace("Alph1", 0.); + paramvaluemap.emplace("Alph1t", 15.702); + paramvaluemap.emplace("Beta0", 2.0); + paramvaluemap.emplace("Beta0t", 202.28); + paramvaluemap.emplace("Beta1", 0.); + paramvaluemap.emplace("Beta1t", 0.); + paramvaluemap.emplace("CWL", 4.797); + paramvaluemap.emplace("Dtt1", 22777.1); + paramvaluemap.emplace("Dtt1t", 22785.4); + paramvaluemap.emplace("Dtt2", 0.0); + paramvaluemap.emplace("Dtt2t", 0.3); + paramvaluemap.emplace("Gam0", 0); + paramvaluemap.emplace("Gam1", 0); + paramvaluemap.emplace("Gam2", 0); + paramvaluemap.emplace("Profile", 10); + paramvaluemap.emplace("Sig0", 0); + paramvaluemap.emplace("Sig1", sqrt(10.0)); + paramvaluemap.emplace("Sig2", sqrt(15.48)); + paramvaluemap.emplace("Tcross", 0.25); + paramvaluemap.emplace("Width", 5.8675); + paramvaluemap.emplace("Zero", 0); + paramvaluemap.emplace("Zerot", 62.5); + paramvaluemap.emplace("step", 0.005); + paramvaluemap.emplace("tof-max", 233.8); + paramvaluemap.emplace("tof-min", 50.2919); + paramvaluemap.emplace("twotheta", 90.807); + paramvaluemap.emplace("LatticeConstant", 9.438); return; } @@ -888,29 +887,29 @@ public: void genPeakParameterNomBank4(map<std::string, double> ¶mvaluemap) { paramvaluemap.clear(); - paramvaluemap.insert(make_pair("Alph0", 0.886733)); - paramvaluemap.insert(make_pair("Alph0t", 114.12)); - paramvaluemap.insert(make_pair("Alph1", 8.38073)); - paramvaluemap.insert(make_pair("Alph1t", 75.8038)); - paramvaluemap.insert(make_pair("Beta0", 3.34888)); - paramvaluemap.insert(make_pair("Beta0t", 88.292)); - paramvaluemap.insert(make_pair("Beta1", 10.5768)); - paramvaluemap.insert(make_pair("Beta1t", -0.0346847)); - paramvaluemap.insert(make_pair("Dtt1", 9491.56)); - paramvaluemap.insert(make_pair("Dtt1t", 9423.85)); - paramvaluemap.insert(make_pair("Dtt2", 0)); - paramvaluemap.insert(make_pair("Dtt2t", 0.3)); - paramvaluemap.insert(make_pair("Gam0", 0)); - paramvaluemap.insert(make_pair("Gam1", 0)); - paramvaluemap.insert(make_pair("Gam2", 0)); - paramvaluemap.insert(make_pair("LatticeConstant", 4.15689)); - paramvaluemap.insert(make_pair("Sig0", 0)); - paramvaluemap.insert(make_pair("Sig1", 18.3863)); - paramvaluemap.insert(make_pair("Sig2", 0.671019)); - paramvaluemap.insert(make_pair("Tcross", 0.4373)); - paramvaluemap.insert(make_pair("Width", 2.9654)); - paramvaluemap.insert(make_pair("Zero", 0)); - paramvaluemap.insert(make_pair("Zerot", 101.618)); + paramvaluemap.emplace("Alph0", 0.886733); + paramvaluemap.emplace("Alph0t", 114.12); + paramvaluemap.emplace("Alph1", 8.38073); + paramvaluemap.emplace("Alph1t", 75.8038); + paramvaluemap.emplace("Beta0", 3.34888); + paramvaluemap.emplace("Beta0t", 88.292); + paramvaluemap.emplace("Beta1", 10.5768); + paramvaluemap.emplace("Beta1t", -0.0346847); + paramvaluemap.emplace("Dtt1", 9491.56); + paramvaluemap.emplace("Dtt1t", 9423.85); + paramvaluemap.emplace("Dtt2", 0); + paramvaluemap.emplace("Dtt2t", 0.3); + paramvaluemap.emplace("Gam0", 0); + paramvaluemap.emplace("Gam1", 0); + paramvaluemap.emplace("Gam2", 0); + paramvaluemap.emplace("LatticeConstant", 4.15689); + paramvaluemap.emplace("Sig0", 0); + paramvaluemap.emplace("Sig1", 18.3863); + paramvaluemap.emplace("Sig2", 0.671019); + paramvaluemap.emplace("Tcross", 0.4373); + paramvaluemap.emplace("Width", 2.9654); + paramvaluemap.emplace("Zero", 0); + paramvaluemap.emplace("Zerot", 101.618); return; } @@ -920,24 +919,24 @@ public: * example) */ void generateGPPDBank1(map<std::string, double> ¶mmap) { - parammap.insert(make_pair("Dtt1", 16370.650)); - parammap.insert(make_pair("Dtt2", 0.10)); - parammap.insert(make_pair("Zero", 0.0)); + parammap.emplace("Dtt1", 16370.650); + parammap.emplace("Dtt2", 0.10); + parammap.emplace("Zero", 0.0); - parammap.insert(make_pair("Alph0", 1.0)); - parammap.insert(make_pair("Alph1", 0.0)); - parammap.insert(make_pair("Beta0", 0.109036)); - parammap.insert(make_pair("Beta1", 0.009834)); + parammap.emplace("Alph0", 1.0); + parammap.emplace("Alph1", 0.0); + parammap.emplace("Beta0", 0.109036); + parammap.emplace("Beta1", 0.009834); - parammap.insert(make_pair("Sig2", sqrt(91.127))); - parammap.insert(make_pair("Sig1", sqrt(1119.230))); - parammap.insert(make_pair("Sig0", sqrt(0.0))); + parammap.emplace("Sig2", sqrt(91.127)); + parammap.emplace("Sig1", sqrt(1119.230)); + parammap.emplace("Sig0", sqrt(0.0)); - parammap.insert(make_pair("Gam0", 0.0)); - parammap.insert(make_pair("Gam1", 7.688)); - parammap.insert(make_pair("Gam2", 0.0)); + parammap.emplace("Gam0", 0.0); + parammap.emplace("Gam1", 7.688); + parammap.emplace("Gam2", 0.0); - parammap.insert(make_pair("LatticeConstant", 5.431363)); + parammap.emplace("LatticeConstant", 5.431363); return; } @@ -1826,8 +1825,8 @@ public: << " has am empty field for fit/tie. " << std::endl; } - paramvalues.insert(std::make_pair(parname, parvalue)); - paramfitstatus.insert(std::make_pair(parname, fitortie)); + paramvalues.emplace(parname, parvalue); + paramfitstatus.emplace(parname, fitortie); } return; @@ -1843,29 +1842,29 @@ public: map<string, double> bkgdparmap; switch (option) { case 1: - bkgdparmap.insert(make_pair("A0", -197456)); - bkgdparmap.insert(make_pair("A1", 15.5819)); - bkgdparmap.insert(make_pair("A2", -0.000467362)); - bkgdparmap.insert(make_pair("A3", 5.59069e-09)); - bkgdparmap.insert(make_pair("A4", 2.81875e-14)); - bkgdparmap.insert(make_pair("A5", -1.88986e-18)); - bkgdparmap.insert(make_pair("A6", 2.9137e-23)); - bkgdparmap.insert(make_pair("A7", -2.50121e-28)); - bkgdparmap.insert(make_pair("A8", 1.3279e-33)); - bkgdparmap.insert(make_pair("A9", -4.33776e-39)); - bkgdparmap.insert(make_pair("A10", 8.01018e-45)); - bkgdparmap.insert(make_pair("A11", -6.40846e-51)); + bkgdparmap.emplace("A0", -197456); + bkgdparmap.emplace("A1", 15.5819); + bkgdparmap.emplace("A2", -0.000467362); + bkgdparmap.emplace("A3", 5.59069e-09); + bkgdparmap.emplace("A4", 2.81875e-14); + bkgdparmap.emplace("A5", -1.88986e-18); + bkgdparmap.emplace("A6", 2.9137e-23); + bkgdparmap.emplace("A7", -2.50121e-28); + bkgdparmap.emplace("A8", 1.3279e-33); + bkgdparmap.emplace("A9", -4.33776e-39); + bkgdparmap.emplace("A10", 8.01018e-45); + bkgdparmap.emplace("A11", -6.40846e-51); break; case 2: // NOMAD Bank4 - bkgdparmap.insert(make_pair("A0", 0.73)); - bkgdparmap.insert(make_pair("A1", -8.0E-5)); - bkgdparmap.insert(make_pair("A2", 0.0)); - bkgdparmap.insert(make_pair("A3", 0.0)); - bkgdparmap.insert(make_pair("A4", 0.0)); - bkgdparmap.insert(make_pair("A5", 0.0)); + bkgdparmap.emplace("A0", 0.73); + bkgdparmap.emplace("A1", -8.0E-5); + bkgdparmap.emplace("A2", 0.0); + bkgdparmap.emplace("A3", 0.0); + bkgdparmap.emplace("A4", 0.0); + bkgdparmap.emplace("A5", 0.0); break; diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h index 3c0fbdc897d010019117c62fe14533fb34c997a9..c31641d8af5508d73e2b85f2b6ddbc5bdae7938a 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h @@ -43,26 +43,24 @@ public: LeBailFunction lebailfunction("NeutronBk2BkExpConvPVoigt"); // Add peak parameters - map<string, double> parammap; - - parammap.insert(make_pair("Dtt1", 29671.7500)); - parammap.insert(make_pair("Dtt2", 0.0)); - parammap.insert(make_pair("Zero", 0.0)); + map<string, double> parammap{{"Dtt1", 29671.7500}, + {"Dtt2", 0.0}, + {"Zero", 0.0}, - parammap.insert(make_pair("Alph0", 4.026)); - parammap.insert(make_pair("Alph1", 7.362)); - parammap.insert(make_pair("Beta0", 3.489)); - parammap.insert(make_pair("Beta1", 19.535)); + {"Alph0", 4.026}, + {"Alph1", 7.362}, + {"Beta0", 3.489}, + {"Beta1", 19.535}, - parammap.insert(make_pair("Sig2", sqrt(11.380))); - parammap.insert(make_pair("Sig1", sqrt(9.901))); - parammap.insert(make_pair("Sig0", sqrt(17.370))); + {"Sig2", sqrt(11.380)}, + {"Sig1", sqrt(9.901)}, + {"Sig0", sqrt(17.370)}, - parammap.insert(make_pair("Gam0", 0.0)); - parammap.insert(make_pair("Gam1", 0.0)); - parammap.insert(make_pair("Gam2", 0.0)); + {"Gam0", 0.0}, + {"Gam1", 0.0}, + {"Gam2", 0.0}, - parammap.insert(make_pair("LatticeConstant", 4.156890)); + {"LatticeConstant", 4.156890}}; lebailfunction.setProfileParameterValues(parammap); @@ -115,38 +113,38 @@ public: LeBailFunction lebailfunction("ThermalNeutronBk2BkExpConvPVoigt"); // Add peak parameters - map<string, double> parammap; + map<string, double> parammap - parammap.insert(make_pair("Dtt1", 29671.7500)); - parammap.insert(make_pair("Dtt2", 0.0)); - parammap.insert(make_pair("Dtt1t", 29671.750)); - parammap.insert(make_pair("Dtt2t", 0.30)); + {{"Dtt1", 29671.7500}, + {"Dtt2", 0.0}, + {"Dtt1t", 29671.750}, + {"Dtt2t", 0.30}, - parammap.insert(make_pair("Zero", 0.0)); - parammap.insert(make_pair("Zerot", 33.70)); + {"Zero", 0.0}, + {"Zerot", 33.70}, - parammap.insert(make_pair("Alph0", 4.026)); - parammap.insert(make_pair("Alph1", 7.362)); - parammap.insert(make_pair("Beta0", 3.489)); - parammap.insert(make_pair("Beta1", 19.535)); + {"Alph0", 4.026}, + {"Alph1", 7.362}, + {"Beta0", 3.489}, + {"Beta1", 19.535}, - parammap.insert(make_pair("Alph0t", 60.683)); - parammap.insert(make_pair("Alph1t", 39.730)); - parammap.insert(make_pair("Beta0t", 96.864)); - parammap.insert(make_pair("Beta1t", 96.864)); + {"Alph0t", 60.683}, + {"Alph1t", 39.730}, + {"Beta0t", 96.864}, + {"Beta1t", 96.864}, - parammap.insert(make_pair("Sig2", sqrt(11.380))); - parammap.insert(make_pair("Sig1", sqrt(9.901))); - parammap.insert(make_pair("Sig0", sqrt(17.370))); + {"Sig2", sqrt(11.380)}, + {"Sig1", sqrt(9.901)}, + {"Sig0", sqrt(17.370)}, - parammap.insert(make_pair("Width", 1.0055)); - parammap.insert(make_pair("Tcross", 0.4700)); + {"Width", 1.0055}, + {"Tcross", 0.4700}, - parammap.insert(make_pair("Gam0", 0.0)); - parammap.insert(make_pair("Gam1", 0.0)); - parammap.insert(make_pair("Gam2", 0.0)); + {"Gam0", 0.0}, + {"Gam1", 0.0}, + {"Gam2", 0.0}, - parammap.insert(make_pair("LatticeConstant", 4.156890)); + {"LatticeConstant", 4.156890}}; lebailfunction.setProfileParameterValues(parammap); diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index fccdacb20db30175b3a3fa7c457b9ca9d9cbff43..4172459e6d484eae9a7b49a43f2845746bd97881 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -481,7 +481,7 @@ public: mcpars.push_back(parmin); mcpars.push_back(parmax); mcpars.push_back(parstepsize); - parametermcs.insert(make_pair(parname, mcpars)); + parametermcs.emplace(parname, mcpars); } catch (runtime_error err) { ; } diff --git a/Framework/DataHandling/src/CheckMantidVersion.cpp b/Framework/DataHandling/src/CheckMantidVersion.cpp index c64067efecffda8d31339cdcc36af2b7b1c24045..00efba2f97c49377d6c1d888e092a71b9154e729 100644 --- a/Framework/DataHandling/src/CheckMantidVersion.cpp +++ b/Framework/DataHandling/src/CheckMantidVersion.cpp @@ -240,11 +240,11 @@ std::string CheckMantidVersion::getVersionsFromGitHub(const std::string &url) { std::ostringstream os; int tzd = 0; - inetHelper.headers().insert(std::make_pair( + inetHelper.headers().emplace( "if-modified-since", Poco::DateTimeFormatter::format( Poco::DateTimeParser::parse(MantidVersion::releaseDate(), tzd), - Poco::DateTimeFormat::HTTP_FORMAT))); + Poco::DateTimeFormat::HTTP_FORMAT)); inetHelper.sendRequest(url, os); std::string retVal = os.str(); diff --git a/Framework/DataHandling/src/CreateSimulationWorkspace.cpp b/Framework/DataHandling/src/CreateSimulationWorkspace.cpp index e5a056ecfb74e8cb482247a917dca511f2efe6e4..686bcf0a35f10f0ad4f8eb8eb9f6c21991103a48 100644 --- a/Framework/DataHandling/src/CreateSimulationWorkspace.cpp +++ b/Framework/DataHandling/src/CreateSimulationWorkspace.cpp @@ -179,7 +179,7 @@ void CreateSimulationWorkspace::createOneToOneMapping() { for (size_t i = 0; i < nhist; ++i) { std::set<detid_t> group; group.insert(detids[i]); - m_detGroups.insert(std::make_pair(static_cast<specid_t>(i + 1), group)); + m_detGroups.emplace(static_cast<specid_t>(i + 1), group); } } @@ -274,7 +274,7 @@ void CreateSimulationWorkspace::createGroupingsFromTables(int *specTable, } else { std::set<detid_t> group; group.insert(static_cast<detid_t>(detID)); - m_detGroups.insert(std::make_pair(specNo, group)); + m_detGroups.emplace(specNo, group); } } } diff --git a/Framework/DataHandling/src/DownloadInstrument.cpp b/Framework/DataHandling/src/DownloadInstrument.cpp index 2f4aeac32400ec32999b5667d807ba701fa22862..03b8b68393c6c98274b6717e831101bbbc02df39 100644 --- a/Framework/DataHandling/src/DownloadInstrument.cpp +++ b/Framework/DataHandling/src/DownloadInstrument.cpp @@ -198,14 +198,14 @@ DownloadInstrument::StringToStringMap DownloadInstrument::processRepository() { // this will also catch when file is only present on github (as local sha // will be "") if ((sha != installSha) && (sha != localSha)) { - fileMap.insert(std::make_pair( - htmlUrl, filePath.toString())); // ACTION - DOWNLOAD to localPath + fileMap.emplace(htmlUrl, + filePath.toString()); // ACTION - DOWNLOAD to localPath } else if ((localSha != "") && (sha == installSha) && (sha != localSha)) // matches install, but different local { - fileMap.insert(std::make_pair( + fileMap.emplace( htmlUrl, - filePath.toString())); // ACTION - DOWNLOAD to localPath and overwrite + filePath.toString()); // ACTION - DOWNLOAD to localPath and overwrite } } @@ -246,7 +246,7 @@ DownloadInstrument::getFileShas(const std::string &directoryPath) { continue; std::string sha1 = ChecksumHelper::gitSha1FromFile(entryPath.toString()); // Track sha1 - filesToSha.insert(std::make_pair(entryPath.getFileName(), sha1)); + filesToSha.emplace(entryPath.getFileName(), sha1); } } catch (Poco::Exception &ex) { g_log.error() << "DownloadInstrument: failed to parse the directory: " diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index 17036af19f5f7ca3f10cdfe83e267eabbca40fc7..f305c440ba7e0495d99064aefc2737c31b089a8c 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -787,11 +787,11 @@ void LoadFullprofResolution::createBankToWorkspaceMap( std::map<int, size_t> &workspaceOfBank) { if (workspaces.size() == 0) { for (size_t i = 0; i < banks.size(); i++) { - workspaceOfBank.insert(std::pair<int, size_t>(banks[i], i + 1)); + workspaceOfBank.emplace(banks[i], i + 1); } } else { for (size_t i = 0; i < banks.size(); i++) { - workspaceOfBank.insert(std::pair<int, size_t>(banks[i], workspaces[i])); + workspaceOfBank.emplace(banks[i], workspaces[i]); } } } diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp index bb965c9f9976c887b7a784d5affd6181eaa5aa4e..705418ecea44fae2e294e5ee5099540ef98d7e94 100644 --- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp @@ -151,7 +151,7 @@ void LoadGSASInstrumentFile::exec() { << ".\n"; map<string, double> parammap; parseBank(parammap, lines, bankid, bankStartIndex[bankid - 1]); - bankparammap.insert(make_pair(bankid, parammap)); + bankparammap.emplace(bankid, parammap); g_log.debug() << "Bank starts at line" << bankStartIndex[i] + 1 << "\n"; } diff --git a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp index 78cb9fc24ebc4f81c9fe38aed9a3fa0b3908e96c..59957a2545fbb7cab94f0865a8cd4a3889b07902 100644 --- a/Framework/DataHandling/src/SaveDetectorsGrouping.cpp +++ b/Framework/DataHandling/src/SaveDetectorsGrouping.cpp @@ -94,8 +94,6 @@ void SaveDetectorsGrouping::createGroupDetectorIDMap( auto it = groupwkspmap.find(groupid); if (it == groupwkspmap.end()) { std::vector<detid_t> tempvector; - // groupwkspmap.insert(std::pair<int, std::vector<detid_t> >(groupid, - // tempvector)); groupwkspmap[groupid] = tempvector; } it = groupwkspmap.find(groupid); diff --git a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp index 715469f866b1fd064860462559e12c1dd1c25d67..cce56aabd97a89f676f6aa1c08b3ad715daadaca 100644 --- a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp @@ -70,7 +70,7 @@ typedef boost::shared_ptr<ChopperConfiguration> ChopperConfiguration_sptr; */ ChopperConfiguration::ChopperConfiguration(vector<int> bankids) : m_frequency(0) { - size_t numbanks = bankids.size(); + const size_t numbanks = bankids.size(); // Initialize vectors m_bankIDs.assign(numbanks, 0); @@ -83,7 +83,7 @@ ChopperConfiguration::ChopperConfiguration(vector<int> bankids) m_bankIDs.assign(bankids.begin(), bankids.end()); m_bankIDIndexMap.clear(); for (size_t ib = 0; ib < numbanks; ++ib) { - m_bankIDIndexMap.insert(make_pair(m_bankIDs[ib], ib)); + m_bankIDIndexMap.emplace(m_bankIDs[ib], ib); } } @@ -120,7 +120,7 @@ ChopperConfiguration::ChopperConfiguration(const int freq, // Set up bank ID / looking up index map m_bankIDIndexMap.clear(); for (size_t ib = 0; ib < numbanks; ++ib) { - m_bankIDIndexMap.insert(make_pair(m_bankIDs[ib], ib)); + m_bankIDIndexMap.emplace(m_bankIDs[ib], ib); } } @@ -537,7 +537,7 @@ void SaveGSASInstrumentFile::parseProfileTableWorkspace( for (size_t icol = 0; icol < numbanks; ++icol) { double tmpdbl; tmprow >> tmpdbl; - vec_maptemp[icol].insert(make_pair(parname, tmpdbl)); + vec_maptemp[icol].emplace(parname, tmpdbl); } } else { for (size_t icol = 0; icol < numbanks; ++icol) { @@ -561,7 +561,7 @@ void SaveGSASInstrumentFile::parseProfileTableWorkspace( for (size_t i = 0; i < vecbankindex.size(); ++i) { unsigned int bankid = vecbankindex[i]; - profilemap.insert(make_pair(bankid, vec_maptemp[i])); + profilemap.emplace(bankid, vec_maptemp[i]); } return; @@ -711,9 +711,9 @@ void SaveGSASInstrumentFile::convertToGSAS( "Chopper configuration does not have some certain bank."); double mndsp = m_configuration->getParameter(bankid, "MinDsp"); - m_bank_mndsp.insert(make_pair(bankid, mndsp)); + m_bank_mndsp.emplace(bankid, mndsp); double mxtof = m_configuration->getParameter(bankid, "MaxTOF"); - m_bank_mxtof.insert(make_pair(bankid, mxtof)); + m_bank_mxtof.emplace(bankid, mxtof); } // Write bank header diff --git a/Framework/DataHandling/test/LoadFullprofResolutionTest.h b/Framework/DataHandling/test/LoadFullprofResolutionTest.h index 504ad74f3779d5ab8492249fe9ab9d14d50b3cea..45fc9587350e1464f5cc5ced863f18b8e6fb0c4c 100644 --- a/Framework/DataHandling/test/LoadFullprofResolutionTest.h +++ b/Framework/DataHandling/test/LoadFullprofResolutionTest.h @@ -749,7 +749,7 @@ public: double value; string name; row >> name >> value; - parammap.insert(make_pair(name, value)); + parammap.emplace(name, value); } return; @@ -768,7 +768,7 @@ public: double value1, value2; string name; row >> name >> value1 >> value2; - parammap.insert(make_pair(name, value2)); + parammap.emplace(name, value2); } return; diff --git a/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h b/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h index 7aa94f9dbd971b925eb17ed9658d2671208187c8..bddbe7c146c1dcc874c023f74c987c14a12cc660 100644 --- a/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h +++ b/Framework/DataHandling/test/LoadGSASInstrumentFileTest.h @@ -325,7 +325,7 @@ public: double value; string name; row >> name >> value; - parammap.insert(make_pair(name, value)); + parammap.emplace(name, value); } return; @@ -344,7 +344,7 @@ public: double value1, value2; string name; row >> name >> value1 >> value2; - parammap.insert(make_pair(name, value2)); + parammap.emplace(name, value2); } return; diff --git a/Framework/DataHandling/test/SetScalingPSDTest.h b/Framework/DataHandling/test/SetScalingPSDTest.h index b7e39aa47664968e9e1f9b3313646a9f0aae3065..71f8d03194f3b6315b3bd3805c5b14fa05601763 100644 --- a/Framework/DataHandling/test/SetScalingPSDTest.h +++ b/Framework/DataHandling/test/SetScalingPSDTest.h @@ -44,7 +44,7 @@ public: std::map<int, V3D> originalPositions; for (int i = 0; i < ndets; ++i) { IDetector_const_sptr det = testWS->getDetector(i); - originalPositions.insert(std::pair<int, V3D>(i, det->getPos())); + originalPositions.emplace(i, det->getPos()); } IAlgorithm_sptr scaler = createAlgorithm(); diff --git a/Framework/DataObjects/test/EventListTest.h b/Framework/DataObjects/test/EventListTest.h index 4e0d993708dbbeac2294a296479c93a26952db0b..7868a17701c2d86e2529455bce19fdbcf2cd70e3 100644 --- a/Framework/DataObjects/test/EventListTest.h +++ b/Framework/DataObjects/test/EventListTest.h @@ -1672,8 +1672,8 @@ public: // Output will be 10 event lists std::map<int, EventList *> outputs; for (int i = 0; i < 10; i++) - outputs.insert(std::make_pair(i, new EventList())); - outputs.insert(std::make_pair(-1, new EventList())); + outputs.emplace(i, new EventList()); + outputs.emplace(-1, new EventList()); // Generate time splitters TimeSplitterType split; @@ -1727,8 +1727,8 @@ public: // Output will be 10 event lists std::map<int, EventList *> outputs; for (int i = 0; i < 10; i++) - outputs.insert(std::make_pair(i, new EventList())); - outputs.insert(std::make_pair(-1, new EventList())); + outputs.emplace(i, new EventList()); + outputs.emplace(-1, new EventList()); // Generate time splitters std::vector<int64_t> vec_splitTimes; @@ -2137,8 +2137,8 @@ public: // Output will be 10 event lists std::map<int, EventList *> outputs; for (int i = 0; i < 10; i++) - outputs.insert(std::make_pair(i, new EventList())); - outputs.insert(std::make_pair(-1, new EventList())); + outputs.emplace(i, new EventList()); + outputs.emplace(-1, new EventList()); // Generate time splitters std::vector<int64_t> vec_splitTimes(11); @@ -2228,8 +2228,8 @@ public: // Output will be 10 event lists std::map<int, EventList *> outputs; for (int i = 0; i < 10; i++) - outputs.insert(std::make_pair(i, new EventList())); - outputs.insert(std::make_pair(-1, new EventList())); + outputs.emplace(i, new EventList()); + outputs.emplace(-1, new EventList()); // Generate time splitters std::vector<int64_t> vec_splitTimes(11); diff --git a/Framework/Geometry/src/Crystal/CenteringGroup.cpp b/Framework/Geometry/src/Crystal/CenteringGroup.cpp index decd7f0e2c4f746a223e05860ab87adbc1665c58..c58cb3c5de66182ddd950f91f6028b49269b7abf 100644 --- a/Framework/Geometry/src/Crystal/CenteringGroup.cpp +++ b/Framework/Geometry/src/Crystal/CenteringGroup.cpp @@ -114,17 +114,15 @@ CenteringGroupCreatorImpl::getRrevCentered() const { } CenteringGroupCreatorImpl::CenteringGroupCreatorImpl() - : m_centeringSymbolMap() { - m_centeringSymbolMap.insert(std::make_pair("P", CenteringGroup::P)); - m_centeringSymbolMap.insert(std::make_pair("I", CenteringGroup::I)); - m_centeringSymbolMap.insert(std::make_pair("A", CenteringGroup::A)); - m_centeringSymbolMap.insert(std::make_pair("B", CenteringGroup::B)); - m_centeringSymbolMap.insert(std::make_pair("C", CenteringGroup::C)); - m_centeringSymbolMap.insert(std::make_pair("F", CenteringGroup::F)); - m_centeringSymbolMap.insert(std::make_pair("R", CenteringGroup::Robv)); - m_centeringSymbolMap.insert(std::make_pair("Robv", CenteringGroup::Robv)); - m_centeringSymbolMap.insert(std::make_pair("Rrev", CenteringGroup::Rrev)); -} + : m_centeringSymbolMap({{"P", CenteringGroup::P}, + {"I", CenteringGroup::I}, + {"A", CenteringGroup::A}, + {"B", CenteringGroup::B}, + {"C", CenteringGroup::C}, + {"F", CenteringGroup::F}, + {"R", CenteringGroup::Robv}, + {"Robv", CenteringGroup::Robv}, + {"Rrev", CenteringGroup::Rrev}}) {} } // namespace Geometry } // namespace Mantid diff --git a/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp b/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp index 0e8c9c5c80dbdb0093234212ab3cb3e7d6077d39..f6bbfa6ee5028399b975232c326e54002185dc4f 100644 --- a/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp +++ b/Framework/Geometry/src/Crystal/CompositeBraggScatterer.cpp @@ -210,9 +210,8 @@ CompositeBraggScatterer::getPropertyCountMap() const { std::vector<Property *> compositeProperties = getProperties(); for (auto it = compositeProperties.begin(); it != compositeProperties.end(); ++it) { - propertyUseCount.insert(std::make_pair((*it)->name(), 0)); + propertyUseCount.emplace((*it)->name(), 0); } - return propertyUseCount; } diff --git a/Framework/Geometry/src/Instrument.cpp b/Framework/Geometry/src/Instrument.cpp index adecb4b35ad904951e0c902271dedfa040f9b34e..010c85d35589ae32d3dffaa4bde2c89345d576b1 100644 --- a/Framework/Geometry/src/Instrument.cpp +++ b/Framework/Geometry/src/Instrument.cpp @@ -183,9 +183,8 @@ void Instrument::getDetectors(detid2det_map &out_map) const { static_cast<const Instrument *>(m_base)->m_detectorCache; // And turn them into parametrized versions for (auto it = in_dets.cbegin(); it != in_dets.cend(); ++it) { - out_map.insert(std::pair<detid_t, IDetector_sptr>( - it->first, - ParComponentFactory::createDetector(it->second.get(), m_map))); + out_map.emplace(it->first, ParComponentFactory::createDetector( + it->second.get(), m_map)); } } else { // You can just return the detector cache directly. diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp index 0ea4f61ad130c7bfb0b37885501939cff7ab9168..3832d0cd6554fc650aea1d2848da1f4671180fea 100644 --- a/Framework/Geometry/src/Math/Acomp.cpp +++ b/Framework/Geometry/src/Math/Acomp.cpp @@ -768,7 +768,7 @@ literals if (mc != literalMap.end()) mc->second++; else - literalMap.insert(std::pair<int, int>(V, 1)); + literalMap.emplace(V, 1); } std::vector<Acomp>::const_iterator cc; for (cc = Comp.begin(); cc != Comp.end(); ++cc) @@ -792,7 +792,7 @@ literals if (mc != literalMap.end()) mc->second++; else - literalMap.insert(std::pair<int, int>(*uc, 1)); + literalMap.emplace(*uc, 1); } std::vector<Acomp>::const_iterator cc; for (cc = Comp.begin(); cc != Comp.end(); ++cc) { diff --git a/Framework/Geometry/test/CompositeBraggScattererTest.h b/Framework/Geometry/test/CompositeBraggScattererTest.h index 618c86120f6765301577d1116d4831617bb9bd95..ac751137a878e63f237dbb738c7531569dd49dd2 100644 --- a/Framework/Geometry/test/CompositeBraggScattererTest.h +++ b/Framework/Geometry/test/CompositeBraggScattererTest.h @@ -176,62 +176,25 @@ private: } std::map<V3D, double> getCalculatedStructureFactors() { - std::map<V3D, double> fSquaredCalc; - fSquaredCalc.insert(std::make_pair(V3D(2, 0, 0), 167.84)); - fSquaredCalc.insert(std::make_pair(V3D(3, 0, 0), 153.50)); - fSquaredCalc.insert(std::make_pair(V3D(4, 0, 0), 19.76)); - fSquaredCalc.insert(std::make_pair(V3D(5, 0, 0), 176.21)); - fSquaredCalc.insert(std::make_pair(V3D(1, 1, 0), 2.44)); - fSquaredCalc.insert(std::make_pair(V3D(2, 1, 0), 15.83)); - fSquaredCalc.insert(std::make_pair(V3D(3, 1, 0), 14.48)); - fSquaredCalc.insert(std::make_pair(V3D(4, 1, 0), 1.86)); - fSquaredCalc.insert(std::make_pair(V3D(5, 1, 0), 16.62)); - fSquaredCalc.insert(std::make_pair(V3D(2, 2, 0), 104.66)); - fSquaredCalc.insert(std::make_pair(V3D(3, 2, 0), 95.72)); - fSquaredCalc.insert(std::make_pair(V3D(4, 2, 0), 12.32)); - fSquaredCalc.insert(std::make_pair(V3D(5, 2, 0), 109.88)); - fSquaredCalc.insert(std::make_pair(V3D(3, 3, 0), 90.10)); - fSquaredCalc.insert(std::make_pair(V3D(4, 3, 0), 11.60)); - fSquaredCalc.insert(std::make_pair(V3D(5, 3, 0), 103.43)); - fSquaredCalc.insert(std::make_pair(V3D(4, 4, 0), 1.55)); - fSquaredCalc.insert(std::make_pair(V3D(5, 4, 0), 13.86)); - fSquaredCalc.insert(std::make_pair(V3D(5, 5, 0), 130.22)); - fSquaredCalc.insert(std::make_pair(V3D(1, 1, 1), 16.45)); - fSquaredCalc.insert(std::make_pair(V3D(2, 1, 1), 2.26)); - fSquaredCalc.insert(std::make_pair(V3D(3, 1, 1), 21.53)); - fSquaredCalc.insert(std::make_pair(V3D(4, 1, 1), 1.80)); - fSquaredCalc.insert(std::make_pair(V3D(5, 1, 1), 10.47)); - fSquaredCalc.insert(std::make_pair(V3D(2, 2, 1), 14.95)); - fSquaredCalc.insert(std::make_pair(V3D(3, 2, 1), 142.33)); - fSquaredCalc.insert(std::make_pair(V3D(4, 2, 1), 11.92)); - fSquaredCalc.insert(std::make_pair(V3D(5, 2, 1), 69.17)); - fSquaredCalc.insert(std::make_pair(V3D(3, 3, 1), 133.97)); - fSquaredCalc.insert(std::make_pair(V3D(4, 3, 1), 11.22)); - fSquaredCalc.insert(std::make_pair(V3D(5, 3, 1), 65.11)); - fSquaredCalc.insert(std::make_pair(V3D(4, 4, 1), 1.50)); - fSquaredCalc.insert(std::make_pair(V3D(5, 4, 1), 8.73)); - fSquaredCalc.insert(std::make_pair(V3D(5, 5, 1), 81.98)); - fSquaredCalc.insert(std::make_pair(V3D(2, 2, 2), 14.36)); - fSquaredCalc.insert(std::make_pair(V3D(3, 2, 2), 88.94)); - fSquaredCalc.insert(std::make_pair(V3D(4, 2, 2), 77.57)); - fSquaredCalc.insert(std::make_pair(V3D(5, 2, 2), 9.52)); - fSquaredCalc.insert(std::make_pair(V3D(3, 3, 2), 83.72)); - fSquaredCalc.insert(std::make_pair(V3D(4, 3, 2), 73.02)); - fSquaredCalc.insert(std::make_pair(V3D(5, 3, 2), 8.96)); - fSquaredCalc.insert(std::make_pair(V3D(4, 4, 2), 9.79)); - fSquaredCalc.insert(std::make_pair(V3D(5, 4, 2), 1.20)); - fSquaredCalc.insert(std::make_pair(V3D(5, 5, 2), 11.29)); - fSquaredCalc.insert(std::make_pair(V3D(3, 3, 3), 11.44)); - fSquaredCalc.insert(std::make_pair(V3D(4, 3, 3), 103.89)); - fSquaredCalc.insert(std::make_pair(V3D(5, 3, 3), 8.30)); - fSquaredCalc.insert(std::make_pair(V3D(4, 4, 3), 13.93)); - fSquaredCalc.insert(std::make_pair(V3D(5, 4, 3), 1.11)); - fSquaredCalc.insert(std::make_pair(V3D(5, 5, 3), 10.45)); - fSquaredCalc.insert(std::make_pair(V3D(4, 4, 4), 8.33)); - fSquaredCalc.insert(std::make_pair(V3D(5, 4, 4), 6.93)); - fSquaredCalc.insert(std::make_pair(V3D(5, 5, 4), 65.05)); - fSquaredCalc.insert(std::make_pair(V3D(5, 5, 5), 88.57)); - return fSquaredCalc; + return { + {V3D(2, 0, 0), 167.84}, {V3D(3, 0, 0), 153.50}, {V3D(4, 0, 0), 19.76}, + {V3D(5, 0, 0), 176.21}, {V3D(1, 1, 0), 2.44}, {V3D(2, 1, 0), 15.83}, + {V3D(3, 1, 0), 14.48}, {V3D(4, 1, 0), 1.86}, {V3D(5, 1, 0), 16.62}, + {V3D(2, 2, 0), 104.66}, {V3D(3, 2, 0), 95.72}, {V3D(4, 2, 0), 12.32}, + {V3D(5, 2, 0), 109.88}, {V3D(3, 3, 0), 90.10}, {V3D(4, 3, 0), 11.60}, + {V3D(5, 3, 0), 103.43}, {V3D(4, 4, 0), 1.55}, {V3D(5, 4, 0), 13.86}, + {V3D(5, 5, 0), 130.22}, {V3D(1, 1, 1), 16.45}, {V3D(2, 1, 1), 2.26}, + {V3D(3, 1, 1), 21.53}, {V3D(4, 1, 1), 1.80}, {V3D(5, 1, 1), 10.47}, + {V3D(2, 2, 1), 14.95}, {V3D(3, 2, 1), 142.33}, {V3D(4, 2, 1), 11.92}, + {V3D(5, 2, 1), 69.17}, {V3D(3, 3, 1), 133.97}, {V3D(4, 3, 1), 11.22}, + {V3D(5, 3, 1), 65.11}, {V3D(4, 4, 1), 1.50}, {V3D(5, 4, 1), 8.73}, + {V3D(5, 5, 1), 81.98}, {V3D(2, 2, 2), 14.36}, {V3D(3, 2, 2), 88.94}, + {V3D(4, 2, 2), 77.57}, {V3D(5, 2, 2), 9.52}, {V3D(3, 3, 2), 83.72}, + {V3D(4, 3, 2), 73.02}, {V3D(5, 3, 2), 8.96}, {V3D(4, 4, 2), 9.79}, + {V3D(5, 4, 2), 1.20}, {V3D(5, 5, 2), 11.29}, {V3D(3, 3, 3), 11.44}, + {V3D(4, 3, 3), 103.89}, {V3D(5, 3, 3), 8.30}, {V3D(4, 4, 3), 13.93}, + {V3D(5, 4, 3), 1.11}, {V3D(5, 5, 3), 10.45}, {V3D(4, 4, 4), 8.33}, + {V3D(5, 4, 4), 6.93}, {V3D(5, 5, 4), 65.05}, {V3D(5, 5, 5), 88.57}}; } }; diff --git a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h index e8df73d11935cb5316b407b27e3fec297ac45f98..d710c80af8ee72e6c970ed0cd4923806567543ac 100644 --- a/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h +++ b/Framework/Kernel/inc/MantidKernel/ThreadScheduler.h @@ -264,7 +264,7 @@ public: // Cache the total cost m_queueLock.lock(); m_cost += newTask->cost(); - m_map.insert(std::pair<double, Task *>(newTask->cost(), newTask)); + m_map.emplace(newTask->cost(), newTask); m_queueLock.unlock(); } diff --git a/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h b/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h index 56204ceebcb30783204ecb132b591b386f38ffa5..80f35d0726858555fd5c90a48b2e2f0d99a73f47 100644 --- a/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h +++ b/Framework/Kernel/inc/MantidKernel/ThreadSchedulerMutexes.h @@ -37,7 +37,7 @@ public: m_cost += newTask->cost(); boost::shared_ptr<Mutex> mut = newTask->getMutex(); - m_supermap[mut].insert(std::pair<double, Task *>(newTask->cost(), newTask)); + m_supermap[mut].emplace(newTask->cost(), newTask); m_queueLock.unlock(); } diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp index 71f6ee254fa1ad5f5c77ea71a6be99d52856932e..dedaeb4a11c67e4a9f367431afbf8c99c364faab 100644 --- a/Framework/Kernel/src/ConfigService.cpp +++ b/Framework/Kernel/src/ConfigService.cpp @@ -191,25 +191,22 @@ ConfigServiceImpl::ConfigServiceImpl() // Fill the list of possible relative path keys that may require conversion to // absolute paths - m_ConfigPaths.insert( - std::make_pair("mantidqt.python_interfaces_directory", true)); - m_ConfigPaths.insert(std::make_pair("plugins.directory", true)); - m_ConfigPaths.insert(std::make_pair("pvplugins.directory", true)); - m_ConfigPaths.insert(std::make_pair("mantidqt.plugins.directory", true)); - m_ConfigPaths.insert(std::make_pair("instrumentDefinition.directory", true)); - m_ConfigPaths.insert( - std::make_pair("instrumentDefinition.vtpDirectory", true)); - m_ConfigPaths.insert(std::make_pair("groupingFiles.directory", true)); - m_ConfigPaths.insert(std::make_pair("maskFiles.directory", true)); - m_ConfigPaths.insert(std::make_pair("colormaps.directory", true)); - m_ConfigPaths.insert( - std::make_pair("requiredpythonscript.directories", true)); - m_ConfigPaths.insert(std::make_pair("pythonscripts.directory", true)); - m_ConfigPaths.insert(std::make_pair("pythonscripts.directories", true)); - m_ConfigPaths.insert(std::make_pair("python.plugins.directories", true)); - m_ConfigPaths.insert(std::make_pair("user.python.plugins.directories", true)); - m_ConfigPaths.insert(std::make_pair("datasearch.directories", true)); - m_ConfigPaths.insert(std::make_pair("icatDownload.directory", true)); + m_ConfigPaths.emplace("mantidqt.python_interfaces_directory", true); + m_ConfigPaths.emplace("plugins.directory", true); + m_ConfigPaths.emplace("pvplugins.directory", true); + m_ConfigPaths.emplace("mantidqt.plugins.directory", true); + m_ConfigPaths.emplace("instrumentDefinition.directory", true); + m_ConfigPaths.emplace("instrumentDefinition.vtpDirectory", true); + m_ConfigPaths.emplace("groupingFiles.directory", true); + m_ConfigPaths.emplace("maskFiles.directory", true); + m_ConfigPaths.emplace("colormaps.directory", true); + m_ConfigPaths.emplace("requiredpythonscript.directories", true); + m_ConfigPaths.emplace("pythonscripts.directory", true); + m_ConfigPaths.emplace("pythonscripts.directories", true); + m_ConfigPaths.emplace("python.plugins.directories", true); + m_ConfigPaths.emplace("user.python.plugins.directories", true); + m_ConfigPaths.emplace("datasearch.directories", true); + m_ConfigPaths.emplace("icatDownload.directory", true); // attempt to load the default properties file that resides in the directory // of the executable @@ -489,7 +486,7 @@ void ConfigServiceImpl::convertRelativeToAbsolute() { std::string value(m_pConf->getString(key)); value = makeAbsolute(value, key); - m_AbsolutePaths.insert(std::make_pair(key, value)); + m_AbsolutePaths.emplace(key, value); } } diff --git a/Framework/Kernel/src/DeltaEMode.cpp b/Framework/Kernel/src/DeltaEMode.cpp index 36fbaaea23f1f54b142c731467a382f92479dd86..6bbab1943830fc3fd2cc41a40b406ae5cdbaae3e 100644 --- a/Framework/Kernel/src/DeltaEMode.cpp +++ b/Framework/Kernel/src/DeltaEMode.cpp @@ -11,13 +11,11 @@ namespace Kernel { namespace // unnamed { struct ModeIndex { - ModeIndex() { - index.insert(std::make_pair(DeltaEMode::Elastic, "Elastic")); - index.insert(std::make_pair(DeltaEMode::Direct, "Direct")); - index.insert(std::make_pair(DeltaEMode::Indirect, "Indirect")); - index.insert(std::make_pair(DeltaEMode::Undefined, "Undefined")); - } - std::map<DeltaEMode::Type, std::string> index; + std::map<DeltaEMode::Type, std::string> index{ + {DeltaEMode::Elastic, "Elastic"}, + {DeltaEMode::Direct, "Direct"}, + {DeltaEMode::Indirect, "Indirect"}, + {DeltaEMode::Undefined, "Undefined"}}; }; /// Returns the map storing the mode->string lookup ModeIndex &typeStringLookup() { diff --git a/Framework/Kernel/src/InternetHelper.cpp b/Framework/Kernel/src/InternetHelper.cpp index 09cf0b15931b830a61a93ad2b8ab5664f81b3370..e2f21895d198aea3e7e61d3caf810207bf3f66d0 100644 --- a/Framework/Kernel/src/InternetHelper.cpp +++ b/Framework/Kernel/src/InternetHelper.cpp @@ -565,7 +565,7 @@ const std::string &InternetHelper::getResponseReason() { **/ void InternetHelper::addHeader(const std::string &key, const std::string &value) { - m_headers.insert(std::pair<std::string, std::string>(key, value)); + m_headers.emplace(key, value); } /** Removes a header diff --git a/Framework/Kernel/src/LibraryManager.cpp b/Framework/Kernel/src/LibraryManager.cpp index 51ef6c4523f2ba0bfc2ef80fef1e08cb6c75068b..4f3997751cc0ae29904422904dc5ce8623149af6 100644 --- a/Framework/Kernel/src/LibraryManager.cpp +++ b/Framework/Kernel/src/LibraryManager.cpp @@ -124,8 +124,7 @@ bool LibraryManagerImpl::loadLibrary(const std::string &filepath) { if (dlwrap->OpenLibrary(libName, directory.toString())) { // Successfully opened, so add to map g_log.debug("Opened library: " + libName + ".\n"); - OpenLibs.insert(std::pair<std::string, boost::shared_ptr<LibraryWrapper>>( - libName, dlwrap)); + OpenLibs.emplace(libName, dlwrap); return true; } else { return false; diff --git a/Framework/Kernel/test/ConfigServiceTest.h b/Framework/Kernel/test/ConfigServiceTest.h index 00bfe5d9a5987f001e3469c160a675f382f4758f..09f980d53a13f406fe294bb76b5876d17baff84a 100644 --- a/Framework/Kernel/test/ConfigServiceTest.h +++ b/Framework/Kernel/test/ConfigServiceTest.h @@ -488,7 +488,7 @@ public: std::map<int, std::string> prop_lines; int line_index(0); while (getline(reader, line)) { - prop_lines.insert(std::make_pair(line_index, line)); + prop_lines.emplace(line_index, line); ++line_index; } reader.close(); @@ -540,7 +540,7 @@ public: std::map<int, std::string> prop_lines; int line_index(0); while (getline(reader, line)) { - prop_lines.insert(std::make_pair(line_index, line)); + prop_lines.emplace(line_index, line); ++line_index; } reader.close(); diff --git a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp index e8ad2b749266bc307792ebb08d5f460f5372d0cf..c99107e4c01861d2e7806dc05c79cd06f1c3be9b 100644 --- a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp @@ -144,7 +144,7 @@ void ConvertCWPDMDToSpectra::exec() { << " must exist for run " << runid << "."; throw std::runtime_error(errss.str()); } - map_runWavelength.insert(std::make_pair(runid, thislambda)); + map_runWavelength.emplace(runid, thislambda); } } diff --git a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp index 7d83278d8be0a44923d5205094f5262cb0a36a13..4fa5018615f208d39ec6e32ec6f2fac45b20855e 100644 --- a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp +++ b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp @@ -279,7 +279,7 @@ void ConvertSpiceDataToRealSpace::parseSampleLogs( logvec[ir] = dbltemp; } - logvecmap.insert(std::make_pair(logname, logvec)); + logvecmap.emplace(logname, logvec); } return; @@ -405,7 +405,7 @@ void ConvertSpiceDataToRealSpace::readTableInfo( size_t anodeid = static_cast<size_t>(atoi(terms.back().c_str())); anodelist.push_back(std::make_pair(anodeid, icol)); } else { - samplenameindexmap.insert(std::make_pair(colname, icol)); + samplenameindexmap.emplace(colname, icol); } } // ENDFOR (icol) @@ -767,7 +767,7 @@ void ConvertSpiceDataToRealSpace::parseDetectorEfficiencyTable( for (size_t i = 0; i < numrows; ++i) { detid_t detid = detefftablews->cell<detid_t>(i, 0); double deteff = detefftablews->cell<double>(i, 1); - deteffmap.insert(std::make_pair(detid, deteff)); + deteffmap.emplace(detid, deteff); } return; diff --git a/Framework/MDAlgorithms/src/ConvertToMD.cpp b/Framework/MDAlgorithms/src/ConvertToMD.cpp index 7cdeff300d7abe76168a2a1e2658ce0394e1b5c5..59fe97134ef322e7d26fe07c0ba1844a3b788aa9 100644 --- a/Framework/MDAlgorithms/src/ConvertToMD.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMD.cpp @@ -320,9 +320,8 @@ void ConvertToMD::copyMetaData(API::IMDEventWorkspace_sptr &mdEventWS) const { for (size_t i = 0; i < m_InWS2D->getNumberHistograms(); ++i) { const auto &dets = m_InWS2D->getSpectrum(i)->getDetectorIDs(); if (!dets.empty()) { - std::vector<detid_t> id_vector; - std::copy(dets.begin(), dets.end(), std::back_inserter(id_vector)); - mapping->insert(std::make_pair(id_vector.front(), id_vector)); + mapping->emplace(*dets.begin(), + std::vector<detid_t>(dets.begin(), dets.end())); } } diff --git a/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp b/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp index 129dbe5e18102fb1b7d4243997edb1b845dc2d72..8078dda8cd2a15ed043a4a9e0ed9b817d80bcf8a 100644 --- a/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp @@ -251,7 +251,7 @@ std::map<std::string, std::string> CreateMDWorkspace::validateInputs() { std::string message = "The selected frames can be 'HKL', 'QSample', 'QLab' " "or 'General Frame'. You must specify as many frames " "as there are dimensions."; - errors.insert(std::make_pair(framePropertyName, message)); + errors.emplace(framePropertyName, message); } return errors; } diff --git a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp index 69ff52f1e778a92b707b625081097b257bd9582a..fe75ce0f375e72085f4cca9b7a02e336af89d7c0 100644 --- a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp +++ b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp @@ -404,10 +404,9 @@ void SCARFTomoReconstruction::doLogout(const std::string &username) { std::string httpsURL = baseURL + logoutPath; StringToStringMap headers; - headers.insert( - std::pair<std::string, std::string>("Content-Type", "text/plain")); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); + headers.emplace("Content-Type", "text/plain"); + headers.emplace("Cookie", token); + headers.emplace("Accept", m_acceptType); int code; std::stringstream ss; try { @@ -510,10 +509,9 @@ void SCARFTomoReconstruction::doSubmit(const std::string &username) { std::string httpsURL = baseURL + submitPath; StringToStringMap headers; - headers.insert(std::pair<std::string, std::string>( - "Content-Type", "multipart/mixed; boundary=" + boundary)); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); + headers.emplace("Content-Type", "multipart/mixed; boundary=" + boundary); + headers.emplace("Accept", m_acceptType); + headers.emplace("Cookie", token); int code; std::stringstream ss; try { @@ -573,8 +571,8 @@ void SCARFTomoReconstruction::doQueryStatus(const std::string &username) { StringToStringMap headers; headers.insert( std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); + headers.emplace("Accept", m_acceptType); + headers.emplace("Cookie", token); int code; std::stringstream ss; try { @@ -641,8 +639,8 @@ void SCARFTomoReconstruction::doQueryStatusById(const std::string &username, StringToStringMap headers; headers.insert( std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); + headers.emplace("Accept", m_acceptType); + headers.emplace("Cookie", token); int code; std::stringstream ss; try { @@ -698,9 +696,8 @@ bool SCARFTomoReconstruction::doPing() { std::string httpsURL = baseURL + pingPath; StringToStringMap headers; - headers.insert( - std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); + headers.emplace("Content-Type", "application/xml"); + headers.emplace("Accept", m_acceptType); int code; std::stringstream ss; try { @@ -765,8 +762,8 @@ void SCARFTomoReconstruction::doCancel(const std::string &username, StringToStringMap headers; headers.insert( std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); + headers.emplace("Cookie", token); + headers.emplace("Accept", m_acceptType); int code; std::stringstream ss; try { @@ -837,10 +834,9 @@ void SCARFTomoReconstruction::doUploadFile(const std::string &username, InternetHelper session; std::string httpsURL = baseURL + uploadPath; StringToStringMap headers; - headers.insert(std::pair<std::string, std::string>( - "Content-Type", "multipart/mixed; boundary=" + boundary)); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); + headers.emplace("Content-Type", "multipart/mixed; boundary=" + boundary); + headers.emplace("Accept", m_acceptType); + headers.emplace("Cookie", token); const std::string &body = buildUploadBody(boundary, destDir, filename); int code; @@ -1366,8 +1362,8 @@ void SCARFTomoReconstruction::getOneJobFile(const std::string &jobId, StringToStringMap headers; headers.insert( std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); + headers.emplace("Cookie", token); + headers.emplace("Accept", m_acceptType); std::string body = remotePath; int code; std::stringstream ss; @@ -1434,10 +1430,9 @@ void SCARFTomoReconstruction::getAllJobFiles(const std::string &jobId, std::string httpsURL = baseURL + downloadPath; StringToStringMap headers; - headers.insert( - std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.insert(std::pair<std::string, std::string>("Cookie", token)); - headers.insert(std::pair<std::string, std::string>("Accept", m_acceptType)); + headers.emplace("Content-Type", "application/xml"); + headers.emplace("Cookie", token); + headers.emplace("Accept", m_acceptType); int code; std::stringstream ss; try { diff --git a/MantidPlot/src/ConfigDialog.cpp b/MantidPlot/src/ConfigDialog.cpp index 7d2b76c1949f031beb7210661341118f58ee4bc1..e83ec40a0ce91be94252329fd92e761141b46c04 100644 --- a/MantidPlot/src/ConfigDialog.cpp +++ b/MantidPlot/src/ConfigDialog.cpp @@ -1167,7 +1167,7 @@ void ConfigDialog::populateProgramTree() programKeysAndDetails[programKeys[j]] = (Mantid::Kernel::ConfigService::Instance().getString(("workspace.sendto." + programNames[i] + "." + programKeys[j]))); } - m_sendToSettings.insert(std::make_pair(programNames[i], programKeysAndDetails)); + m_sendToSettings.emplace(programNames[i], programKeysAndDetails); } updateProgramTree(); } diff --git a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp index f49c0a553dada231bfbf167e2413e54d2c64d922..7dae7a398b727182859aacc4dd3fc2bd47a676f0 100644 --- a/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp +++ b/MantidPlot/src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp @@ -878,7 +878,7 @@ QString ComponentInfoController::getParameterInfo(Mantid::Geometry::IComponent_c //attempt to insert this will fail silently if the key already exists if ( mapCmptToNameVector.find(paramCompId) == mapCmptToNameVector.end() ) { - mapCmptToNameVector.insert(std::pair<Mantid::Geometry::ComponentID, std::vector<std::string> >(paramCompId,std::vector<std::string>())); + mapCmptToNameVector.emplace(paramCompId, std::vector<std::string>()); } //get the vector out and add the name mapCmptToNameVector[paramCompId].push_back(paramName); diff --git a/MantidQt/MantidWidgets/src/CatalogHelper.cpp b/MantidQt/MantidWidgets/src/CatalogHelper.cpp index 48d1ecfaedde4128fd3f9c8db43b18d3bdc10cf1..6431c01a3290a03a7cdc4ae43f3931c1f33d696c 100644 --- a/MantidQt/MantidWidgets/src/CatalogHelper.cpp +++ b/MantidQt/MantidWidgets/src/CatalogHelper.cpp @@ -220,7 +220,7 @@ namespace MantidQt // Add the input name + "_err" (to indicate the error marker in the GUI, // rather than the input field) as the key, and the related error as the value. - errors.insert(std::make_pair(iter->first + "_err", documentation)); + errors.emplace(iter->first + "_err", documentation); } } return errors; diff --git a/MantidQt/MantidWidgets/src/CatalogSearch.cpp b/MantidQt/MantidWidgets/src/CatalogSearch.cpp index 0c430da13fb3dcd436f50ad5866a5d86080f574f..2ef9da1c6e044de5d4dee3e230031d6164ef7872 100644 --- a/MantidQt/MantidWidgets/src/CatalogSearch.cpp +++ b/MantidQt/MantidWidgets/src/CatalogSearch.cpp @@ -441,32 +441,49 @@ namespace MantidQt std::map<std::string, std::string> searchFieldInput; // Left side of form. - searchFieldInput.insert(std::pair<std::string, std::string>("InvestigationName", m_icatUiForm.InvestigationName->text().toStdString())); - searchFieldInput.insert(std::pair<std::string, std::string>("Instrument", m_icatUiForm.Instrument->currentText().toStdString())); + searchFieldInput.emplace( + "InvestigationName", + m_icatUiForm.InvestigationName->text().toStdString()); + searchFieldInput.emplace( + "Instrument", m_icatUiForm.Instrument->currentText().toStdString()); if (m_icatUiForm.RunRange->text().size() > 2) { - searchFieldInput.insert(std::pair<std::string, std::string>("RunRange", m_icatUiForm.RunRange->text().toStdString())); + searchFieldInput.emplace("RunRange", + m_icatUiForm.RunRange->text().toStdString()); } - searchFieldInput.insert(std::pair<std::string, std::string>("InvestigatorSurname", m_icatUiForm.InvestigatorSurname->text().toStdString())); - searchFieldInput.insert(std::pair<std::string, std::string>("DataFileName", m_icatUiForm.DataFileName->text().toStdString())); - searchFieldInput.insert(std::pair<std::string, std::string>("InvestigationId", m_icatUiForm.InvestigationId->text().toStdString())); + searchFieldInput.emplace( + "InvestigatorSurname", + m_icatUiForm.InvestigatorSurname->text().toStdString()); + searchFieldInput.emplace("DataFileName", + m_icatUiForm.DataFileName->text().toStdString()); + searchFieldInput.emplace( + "InvestigationId", + m_icatUiForm.InvestigationId->text().toStdString()); // Right side of form. if (m_icatUiForm.StartDate->text().size() > 2) { - searchFieldInput.insert(std::pair<std::string, std::string>("StartDate", m_icatUiForm.StartDate->text().toStdString())); + searchFieldInput.emplace("StartDate", + m_icatUiForm.StartDate->text().toStdString()); } if (m_icatUiForm.EndDate->text().size() > 2) { - searchFieldInput.insert(std::pair<std::string, std::string>("EndDate", m_icatUiForm.EndDate->text().toStdString())); + searchFieldInput.emplace("EndDate", + m_icatUiForm.EndDate->text().toStdString()); } - searchFieldInput.insert(std::pair<std::string, std::string>("Keywords", m_icatUiForm.Keywords->text().toStdString())); - searchFieldInput.insert(std::pair<std::string, std::string>("SampleName", m_icatUiForm.SampleName->text().toStdString())); - searchFieldInput.insert(std::pair<std::string, std::string>("InvestigationType", m_icatUiForm.InvestigationType->currentText().toStdString())); + searchFieldInput.emplace("Keywords", + m_icatUiForm.Keywords->text().toStdString()); + searchFieldInput.emplace("SampleName", + m_icatUiForm.SampleName->text().toStdString()); + searchFieldInput.emplace( + "InvestigationType", + m_icatUiForm.InvestigationType->currentText().toStdString()); // Since we check if the field is empty in the algorithm, there's no need to check if advanced was clicked. // If the "My data only" field is checked. We return the state of the checkbox (1 is true, 0 is false). - searchFieldInput.insert(std::pair<std::string, std::string>("MyData", boost::lexical_cast<std::string>(m_icatUiForm.myDataCbox->isChecked()))); + searchFieldInput.emplace("MyData", + boost::lexical_cast<std::string>( + m_icatUiForm.myDataCbox->isChecked())); return (searchFieldInput); }