From 74cd5a813d43504e57e8c2e9045c9ef6915a1b43 Mon Sep 17 00:00:00 2001 From: Steven Hahn <hahnse@ornl.gov> Date: Tue, 26 Jan 2016 12:20:54 -0500 Subject: [PATCH] Replace .insert(std::make_pair with .emplace. --- Framework/API/src/FileLoaderRegistry.cpp | 3 +- Framework/API/src/IFunction.cpp | 2 +- Framework/API/src/MatrixWorkspace.cpp | 2 +- Framework/API/src/SpectraAxis.cpp | 2 +- Framework/API/test/ExperimentInfoTest.h | 8 +- .../API/test/FileBackedExperimentInfoTest.h | 4 +- .../inc/MantidAlgorithms/SmoothNeighbours.h | 16 +-- Framework/Algorithms/src/FilterEvents.cpp | 10 +- .../Algorithms/src/GenerateEventsFilter.cpp | 2 +- Framework/Algorithms/src/GeneratePeaks.cpp | 8 +- Framework/Algorithms/src/MaskDetectorsIf.cpp | 5 +- Framework/Crystal/src/FindClusterFaces.cpp | 2 +- .../src/IntegratePeaksUsingClusters.cpp | 2 +- .../Crystal/src/SetSpecialCoordinates.cpp | 12 +- Framework/Crystal/src/SortHKL.cpp | 2 +- Framework/Crystal/test/SortHKLTest.h | 33 ++--- .../src/Algorithms/FitPowderDiffPeaks.cpp | 5 +- .../CurveFitting/src/Algorithms/LeBailFit.cpp | 13 +- .../RefinePowderInstrumentParameters.cpp | 2 +- .../RefinePowderInstrumentParameters3.cpp | 10 +- .../test/Algorithms/LeBailFunctionTest.h | 80 +++++------ .../RefinePowderInstrumentParameters3Test.h | 2 +- .../RefinePowderInstrumentParametersTest.h | 7 +- .../IPeakFunctionCentreParameterNameTest.h | 14 +- .../DataHandling/src/GroupDetectors2.cpp | 13 +- Framework/DataHandling/src/LoadDspacemap.cpp | 2 +- .../src/LoadFullprofResolution.cpp | 12 +- Framework/DataHandling/src/LoadSpiceAscii.cpp | 4 +- .../DataHandling/src/LoadVulcanCalFile.cpp | 12 +- .../src/SaveFullprofResolution.cpp | 2 +- .../src/UpdateInstrumentFromFile.cpp | 2 +- .../test/SaveFullprofResolutionTest.h | 40 ++---- Framework/DataObjects/src/PeakColumn.cpp | 34 ++--- Framework/Geometry/src/Crystal/PointGroup.cpp | 2 +- .../src/Crystal/PointGroupFactory.cpp | 2 +- .../src/Crystal/SpaceGroupFactory.cpp | 5 +- .../src/Crystal/SymmetryElementFactory.cpp | 2 +- .../src/Crystal/SymmetryOperationFactory.cpp | 2 +- .../Instrument/InstrumentDefinitionParser.cpp | 2 +- .../src/Instrument/NearestNeighbours.cpp | 2 +- .../Geometry/src/Instrument/ParameterMap.cpp | 10 +- .../src/Instrument/XMLInstrumentParameter.cpp | 14 +- Framework/Kernel/src/FacilityInfo.cpp | 8 +- Framework/Kernel/src/LogParser.cpp | 2 +- Framework/Kernel/src/MDAxisValidator.cpp | 4 +- Framework/Kernel/src/MultiFileNameParser.cpp | 2 +- Framework/Kernel/src/NexusDescriptor.cpp | 6 +- Framework/Kernel/src/OptionalBool.cpp | 10 +- Framework/Kernel/src/Property.cpp | 136 ++++++++---------- .../LiveData/src/SNSLiveEventDataListener.cpp | 12 +- .../src/ImportMDHistoWorkspaceBase.cpp | 2 +- .../src/IntegrateMDHistoWorkspace.cpp | 2 +- Framework/MDAlgorithms/src/ReplicateMD.cpp | 14 +- Framework/MDAlgorithms/src/SmoothMD.cpp | 22 ++- .../src/Registry/PropertyWithValueFactory.cpp | 10 +- .../kernel/src/Registry/TypeRegistry.cpp | 4 +- .../RemoteJobManagers/src/LSFJobManager.cpp | 4 +- MantidPlot/src/Mantid/MantidMatrix.cpp | 2 +- .../src/Indirect/IndirectBayes.cpp | 12 +- .../src/Indirect/IndirectCorrections.cpp | 21 ++- .../src/Indirect/IndirectDataAnalysis.cpp | 17 +-- .../src/Indirect/IndirectSimulation.cpp | 11 +- .../src/Indirect/IndirectTools.cpp | 9 +- .../src/Reflectometry/ReflTableSchema.cpp | 22 ++- MantidQt/SliceViewer/src/PeakPalette.cpp | 40 +++--- MantidQt/SliceViewer/src/QPeaksTableModel.cpp | 82 +++++------ 66 files changed, 394 insertions(+), 468 deletions(-) diff --git a/Framework/API/src/FileLoaderRegistry.cpp b/Framework/API/src/FileLoaderRegistry.cpp index 0ce3e906c6a..dcea84bb276 100644 --- a/Framework/API/src/FileLoaderRegistry.cpp +++ b/Framework/API/src/FileLoaderRegistry.cpp @@ -148,8 +148,7 @@ bool FileLoaderRegistryImpl::canLoad(const std::string &algorithmName, "FileLoaderRegistryImpl::canLoad - Algorithm '" + algorithmName + "' is not registered as a loader."); - std::multimap<std::string, int> names; - names.insert(std::make_pair(algorithmName, -1)); + std::multimap<std::string, int> names{{algorithmName, -1}}; IAlgorithm_sptr loader; if (nexus) { if (NexusDescriptor::isHDF(filename)) { diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index e4ae61a0176..fe6e01ec44d 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -1043,7 +1043,7 @@ void IFunction::setAttribute(const std::string &name, */ void IFunction::declareAttribute( const std::string &name, const API::IFunction::Attribute &defaultValue) { - m_attrs.insert(std::make_pair(name, defaultValue)); + m_attrs.emplace(name, defaultValue); } /// Initialize the function. Calls declareAttributes & declareParameters diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index 3ee494be623..89574de2844 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -1084,7 +1084,7 @@ void MatrixWorkspace::flagMasked(const size_t &spectrumIndex, if (it != binList.end()) { binList.erase(it); } - binList.insert(std::make_pair(binIndex, weight)); + binList.emplace(binIndex, weight); } } diff --git a/Framework/API/src/SpectraAxis.cpp b/Framework/API/src/SpectraAxis.cpp index c89d9ee59a2..804ede10384 100644 --- a/Framework/API/src/SpectraAxis.cpp +++ b/Framework/API/src/SpectraAxis.cpp @@ -129,7 +129,7 @@ void SpectraAxis::getSpectraIndexMap(spec2index_map &map) const { throw std::runtime_error("getSpectraIndexMap(), zero elements"); map.clear(); for (size_t i = 0; i < nel; ++i) { - map.insert(std::make_pair(m_parentWS->getSpectrum(i)->getSpectrumNo(), i)); + map.emplace(m_parentWS->getSpectrum(i)->getSpectrumNo(), i); } } diff --git a/Framework/API/test/ExperimentInfoTest.h b/Framework/API/test/ExperimentInfoTest.h index da4aa3a1fad..7af46ba35c1 100644 --- a/Framework/API/test/ExperimentInfoTest.h +++ b/Framework/API/test/ExperimentInfoTest.h @@ -418,10 +418,8 @@ public: TS_ASSERT(det); // Set a mapping - std::vector<Mantid::detid_t> group(2, 1); - group[1] = 2; - Mantid::det2group_map mapping; - mapping.insert(std::make_pair(1, group)); + std::vector<Mantid::detid_t> group{1, 2}; + Mantid::det2group_map mapping{{1, group}}; exptInfo->cacheDetectorGroupings(mapping); TS_ASSERT_THROWS_NOTHING(det = exptInfo->getDetectorByID(1)); @@ -446,7 +444,7 @@ public: test_Setting_Group_Lookup_To_Non_Empty_Map_Allows_Retrieval_Of_Correct_IDs() { ExperimentInfo expt; std::map<Mantid::detid_t, std::vector<Mantid::detid_t>> mappings; - mappings.insert(std::make_pair(1, std::vector<Mantid::detid_t>(1, 2))); + mappings.emplace(1, std::vector<Mantid::detid_t>(1, 2)); expt.cacheDetectorGroupings(mappings); std::vector<Mantid::detid_t> ids; diff --git a/Framework/API/test/FileBackedExperimentInfoTest.h b/Framework/API/test/FileBackedExperimentInfoTest.h index 2927f133d02..9a5b1005b1f 100644 --- a/Framework/API/test/FileBackedExperimentInfoTest.h +++ b/Framework/API/test/FileBackedExperimentInfoTest.h @@ -120,7 +120,7 @@ public: std::vector<Mantid::detid_t> group(2, 1); group[1] = 2; Mantid::det2group_map mapping; - mapping.insert(std::make_pair(1, group)); + mapping.emplace(1, group); fileBacked->cacheDetectorGroupings(mapping); } @@ -130,7 +130,7 @@ public: std::vector<Mantid::detid_t> group(2, 1); group[1] = 2; Mantid::det2group_map mapping; - mapping.insert(std::make_pair(1, group)); + mapping.emplace(1, group); fileBacked->cacheDetectorGroupings(mapping); TS_ASSERT_EQUALS(group, fileBacked->getGroupMembers(1)); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h b/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h index 398a3a2c8b8..9aa20c7069d 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h @@ -35,15 +35,15 @@ public: @return filtered spectra-distance map. */ SpectraDistanceMap apply(SpectraDistanceMap &unfiltered) const { - SpectraDistanceMap::iterator it = unfiltered.begin(); SpectraDistanceMap neighbSpectra; - while (it != unfiltered.end()) { - // Strip out spectra that don't meet the radius criteria. - if (it->second.norm() <= m_cutoff) { - neighbSpectra.insert(std::make_pair(it->first, it->second)); - } - it++; - } + double cutoff{m_cutoff}; + std::copy_if( + unfiltered.begin(), unfiltered.end(), + std::inserter(neighbSpectra, neighbSpectra.end()), + [cutoff]( + const std::pair<specid_t, Mantid::Kernel::V3D> &spectraDistance) { + return spectraDistance.second.norm() <= cutoff; + }); return neighbSpectra; } diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index 9a79de853dd..de7ac665b05 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -507,9 +507,7 @@ void FilterEvents::createOutputWorkspaces() { if (m_hasInfoWS) { for (size_t ir = 0; ir < m_informationWS->rowCount(); ++ir) { API::TableRow row = m_informationWS->getRow(ir); - int &indexws = row.Int(0); - std::string &info = row.String(1); - infomap.insert(std::make_pair(indexws, info)); + infomap.emplace(row.Int(0), row.String(1)); } } @@ -558,7 +556,7 @@ void FilterEvents::createOutputWorkspaces() { "EventWorkspace", m_eventWS->getNumberHistograms(), 2, 1)); API::WorkspaceFactory::Instance().initializeFromParent(m_eventWS, optws, false); - m_outputWS.insert(std::make_pair(wsgroup, optws)); + m_outputWS.emplace(wsgroup, optws); // Add information, including title and comment, to output workspace if (m_hasInfoWS) { @@ -882,7 +880,7 @@ void FilterEvents::filterEventsBySplitters(double progressamount) { int index = wsiter->first; DataObjects::EventList *output_el = wsiter->second->getEventListPtr(iws); - outputs.insert(std::make_pair(index, output_el)); + outputs.emplace(index, output_el); } } @@ -984,7 +982,7 @@ void FilterEvents::filterEventsByVectorSplitters(double progressamount) { int index = wsiter->first; DataObjects::EventList *output_el = wsiter->second->getEventListPtr(iws); - outputs.insert(std::make_pair(index, output_el)); + outputs.emplace(index, output_el); } } diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index 5c1d9a29caf..d6a74c22e6c 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -729,7 +729,7 @@ void GenerateEventsFilter::processMultipleValueFilters(double minvalue, double curvalue = minvalue; while (curvalue - valuetolerance < maxvalue) { - indexwsindexmap.insert(std::make_pair(index, wsindex)); + indexwsindexmap.emplace(index, wsindex); // Log interval/value boundary double lowbound = curvalue - valuetolerance; diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp index 467bc87d061..4e80d861583 100644 --- a/Framework/Algorithms/src/GeneratePeaks.cpp +++ b/Framework/Algorithms/src/GeneratePeaks.cpp @@ -164,7 +164,7 @@ void GeneratePeaks::exec() { else { std::vector<std::pair<double, API::IFunction_sptr>> vecpeakfunc; importPeakFromVector(vecpeakfunc); - functionmap.insert(std::make_pair(m_wsIndex, vecpeakfunc)); + functionmap.emplace(m_wsIndex, vecpeakfunc); } generatePeaks(functionmap, outputWS); @@ -233,7 +233,7 @@ void GeneratePeaks::processAlgProperties(std::string &peakfunctype, if (!m_useFuncParamWS) { m_wsIndex = getProperty("WorkspaceIndex"); m_spectraSet.insert(static_cast<specid_t>(m_wsIndex)); - m_SpectrumMap.insert(std::make_pair(static_cast<specid_t>(m_wsIndex), 0)); + m_SpectrumMap.emplace(static_cast<specid_t>(m_wsIndex), 0); } return; @@ -333,7 +333,7 @@ void GeneratePeaks::importPeaksFromTable( std::pair<std::map<specid_t, std::vector<std::pair< double, API::IFunction_sptr>>>::iterator, bool> ret; - ret = functionmap.insert(std::make_pair(wsindex, tempvector)); + ret = functionmap.emplace(wsindex, tempvector); mapiter = ret.first; } @@ -655,7 +655,7 @@ void GeneratePeaks::getSpectraSet( std::set<specid_t>::iterator pit; specid_t icount = 0; for (pit = m_spectraSet.begin(); pit != m_spectraSet.end(); ++pit) { - m_SpectrumMap.insert(std::make_pair(*pit, icount)); + m_SpectrumMap.emplace(*pit, icount); ++icount; } diff --git a/Framework/Algorithms/src/MaskDetectorsIf.cpp b/Framework/Algorithms/src/MaskDetectorsIf.cpp index 5c32c363428..d4bdb1e9bb3 100644 --- a/Framework/Algorithms/src/MaskDetectorsIf.cpp +++ b/Framework/Algorithms/src/MaskDetectorsIf.cpp @@ -78,8 +78,9 @@ void MaskDetectorsIf::exec() { else { double val = inputW->readY(i)[0]; if (compar_f(val, value)) { - for (auto it = dets.cbegin(); it != dets.cend(); ++it) - umap.insert(std::make_pair(*it, select_on)); + for (auto det : dets) { + umap.emplace(det, select_on); + } } } double p = static_cast<double>(i) / static_cast<double>(nspec); diff --git a/Framework/Crystal/src/FindClusterFaces.cpp b/Framework/Crystal/src/FindClusterFaces.cpp index f8baf134b37..2ecedb4d4ec 100644 --- a/Framework/Crystal/src/FindClusterFaces.cpp +++ b/Framework/Crystal/src/FindClusterFaces.cpp @@ -53,7 +53,7 @@ createOptionalLabelFilter(size_t dimensionality, int emptyLabelId, const int labelIdAtPeakCenter = static_cast<int>(projection.signalAtPeakCenter(peak)); if (labelIdAtPeakCenter > emptyLabelId) { - allowedLabels.insert(std::make_pair(labelIdAtPeakCenter, i)); + allowedLabels.emplace(labelIdAtPeakCenter, i); } } optionalAllowedLabels = allowedLabels; diff --git a/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp b/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp index 2ee8477d083..cb61fa20d7a 100644 --- a/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp +++ b/Framework/Crystal/src/IntegratePeaksUsingClusters.cpp @@ -191,7 +191,7 @@ void IntegratePeaksUsingClusters::exec() { << " overlaps with another Peak: " << it->second << " and shares label id: " << it->first << std::endl; } - labelsTakenByPeaks.insert(std::make_pair(labelIdAtPeak, i)); + labelsTakenByPeaks.emplace(labelIdAtPeak, i); } progress.report(); } diff --git a/Framework/Crystal/src/SetSpecialCoordinates.cpp b/Framework/Crystal/src/SetSpecialCoordinates.cpp index bf462a03165..382760a0b91 100644 --- a/Framework/Crystal/src/SetSpecialCoordinates.cpp +++ b/Framework/Crystal/src/SetSpecialCoordinates.cpp @@ -40,12 +40,12 @@ SetSpecialCoordinates::SetSpecialCoordinates() { m_specialCoordinatesNames.push_back(SetSpecialCoordinates::QSampleOption()); m_specialCoordinatesNames.push_back(SetSpecialCoordinates::HKLOption()); - m_specialCoordinatesMap.insert(std::make_pair( - SetSpecialCoordinates::QLabOption(), Mantid::Kernel::QLab)); - m_specialCoordinatesMap.insert(std::make_pair( - SetSpecialCoordinates::QSampleOption(), Mantid::Kernel::QSample)); - m_specialCoordinatesMap.insert( - std::make_pair(SetSpecialCoordinates::HKLOption(), Mantid::Kernel::HKL)); + m_specialCoordinatesMap.emplace(SetSpecialCoordinates::QLabOption(), + Mantid::Kernel::QLab); + m_specialCoordinatesMap.emplace(SetSpecialCoordinates::QSampleOption(), + Mantid::Kernel::QSample); + m_specialCoordinatesMap.emplace(SetSpecialCoordinates::HKLOption(), + Mantid::Kernel::HKL); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/Crystal/src/SortHKL.cpp b/Framework/Crystal/src/SortHKL.cpp index bb836f26613..909c4398e70 100644 --- a/Framework/Crystal/src/SortHKL.cpp +++ b/Framework/Crystal/src/SortHKL.cpp @@ -238,7 +238,7 @@ std::map<V3D, UniqueReflection> SortHKL::getPossibleUniqueReflections( for (auto hkl : generator) { if (filter->isAllowed(hkl)) { V3D hklFamily = pointGroup->getReflectionFamily(hkl); - uniqueHKLs.insert(std::make_pair(hklFamily, UniqueReflection(hklFamily))); + uniqueHKLs.emplace(hklFamily, UniqueReflection(hklFamily)); } } diff --git a/Framework/Crystal/test/SortHKLTest.h b/Framework/Crystal/test/SortHKLTest.h index 4a78e6ef121..d951e857043 100644 --- a/Framework/Crystal/test/SortHKLTest.h +++ b/Framework/Crystal/test/SortHKLTest.h @@ -149,9 +149,8 @@ public: } void test_PeaksStatisticsOneObservation() { - std::map<V3D, UniqueReflection> uniques; - uniques.insert(std::make_pair(V3D(1, 1, 1), - getReflectionWithPeaks({56.0}, {4.5}, 1.0))); + std::map<V3D, UniqueReflection> uniques{ + {V3D(1, 1, 1), getReflectionWithPeaks({56.0}, {4.5}, 1.0)}}; PeaksStatistics statistics(uniques, 1); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 1); @@ -166,11 +165,9 @@ public: } void test_PeaksStatisticsOneObservationTwoUnique() { - std::map<V3D, UniqueReflection> uniques; - uniques.insert(std::make_pair(V3D(1, 1, 1), - getReflectionWithPeaks({56.0}, {4.5}, 1.0))); - uniques.insert( - std::make_pair(V3D(1, 1, 2), UniqueReflection(V3D(1, 1, 2)))); + std::map<V3D, UniqueReflection> uniques{ + {V3D(1, 1, 1), getReflectionWithPeaks({56.0}, {4.5}, 1.0)}, + {V3D(1, 1, 2), UniqueReflection(V3D(1, 1, 2))}}; PeaksStatistics statistics(uniques, 1); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 1); @@ -186,11 +183,9 @@ public: void test_PeaksStatisticsTwoObservationTwoUnique() { - std::map<V3D, UniqueReflection> uniques; - uniques.insert(std::make_pair(V3D(1, 1, 1), - getReflectionWithPeaks({10.0}, {1.0}, 1.0))); - uniques.insert(std::make_pair(V3D(1, 1, 2), - getReflectionWithPeaks({20.0}, {1.0}, 2.0))); + std::map<V3D, UniqueReflection> uniques{ + {V3D(1, 1, 1), getReflectionWithPeaks({10.0}, {1.0}, 1.0)}, + {V3D(1, 1, 2), getReflectionWithPeaks({20.0}, {1.0}, 2.0)}}; PeaksStatistics statistics(uniques, 2); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 2); @@ -205,9 +200,8 @@ public: } void test_PeaksStatisticsTwoObservationOneUnique() { - std::map<V3D, UniqueReflection> uniques; - uniques.insert(std::make_pair( - V3D(1, 1, 1), getReflectionWithPeaks({10.0, 20.0}, {0.1, 0.1}, 1.0))); + std::map<V3D, UniqueReflection> uniques{ + {V3D(1, 1, 1), getReflectionWithPeaks({10.0, 20.0}, {0.1, 0.1}, 1.0)}}; PeaksStatistics statistics(uniques, 2); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 2); @@ -224,10 +218,9 @@ public: } void test_PeaksStatisticsThreeObservationOneUnique() { - std::map<V3D, UniqueReflection> uniques; - uniques.insert(std::make_pair( - V3D(1, 1, 1), - getReflectionWithPeaks({10.0, 20.0, 15.0}, {0.1, 0.1, 0.1}, 1.0))); + std::map<V3D, UniqueReflection> uniques{ + {V3D(1, 1, 1), + getReflectionWithPeaks({10.0, 20.0, 15.0}, {0.1, 0.1, 0.1}, 1.0)}}; PeaksStatistics statistics(uniques, 3); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 3); diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index 638606c9483..cfa690217e7 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -1664,8 +1664,7 @@ void FitPowderDiffPeaks::storeFunctionParameters( vector<string> paramnames = function->getParameterNames(); parammaps.clear(); for (size_t i = 0; i < paramnames.size(); ++i) - parammaps.insert( - make_pair(paramnames[i], function->getParameter(paramnames[i]))); + parammaps.emplace(paramnames[i], function->getParameter(paramnames[i])); return; } @@ -2345,7 +2344,7 @@ void FitPowderDiffPeaks::importInstrumentParameterFromTable( for (size_t ir = 0; ir < numrows; ++ir) { API::TableRow trow = parameterWS->getRow(ir); trow >> parname >> value; - m_instrumentParmaeters.insert(std::make_pair(parname, value)); + m_instrumentParmaeters.emplace(parname, value); g_log.notice() << "[DBx211] Import parameter " << parname << ": " << value << endl; } diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 5be45298bda..cbdb9a8e5a7 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -976,7 +976,7 @@ void LeBailFit::parseInstrumentParametersTable() { trow >> dblvalue; g_log.debug() << "Value = " << dblvalue << ".\n"; ; - tempdblmap.insert(std::make_pair(colname, dblvalue)); + tempdblmap.emplace(colname, dblvalue); } else { // string data g_log.debug() << "Col-name = " << colname << ", "; @@ -987,7 +987,7 @@ void LeBailFit::parseInstrumentParametersTable() { strvalue.end()); g_log.debug() << "Value = " << strvalue << ".\n"; - tempstrmap.insert(std::make_pair(colname, strvalue)); + tempstrmap.emplace(colname, strvalue); } } @@ -1072,9 +1072,8 @@ void LeBailFit::parseInstrumentParametersTable() { newparameter.minrecordvalue = newparameter.maxvalue + 1.0; newparameter.maxrecordvalue = newparameter.minvalue - 1.0; - m_funcParameters.insert(std::make_pair(newparameter.name, newparameter)); - m_origFuncParameters.insert( - std::make_pair(newparameter.name, newparameter.curvalue)); + m_funcParameters.emplace(newparameter.name, newparameter); + m_origFuncParameters.emplace(newparameter.name, newparameter.curvalue); g_log.information() << "Inserting Parameter " << newparameter.name << " = " << newparameter.curvalue << ".\n"; @@ -1219,7 +1218,7 @@ void LeBailFit::parseBackgroundTableWorkspace(TableWorkspace_sptr bkgdparamws, if (parname.size() > 0 && (parname[0] == 'A' || parname == "Bkpos")) { // Insert parameter name starting with A or Bkpos (special case for // FullprofPolynomial) - parmap.insert(std::make_pair(parname, parvalue)); + parmap.emplace(parname, parvalue); } } @@ -2663,7 +2662,7 @@ LeBailFit::convertToDoubleMap(std::map<std::string, Parameter> &inmap) { std::map<std::string, double> outmap; std::map<std::string, Parameter>::iterator miter; for (miter = inmap.begin(); miter != inmap.end(); ++miter) { - outmap.insert(std::make_pair(miter->first, miter->second.curvalue)); + outmap.emplace(miter->first, miter->second.curvalue); } return outmap; diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index 168180b854a..9b145702e2b 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -990,7 +990,7 @@ void RefinePowderInstrumentParameters::importParametersFromTable( try { API::TableRow trow = parameterWS->getRow(ir); trow >> parname >> value; - parameters.insert(std::make_pair(parname, value)); + parameters.emplace(parname, value); } catch (runtime_error &) { g_log.error() << "Import table workspace " << parameterWS->name() << " error in line " << ir << ". " diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index d8c3ee728ba..cf95f145efd 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -295,7 +295,7 @@ void RefinePowderInstrumentParameters3::parseTableWorkspace( } newpar.fit = fit; - parammap.insert(make_pair(parname, newpar)); + parammap.emplace(parname, newpar); } return; @@ -1114,7 +1114,7 @@ void RefinePowderInstrumentParameters3::addOrReplace( Parameter newparameter; newparameter.name = parname; newparameter.curvalue = parvalue; - parameters.insert(make_pair(parname, newparameter)); + parameters.emplace(parname, newparameter); } return; @@ -1317,7 +1317,7 @@ void duplicateParameters(map<string, Parameter> source, Parameter param = miter->second; Parameter newparam; newparam = param; - target.insert(make_pair(parname, newparam)); + target.emplace(parname, newparam); } return; @@ -1360,7 +1360,7 @@ void convertToDict(vector<string> strvec, map<string, size_t> &lookupdict) { lookupdict.clear(); for (size_t i = 0; i < strvec.size(); ++i) - lookupdict.insert(make_pair(strvec[i], i)); + lookupdict.emplace(strvec[i], i); return; } @@ -1397,7 +1397,7 @@ void storeFunctionParameterValue( string &parname = parnames[i]; double parvalue = function->getParameter(i); double parerror = function->getError(i); - parvaluemap.insert(make_pair(parname, make_pair(parvalue, parerror))); + parvaluemap.emplace(parname, make_pair(parvalue, parerror)); } return; diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h index c31641d8af5..09452dbd59c 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h @@ -222,11 +222,8 @@ public: lebailfunction.function(out, vecX, true, false); TS_ASSERT_THROWS_ANYTHING(lebailfunction.function(out, vecX, true, true)); - /* - map<string, double> bkgdparmap; - bkgdparmap.insert(make_pair("A0", 0.001)); - bkgdparmap.insert(make_pair("A1", 0.)); - */ + // map<string, double> bkgdparmap {{"A0", 0.001},{"A1", 0.}}; + vector<string> vecbkgdparnames(2); vecbkgdparnames[0] = "A0"; vecbkgdparnames[1] = "A1"; @@ -255,38 +252,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); @@ -339,26 +336,19 @@ public: LeBailFunction lebailfunction("NeutronBk2BkExpConvPVoigt"); // Add peak parameters - map<string, double> parammap; - - parammap.insert(make_pair("Dtt1", 16370.650)); - parammap.insert(make_pair("Dtt2", 0.10)); - parammap.insert(make_pair("Zero", 0.0)); + map<string, double> parammap - 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)); + {{"Dtt1", 16370.650}, {"Dtt2", 0.10}, + {"Zero", 0.0}, - parammap.insert(make_pair("Sig2", sqrt(91.127))); - parammap.insert(make_pair("Sig1", sqrt(1119.230))); - parammap.insert(make_pair("Sig0", sqrt(0.0))); + {"Alph0", 1.0}, {"Alph1", 0.0}, + {"Beta0", 0.109036}, {"Beta1", 0.009834}, - parammap.insert(make_pair("Gam0", 0.0)); - parammap.insert(make_pair("Gam1", 7.688)); - parammap.insert(make_pair("Gam2", 0.0)); + {"Sig2", sqrt(91.127)}, {"Sig1", sqrt(1119.230)}, + {"Sig0", sqrt(0.0)}, - parammap.insert(make_pair("LatticeConstant", 5.431363)); + {"Gam0", 0.0}, {"Gam1", 7.688}, + {"Gam2", 0.0}, {"LatticeConstant", 5.431363}}; lebailfunction.setProfileParameterValues(parammap); diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h index dedf1a1c02d..1118898beaf 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h @@ -399,7 +399,7 @@ public: double parvalue; row >> parname >> parvalue; - paramvalues.insert(std::make_pair(parname, parvalue)); + paramvalues.emplace(parname, parvalue); } return; diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index 4172459e6d4..f062c8a9cb8 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -42,8 +42,7 @@ public: */ void Passed_test_FitZero() { // 1. Generate testing workspace - std::map<std::string, double> newparamvalues; - newparamvalues.insert(std::make_pair("Tcross", 0.5)); + std::map<std::string, double> newparamvalues{{"Tcross", 0.5}}; // This is the output from FitPowderDiffPeaks() std::string peakfilename("/home/wzz/Mantid/Code/debug/MyTestData/" @@ -473,7 +472,7 @@ public: std::stringstream ss; ss.str(line); ss >> parname >> parvalue; - parameters.insert(std::make_pair(parname, parvalue)); + parameters.emplace(parname, parvalue); try { ss >> parmin >> parmax >> parstepsize; @@ -504,7 +503,7 @@ public: double parvalue; row >> parname >> parvalue; - paramvalues.insert(std::make_pair(parname, parvalue)); + paramvalues.emplace(parname, parvalue); } return; diff --git a/Framework/CurveFitting/test/IPeakFunctionCentreParameterNameTest.h b/Framework/CurveFitting/test/IPeakFunctionCentreParameterNameTest.h index d64274a8f6a..2d19fed5347 100644 --- a/Framework/CurveFitting/test/IPeakFunctionCentreParameterNameTest.h +++ b/Framework/CurveFitting/test/IPeakFunctionCentreParameterNameTest.h @@ -23,11 +23,11 @@ public: IPeakFunctionCentreParameterNameTest() { FrameworkManager::Instance(); - m_expectedResults.insert(std::make_pair("Gaussian", "PeakCentre")); - m_expectedResults.insert(std::make_pair("Lorentzian", "PeakCentre")); - m_expectedResults.insert(std::make_pair("IkedaCarpenterPV", "X0")); - m_expectedResults.insert(std::make_pair("Voigt", "LorentzPos")); - m_expectedResults.insert(std::make_pair("BackToBackExponential", "X0")); + m_expectedResults.emplace("Gaussian", "PeakCentre"); + m_expectedResults.emplace("Lorentzian", "PeakCentre"); + m_expectedResults.emplace("IkedaCarpenterPV", "X0"); + m_expectedResults.emplace("Voigt", "LorentzPos"); + m_expectedResults.emplace("BackToBackExponential", "X0"); } /* Test that all functions give the expected result. @@ -35,8 +35,8 @@ public: void testAllFunctions() { for (auto it = m_expectedResults.begin(); it != m_expectedResults.end(); ++it) { - std::string peakFunctionName = it->first; - std::string centreParameterName = it->second; + const std::string &peakFunctionName = it->first; + const std::string ¢reParameterName = it->second; IPeakFunction_sptr fn = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction(peakFunctionName)); diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 5fb850d4c53..f3388a94e41 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -510,16 +510,13 @@ void GroupDetectors2::processXMLFile(std::string fname, loader.getGroupSpectraMap(); // 3. Build m_GroupSpecInds - std::map<int, std::vector<detid_t>>::iterator dit; - for (dit = mGroupDetectorsMap.begin(); dit != mGroupDetectorsMap.end(); + for (auto dit = mGroupDetectorsMap.begin(); dit != mGroupDetectorsMap.end(); ++dit) { - int groupid = dit->first; - std::vector<size_t> tempv; - m_GroupSpecInds.insert(std::make_pair(groupid, tempv)); + m_GroupSpecInds.emplace(dit->first, std::vector<size_t>()); } // 4. Detector IDs - for (dit = mGroupDetectorsMap.begin(); dit != mGroupDetectorsMap.end(); + for (auto dit = mGroupDetectorsMap.begin(); dit != mGroupDetectorsMap.end(); ++dit) { int groupid = dit->first; std::vector<detid_t> detids = dit->second; @@ -603,7 +600,7 @@ void GroupDetectors2::processGroupingWorkspace( if (groupid > 0) { if (group2WSIndexSetmap.find(groupid) == group2WSIndexSetmap.end()) { // not found - create an empty set - group2WSIndexSetmap.insert(std::make_pair(groupid, std::set<size_t>())); + group2WSIndexSetmap.emplace(groupid, std::set<size_t>()); } // get a reference to the set std::set<size_t> &targetWSIndexSet = group2WSIndexSetmap[groupid]; @@ -674,7 +671,7 @@ void GroupDetectors2::processMatrixWorkspace( if (group2WSIndexSetmap.find(groupid) == group2WSIndexSetmap.end()) { // not found - create an empty set - group2WSIndexSetmap.insert(std::make_pair(groupid, std::set<size_t>())); + group2WSIndexSetmap.emplace(groupid, std::set<size_t>()); } // get a reference to the set std::set<size_t> &targetWSIndexSet = group2WSIndexSetmap[groupid]; diff --git a/Framework/DataHandling/src/LoadDspacemap.cpp b/Framework/DataHandling/src/LoadDspacemap.cpp index 4aaf2df7c86..8af2ae387a1 100644 --- a/Framework/DataHandling/src/LoadDspacemap.cpp +++ b/Framework/DataHandling/src/LoadDspacemap.cpp @@ -343,7 +343,7 @@ void LoadDspacemap::readVulcanAsciiFile(const std::string &fileName, int32_t udet; double correction; istr >> udet >> correction; - vulcan.insert(std::make_pair(udet, correction)); + vulcan.emplace(udet, correction); numentries++; } diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index f305c440ba7..592c3b8e900 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -191,7 +191,7 @@ void LoadFullprofResolution::exec() { parseResolutionStrings(parammap, lines, useBankIDsInFile, bankid, bankstartindexmap[bankid], bankendindexmap[bankid], nProf); - bankparammap.insert(make_pair(bankid, parammap)); + bankparammap.emplace(bankid, parammap); } // Generate output table workspace @@ -328,8 +328,8 @@ void LoadFullprofResolution::scanBanks(const vector<string> &lines, // Previous line is in a bank range. Then finish the previous bank // range endindex = static_cast<int>(i) - 1; - bankstartindexmap.insert(make_pair(banks.back(), startindex)); - bankendindexmap.insert(make_pair(banks.back(), endindex)); + bankstartindexmap.emplace(banks.back(), startindex); + bankendindexmap.emplace(banks.back(), endindex); } // Start the new pair @@ -353,8 +353,8 @@ void LoadFullprofResolution::scanBanks(const vector<string> &lines, } if (startindex >= 0) { endindex = static_cast<int>(lines.size()) - 1; - bankstartindexmap.insert(make_pair(banks.back(), startindex)); - bankendindexmap.insert(make_pair(banks.back(), endindex)); + bankstartindexmap.emplace(banks.back(), startindex); + bankendindexmap.emplace(banks.back(), endindex); } g_log.debug() << "[DB1112] Number of bank IDs = " << banks.size() << ", " @@ -1060,7 +1060,7 @@ void LoadFullprofResolution::getTableRowNumbers( TableRow row = tablews->getRow(i); std::string name; row >> name; - parammap.insert(std::make_pair(name, i)); + parammap.emplace(name, i); } return; diff --git a/Framework/DataHandling/src/LoadSpiceAscii.cpp b/Framework/DataHandling/src/LoadSpiceAscii.cpp index 539dabf7c7e..8001c96a214 100644 --- a/Framework/DataHandling/src/LoadSpiceAscii.cpp +++ b/Framework/DataHandling/src/LoadSpiceAscii.cpp @@ -286,7 +286,7 @@ void LoadSpiceAscii::parseSPICEAscii( << "' is hard to parse. It has more than 1 '='."; g_log.warning(wss.str()); } - runinfodict.insert(std::make_pair(terms[0], infovalue)); + runinfodict.emplace(terms[0], infovalue); } else if (line.find("Pt.") != std::string::npos) { // Title line boost::split(titles, line, boost::is_any_of("\t\n "), @@ -297,7 +297,7 @@ void LoadSpiceAscii::parseSPICEAscii( boost::algorithm::first_finder("scan completed.")); std::string time = terms.front(); boost::trim(time); - runinfodict.insert(std::make_pair("runend", time)); + runinfodict.emplace("runend", time); } else { // Not supported std::stringstream wss; diff --git a/Framework/DataHandling/src/LoadVulcanCalFile.cpp b/Framework/DataHandling/src/LoadVulcanCalFile.cpp index 1db822e8ec8..e2d0a2f1e46 100644 --- a/Framework/DataHandling/src/LoadVulcanCalFile.cpp +++ b/Framework/DataHandling/src/LoadVulcanCalFile.cpp @@ -169,7 +169,7 @@ void LoadVulcanCalFile::processInOutProperites() { double theta = 0.5 * vec_2thetas[i]; double effl = difc / (252.777 * 2.0 * sin(theta / 180. * M_PI)); - m_effLTheta.insert(make_pair(bankid, make_pair(effl, theta))); + m_effLTheta.emplace(bankid, make_pair(effl, theta)); } // Create offset workspace @@ -365,7 +365,7 @@ void LoadVulcanCalFile::readOffsetFile( if (!(iss >> pid >> offset)) continue; detid_t detid = static_cast<detid_t>(pid); - map_detoffset.insert(make_pair(detid, offset)); + map_detoffset.emplace(detid, offset); } return; @@ -386,7 +386,7 @@ void LoadVulcanCalFile::processOffsets( detid_t tmpid = det->getID(); // Map between detector ID and workspace index - map_det2index.insert(make_pair(tmpid, i)); + map_det2index.emplace(tmpid, i); } // Map from VULCAN offset to Mantid instrument: Validate @@ -398,7 +398,7 @@ void LoadVulcanCalFile::processOffsets( detid_t pid = miter->first; auto fiter = map_det2index.find(pid); if (fiter == map_det2index.end()) { - map_verify.insert(make_pair(pid, make_pair(false, -1))); + map_verify.emplace(pid, make_pair(false, -1)); } else { size_t wsindex = fiter->second; // Get bank ID from instrument tree @@ -413,7 +413,7 @@ void LoadVulcanCalFile::processOffsets( int bank = atoi(terms2.back().c_str()); set_bankID.insert(bank); - map_verify.insert(make_pair(pid, make_pair(true, bank))); + map_verify.emplace(pid, make_pair(true, bank)); } } @@ -481,7 +481,7 @@ void LoadVulcanCalFile::processOffsets( globalfactor += intermodulelogcorr; } - map_bankLogCorr.insert(make_pair(bankid, globalfactor)); + map_bankLogCorr.emplace(bankid, globalfactor); } // Calcualte the offset for each detector (log now still) diff --git a/Framework/DataHandling/src/SaveFullprofResolution.cpp b/Framework/DataHandling/src/SaveFullprofResolution.cpp index 5ef18d5b0db..cc0dcb715db 100644 --- a/Framework/DataHandling/src/SaveFullprofResolution.cpp +++ b/Framework/DataHandling/src/SaveFullprofResolution.cpp @@ -224,7 +224,7 @@ void SaveFullprofResolution::parseTableWorkspace() { for (size_t ir = 0; ir < numpars; ++ir) { double parvalue = m_profileTableWS->cell<double>(ir, static_cast<size_t>(colindex)); - m_profileParamMap.insert(std::make_pair(vec_parnames[ir], parvalue)); + m_profileParamMap.emplace(vec_parnames[ir], parvalue); } // Debug output diff --git a/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp b/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp index 04f7103e3cb..3fb67336d09 100644 --- a/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp +++ b/Framework/DataHandling/src/UpdateInstrumentFromFile.cpp @@ -340,7 +340,7 @@ bool UpdateInstrumentFromFile::parseAsciiHeader( continue; } else { headerInfo.detParCols.insert(counter); - headerInfo.colToName.insert(std::make_pair(counter, colName)); + headerInfo.colToName.emplace(counter, colName); } ++counter; } diff --git a/Framework/DataHandling/test/SaveFullprofResolutionTest.h b/Framework/DataHandling/test/SaveFullprofResolutionTest.h index c2da2add45e..274fba17330 100644 --- a/Framework/DataHandling/test/SaveFullprofResolutionTest.h +++ b/Framework/DataHandling/test/SaveFullprofResolutionTest.h @@ -257,35 +257,17 @@ public: */ void createProfile10TableWS(std::string wsname) { // Create a map of string/double for parameters of profile 10 - std::map<std::string, double> parammap; - parammap.insert(make_pair("BANK", 1)); - parammap.insert(make_pair("Alph0", 1.88187)); - parammap.insert(make_pair("Alph0t", 64.4102)); - parammap.insert(make_pair("Alph1", 0.)); - parammap.insert(make_pair("Alph1t", 0.)); - parammap.insert(make_pair("Beta0", 6.2511)); - parammap.insert(make_pair("Beta0t", 85.9189)); - parammap.insert(make_pair("Beta1", 0.)); - parammap.insert(make_pair("Beta1t", 0.)); - parammap.insert(make_pair("CWL", 0.533)); - parammap.insert(make_pair("Dtt1", 22584.5)); - parammap.insert(make_pair("Dtt1t", 22604.9)); - parammap.insert(make_pair("Dtt2", 0)); - parammap.insert(make_pair("Dtt2t", 0.3)); - parammap.insert(make_pair("Gam0", 0)); - parammap.insert(make_pair("Gam1", 5.744)); - parammap.insert(make_pair("Gam2", 0)); - parammap.insert(make_pair("Sig0", 0)); - parammap.insert(make_pair("Sig1", 3.16228)); - parammap.insert(make_pair("Sig2", 16.7331)); - parammap.insert(make_pair("Tcross", 0.356)); - parammap.insert(make_pair("Width", 1.0521)); - parammap.insert(make_pair("Zero", 0)); - parammap.insert(make_pair("Zerot", 11.3175)); - parammap.insert(make_pair("step", 4.0002)); - parammap.insert(make_pair("tof-max", 51000)); - parammap.insert(make_pair("tof-min", 5000.23)); - parammap.insert(make_pair("twotheta", 90.0)); + std::map<std::string, double> parammap{ + {"BANK", 1.}, {"Alph0", 1.88187}, {"Alph0t", 64.4102}, + {"Alph1", 0.}, {"Alph1t", 0.}, {"Beta0", 6.2511}, + {"Beta0t", 85.9189}, {"Beta1", 0.}, {"Beta1t", 0.}, + {"CWL", 0.533}, {"Dtt1", 22584.5}, {"Dtt1t", 22604.9}, + {"Dtt2", 0.}, {"Dtt2t", 0.3}, {"Gam0", 0.}, + {"Gam1", 5.744}, {"Gam2", 0.}, {"Sig0", 0.}, + {"Sig1", 3.16228}, {"Sig2", 16.7331}, {"Tcross", 0.356}, + {"Width", 1.0521}, {"Zero", 0.}, {"Zerot", 11.3175}, + {"step", 4.0002}, {"tof-max", 51000.}, {"tof-min", 5000.23}, + {"twotheta", 90.0}}; // Crate table workspace DataObjects::TableWorkspace_sptr geomws = diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp index 3d47ad357ac..e98ef97480f 100644 --- a/Framework/DataObjects/src/PeakColumn.cpp +++ b/Framework/DataObjects/src/PeakColumn.cpp @@ -36,23 +36,23 @@ const std::string typeFromName(const std::string &name) { if (TYPE_INDEX.empty()) // check again inside the critical block { // Assume double if not in this map - TYPE_INDEX.insert(std::make_pair("DetID", "int")); - TYPE_INDEX.insert(std::make_pair("RunNumber", "int")); - TYPE_INDEX.insert(std::make_pair("h", "double")); - TYPE_INDEX.insert(std::make_pair("k", "double")); - TYPE_INDEX.insert(std::make_pair("l", "double")); - TYPE_INDEX.insert(std::make_pair("Wavelength", "double")); - TYPE_INDEX.insert(std::make_pair("Energy", "double")); - TYPE_INDEX.insert(std::make_pair("TOF", "double")); - TYPE_INDEX.insert(std::make_pair("DSpacing", "double")); - TYPE_INDEX.insert(std::make_pair("Intens", "double")); - TYPE_INDEX.insert(std::make_pair("SigInt", "double")); - TYPE_INDEX.insert(std::make_pair("BinCount", "double")); - TYPE_INDEX.insert(std::make_pair("BankName", "str")); - TYPE_INDEX.insert(std::make_pair("Row", "double")); - TYPE_INDEX.insert(std::make_pair("Col", "double")); - TYPE_INDEX.insert(std::make_pair("QLab", "V3D")); - TYPE_INDEX.insert(std::make_pair("QSample", "V3D")); + TYPE_INDEX.emplace("DetID", "int"); + TYPE_INDEX.emplace("RunNumber", "int"); + TYPE_INDEX.emplace("h", "double"); + TYPE_INDEX.emplace("k", "double"); + TYPE_INDEX.emplace("l", "double"); + TYPE_INDEX.emplace("Wavelength", "double"); + TYPE_INDEX.emplace("Energy", "double"); + TYPE_INDEX.emplace("TOF", "double"); + TYPE_INDEX.emplace("DSpacing", "double"); + TYPE_INDEX.emplace("Intens", "double"); + TYPE_INDEX.emplace("SigInt", "double"); + TYPE_INDEX.emplace("BinCount", "double"); + TYPE_INDEX.emplace("BankName", "str"); + TYPE_INDEX.emplace("Row", "double"); + TYPE_INDEX.emplace("Col", "double"); + TYPE_INDEX.emplace("QLab", "V3D"); + TYPE_INDEX.emplace("QSample", "V3D"); // If adding an entry, be sure to increment the size comparizon in the // first line } diff --git a/Framework/Geometry/src/Crystal/PointGroup.cpp b/Framework/Geometry/src/Crystal/PointGroup.cpp index 0483dfd561c..1f614664120 100644 --- a/Framework/Geometry/src/Crystal/PointGroup.cpp +++ b/Framework/Geometry/src/Crystal/PointGroup.cpp @@ -227,7 +227,7 @@ PointGroupCrystalSystemMap getPointGroupsByCrystalSystem() { std::vector<PointGroup_sptr> pointGroups = getAllPointGroups(); for (size_t i = 0; i < pointGroups.size(); ++i) { - map.insert(std::make_pair(pointGroups[i]->crystalSystem(), pointGroups[i])); + map.emplace(pointGroups[i]->crystalSystem(), pointGroups[i]); } return map; diff --git a/Framework/Geometry/src/Crystal/PointGroupFactory.cpp b/Framework/Geometry/src/Crystal/PointGroupFactory.cpp index e04b913c429..5b400aa8fd6 100644 --- a/Framework/Geometry/src/Crystal/PointGroupFactory.cpp +++ b/Framework/Geometry/src/Crystal/PointGroupFactory.cpp @@ -150,7 +150,7 @@ void PointGroupFactoryImpl::subscribe( throw std::runtime_error("Cannot register null-generator."); } - m_generatorMap.insert(std::make_pair(generator->getHMSymbol(), generator)); + m_generatorMap.emplace(generator->getHMSymbol(), generator); } PointGroup_sptr PointGroupFactoryImpl::constructFromPrototype( diff --git a/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp b/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp index 1d3917cd762..79ac6a2b981 100644 --- a/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp +++ b/Framework/Geometry/src/Crystal/SpaceGroupFactory.cpp @@ -288,9 +288,8 @@ void SpaceGroupFactoryImpl::subscribe( throw std::runtime_error("Cannot register null-generator."); } - m_numberMap.insert( - std::make_pair(generator->getNumber(), generator->getHMSymbol())); - m_generatorMap.insert(std::make_pair(generator->getHMSymbol(), generator)); + m_numberMap.emplace(generator->getNumber(), generator->getHMSymbol()); + m_generatorMap.emplace(generator->getHMSymbol(), generator); // Clear the point group map m_pointGroupMap.clear(); diff --git a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp index 6c98097cca3..9affcebe874 100644 --- a/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryElementFactory.cpp @@ -391,7 +391,7 @@ AbstractSymmetryElementGenerator_sptr SymmetryElementFactoryImpl::getGenerator( /// Inserts the provided prototype into the factory. void SymmetryElementFactoryImpl::insertPrototype( const std::string &identifier, const SymmetryElement_sptr &prototype) { - m_prototypes.insert(std::make_pair(identifier, prototype)); + m_prototypes.emplace(identifier, prototype); } DECLARE_SYMMETRY_ELEMENT_GENERATOR(SymmetryElementIdentityGenerator) diff --git a/Framework/Geometry/src/Crystal/SymmetryOperationFactory.cpp b/Framework/Geometry/src/Crystal/SymmetryOperationFactory.cpp index eb2ce9ebeb1..9cef464466e 100644 --- a/Framework/Geometry/src/Crystal/SymmetryOperationFactory.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryOperationFactory.cpp @@ -78,7 +78,7 @@ SymmetryOperationFactoryImpl::subscribedSymbols() const { void SymmetryOperationFactoryImpl::subscribe( const std::string &alias, const SymmetryOperation &prototype) { if (!isSubscribed(alias)) { - m_prototypes.insert(std::make_pair(alias, prototype)); + m_prototypes.emplace(alias, prototype); } } diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index fec0c50da5f..0f2811e906c 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -2073,7 +2073,7 @@ void InstrumentDefinitionParser::setLogfile( logfileID, value, interpolation, formula, formulaUnit, resultUnit, paramName, type, tie, constraint, penaltyFactor, fittingFunction, extractSingleValueAs, eq, comp, m_angleConvertConst, description)); - auto inserted = logfileCache.insert(std::make_pair(cacheKey, cacheValue)); + auto inserted = logfileCache.emplace(cacheKey, cacheValue); if (!inserted.second) { logfileCache[cacheKey] = cacheValue; } diff --git a/Framework/Geometry/src/Instrument/NearestNeighbours.cpp b/Framework/Geometry/src/Instrument/NearestNeighbours.cpp index 40a7ea642f3..81cc6de83ad 100644 --- a/Framework/Geometry/src/Instrument/NearestNeighbours.cpp +++ b/Framework/Geometry/src/Instrument/NearestNeighbours.cpp @@ -256,7 +256,7 @@ std::map<specid_t, IDetector_const_sptr> NearestNeighbours::getSpectraDetectors( // Always ignore monitors and ignore masked detectors if requested. bool heedMasking = !m_bIgnoreMaskedDetectors && det->isMasked(); if (!det->isMonitor() && !heedMasking) { - spectra.insert(std::make_pair(citr->first, det)); + spectra.emplace(citr->first, det); } } return spectra; diff --git a/Framework/Geometry/src/Instrument/ParameterMap.cpp b/Framework/Geometry/src/Instrument/ParameterMap.cpp index f491db4d599..ff55a3a0f5e 100644 --- a/Framework/Geometry/src/Instrument/ParameterMap.cpp +++ b/Framework/Geometry/src/Instrument/ParameterMap.cpp @@ -344,7 +344,7 @@ void ParameterMap::add(const IComponent *comp, if (existing_par != m_map.end()) { existing_par->second = par; } else { - m_map.insert(std::make_pair(comp->getComponentID(), par)); + m_map.emplace(comp->getComponentID(), par); } } } @@ -1049,9 +1049,11 @@ void ParameterMap::copyFromParameterMap(const IComponent *oldComp, for (auto it = oldParameterNames.begin(); it != oldParameterNames.end(); ++it) { - Parameter_sptr thisParameter = oldPMap->get(oldComp, *it); - // Insert the fetched parameter in the m_map - m_map.insert(std::make_pair(newComp->getComponentID(), thisParameter)); + for (const auto ¶meterName : oldParameterNames) { + // Insert the fetched parameter in the m_map + m_map.emplace(newComp->getComponentID(), + oldPMap->get(oldComp, parameterName)); + } } } diff --git a/Framework/Geometry/src/Instrument/XMLInstrumentParameter.cpp b/Framework/Geometry/src/Instrument/XMLInstrumentParameter.cpp index cb96ddc2ab0..b0e3dd3703f 100644 --- a/Framework/Geometry/src/Instrument/XMLInstrumentParameter.cpp +++ b/Framework/Geometry/src/Instrument/XMLInstrumentParameter.cpp @@ -119,16 +119,14 @@ double XMLInstrumentParameter::createParamValue( typedef std::map<std::string, Kernel::Math::StatisticType> StatisticsMapType; StatisticsMapType statistics_types; - statistics_types.insert( - std::make_pair("first_value", Kernel::Math::FirstValue)); - statistics_types.insert( - std::make_pair("last_value", Kernel::Math::LastValue)); - statistics_types.insert(std::make_pair("maximum", Kernel::Math::Maximum)); - // statistics_types.insert(std::make_pair("mean", Kernel::Math::Mean)); + statistics_types.emplace("first_value", Kernel::Math::FirstValue); + statistics_types.emplace("last_value", Kernel::Math::LastValue); + statistics_types.emplace("maximum", Kernel::Math::Maximum); + // statistics_types.emplace("mean", Kernel::Math::Mean); // //TODO, would conflict with the existing "mean" flag, which corresponds // to time_averaged_mean - statistics_types.insert(std::make_pair("median", Kernel::Math::Median)); - statistics_types.insert(std::make_pair("minimum", Kernel::Math::Minimum)); + statistics_types.emplace("median", Kernel::Math::Median); + statistics_types.emplace("minimum", Kernel::Math::Minimum); StatisticsMapType::const_iterator statisics_choice = statistics_types.find(m_extractSingleValueAs); const bool bUsingStandardStatistics = diff --git a/Framework/Kernel/src/FacilityInfo.cpp b/Framework/Kernel/src/FacilityInfo.cpp index e652d906647..d7c68818899 100644 --- a/Framework/Kernel/src/FacilityInfo.cpp +++ b/Framework/Kernel/src/FacilityInfo.cpp @@ -9,7 +9,8 @@ #include "MantidKernel/Logger.h" #include "MantidKernel/Strings.h" -#include <boost/algorithm/string.hpp> +#include "boost/algorithm/string.hpp" +#include "boost/make_shared.hpp" #include <Poco/DOM/Element.h> #include <Poco/DOM/NodeList.h> @@ -167,9 +168,8 @@ void FacilityInfo::fillComputeResources(const Poco::XML::Element *elem) { // TODO: this is a bit of duplicate effort at the moment, until // RemoteJobManager goes away from here (then this would be // removed), see header for details. - m_computeResources.insert(std::make_pair( - name, - boost::shared_ptr<RemoteJobManager>(new RemoteJobManager(elem)))); + m_computeResources.emplace(name, + boost::make_shared<RemoteJobManager>(elem)); } } } diff --git a/Framework/Kernel/src/LogParser.cpp b/Framework/Kernel/src/LogParser.cpp index b4f3c9528ee..85e0d96c8f7 100644 --- a/Framework/Kernel/src/LogParser.cpp +++ b/Framework/Kernel/src/LogParser.cpp @@ -91,7 +91,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, isNumeric = !istr.fail(); old_data = sdata; - change_times.insert(std::make_pair(stime, sdata)); + change_times.emplace(stime, sdata); } if (change_times.empty()) diff --git a/Framework/Kernel/src/MDAxisValidator.cpp b/Framework/Kernel/src/MDAxisValidator.cpp index eb6de782088..2d31271abae 100644 --- a/Framework/Kernel/src/MDAxisValidator.cpp +++ b/Framework/Kernel/src/MDAxisValidator.cpp @@ -45,8 +45,8 @@ std::map<std::string, std::string> MDAxisValidator::validate() const { // Make sure that there are fewer axes specified than exist on the workspace if (m_axes.size() > m_wsDimensions) { - invalidProperties.insert(std::make_pair( - "Axes", "More axes specified than dimensions available in the input")); + invalidProperties.emplace( + "Axes", "More axes specified than dimensions available in the input"); } // Ensure that the axes selection is within the number of dimensions of the diff --git a/Framework/Kernel/src/MultiFileNameParser.cpp b/Framework/Kernel/src/MultiFileNameParser.cpp index 91665c120ff..61238cc5874 100644 --- a/Framework/Kernel/src/MultiFileNameParser.cpp +++ b/Framework/Kernel/src/MultiFileNameParser.cpp @@ -419,7 +419,7 @@ void RunRangeList::addRun(unsigned int run) { return; // Else create a new range, containing a single run, and add it to the list. - m_rangeList.insert(std::make_pair(run, run)); + m_rangeList.emplace(run, run); // Now merge any ranges that are adjacent. m_rangeList = std::accumulate( diff --git a/Framework/Kernel/src/NexusDescriptor.cpp b/Framework/Kernel/src/NexusDescriptor.cpp index f05232f4cb5..23da9f1955b 100644 --- a/Framework/Kernel/src/NexusDescriptor.cpp +++ b/Framework/Kernel/src/NexusDescriptor.cpp @@ -231,7 +231,7 @@ void NexusDescriptor::walkFile(::NeXus::File &file, const std::string &rootPath, std::map<std::string, std::string> &pmap, int level) { if (!rootPath.empty()) { - pmap.insert(std::make_pair(rootPath, className)); + pmap.emplace(rootPath, className); } if (level == 0) { auto attrInfos = file.getAttrInfos(); @@ -247,8 +247,8 @@ void NexusDescriptor::walkFile(::NeXus::File &file, const std::string &rootPath, const std::string &entryClass = it->second; const std::string entryPath = rootPath + "/" + entryName; if (entryClass == "SDS") { - // tmap.insert(std::make_pair(entryClass, entryPath)); - pmap.insert(std::make_pair(entryPath, entryClass)); + // tmap.emplace(entryClass, entryPath); + pmap.emplace(entryPath, entryClass); } else if (entryClass == "CDF0.0") { // Do nothing with this } else { diff --git a/Framework/Kernel/src/OptionalBool.cpp b/Framework/Kernel/src/OptionalBool.cpp index b3bd37ae4e8..de502260e59 100644 --- a/Framework/Kernel/src/OptionalBool.cpp +++ b/Framework/Kernel/src/OptionalBool.cpp @@ -51,18 +51,16 @@ const std::string OptionalBool::StrFalse = "False"; const std::string OptionalBool::StrTrue = "True"; std::map<std::string, OptionalBool::Value> OptionalBool::strToEmumMap() { - std::map<std::string, Value> map; - map.insert(std::make_pair(StrUnset, OptionalBool::Unset)); - map.insert(std::make_pair(StrFalse, OptionalBool::False)); - map.insert(std::make_pair(StrTrue, OptionalBool::True)); - return map; + return {{StrUnset, OptionalBool::Unset}, + {StrFalse, OptionalBool::False}, + {StrTrue, OptionalBool::True}}; } std::map<OptionalBool::Value, std::string> OptionalBool::enumToStrMap() { std::map<Value, std::string> map; auto opposite = strToEmumMap(); for (auto it = opposite.begin(); it != opposite.end(); ++it) { - map.insert(std::make_pair(it->second, it->first)); + map.emplace(it->second, it->first); } return map; } diff --git a/Framework/Kernel/src/Property.cpp b/Framework/Kernel/src/Property.cpp index d3ec47e0a3c..e842fe7763a 100644 --- a/Framework/Kernel/src/Property.cpp +++ b/Framework/Kernel/src/Property.cpp @@ -321,87 +321,67 @@ std::string getUnmangledTypeName(const std::type_info &type) { // will get initialized when the function is first used static std::map<string, string> typestrings; if (typestrings.empty()) { - typestrings.insert(make_pair(typeid(char).name(), string("letter"))); - typestrings.insert(make_pair(typeid(int).name(), string("number"))); - typestrings.insert(make_pair(typeid(long long).name(), string("number"))); - typestrings.insert(make_pair(typeid(int64_t).name(), string("number"))); - typestrings.insert(make_pair(typeid(double).name(), string("number"))); - typestrings.insert(make_pair(typeid(bool).name(), string("boolean"))); - typestrings.insert(make_pair(typeid(string).name(), string("string"))); - typestrings.insert( - make_pair(typeid(std::vector<string>).name(), string("str list"))); - typestrings.insert( - make_pair(typeid(std::vector<int>).name(), string("int list"))); - typestrings.insert( - make_pair(typeid(std::vector<int64_t>).name(), string("int list"))); - typestrings.insert(make_pair(typeid(std::vector<size_t>).name(), - string("unsigned int list"))); - typestrings.insert( - make_pair(typeid(std::vector<double>).name(), string("dbl list"))); - typestrings.insert( - make_pair(typeid(std::vector<std::vector<string>>).name(), - string("list of str lists"))); + typestrings.emplace(typeid(char).name(), string("letter")); + typestrings.emplace(typeid(int).name(), string("number")); + typestrings.emplace(typeid(long long).name(), string("number")); + typestrings.emplace(typeid(int64_t).name(), string("number")); + typestrings.emplace(typeid(double).name(), string("number")); + typestrings.emplace(typeid(bool).name(), string("boolean")); + typestrings.emplace(typeid(string).name(), string("string")); + typestrings.emplace(typeid(std::vector<string>).name(), string("str list")); + typestrings.emplace(typeid(std::vector<int>).name(), string("int list")); + typestrings.emplace(typeid(std::vector<int64_t>).name(), + string("int list")); + typestrings.emplace(typeid(std::vector<size_t>).name(), + string("unsigned int list")); + typestrings.emplace(typeid(std::vector<double>).name(), string("dbl list")); + typestrings.emplace(typeid(std::vector<std::vector<string>>).name(), + string("list of str lists")); // Workspaces - typestrings.insert(make_pair(typeid(boost::shared_ptr<Workspace>).name(), - string("Workspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<MatrixWorkspace>).name(), - string("MatrixWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<ITableWorkspace>).name(), - string("TableWorkspace"))); - typestrings.insert(make_pair(typeid(boost::shared_ptr<IMDWorkspace>).name(), - string("IMDWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<IMDEventWorkspace>).name(), - string("MDEventWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<IEventWorkspace>).name(), - string("IEventWorkspace"))); - typestrings.insert(make_pair(typeid(boost::shared_ptr<Workspace2D>).name(), - string("Workspace2D"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<EventWorkspace>).name(), - string("EventWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<PeaksWorkspace>).name(), - string("PeaksWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<IPeaksWorkspace>).name(), - string("IPeaksWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<GroupingWorkspace>).name(), - string("GroupingWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<WorkspaceGroup>).name(), - string("WorkspaceGroup"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<OffsetsWorkspace>).name(), - string("OffsetsWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<MaskWorkspace>).name(), - string("MaskWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<SpecialWorkspace2D>).name(), - string("SpecialWorkspace2D"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<IMDHistoWorkspace>).name(), - string("IMDHistoWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<SplittersWorkspace>).name(), - string("SplittersWorkspace"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<SpecialWorkspace2D>).name(), - string("SpecialWorkspace2D"))); - typestrings.insert( - make_pair(typeid(boost::shared_ptr<TableWorkspace>).name(), - string("TableWorkspace"))); + typestrings.emplace(typeid(boost::shared_ptr<Workspace>).name(), + string("Workspace")); + typestrings.emplace(typeid(boost::shared_ptr<MatrixWorkspace>).name(), + string("MatrixWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<ITableWorkspace>).name(), + string("TableWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<IMDWorkspace>).name(), + string("IMDWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<IMDEventWorkspace>).name(), + string("MDEventWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<IEventWorkspace>).name(), + string("IEventWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<Workspace2D>).name(), + string("Workspace2D")); + typestrings.emplace(typeid(boost::shared_ptr<EventWorkspace>).name(), + string("EventWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<PeaksWorkspace>).name(), + string("PeaksWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<IPeaksWorkspace>).name(), + string("IPeaksWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<GroupingWorkspace>).name(), + string("GroupingWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<WorkspaceGroup>).name(), + string("WorkspaceGroup")); + typestrings.emplace(typeid(boost::shared_ptr<OffsetsWorkspace>).name(), + string("OffsetsWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<MaskWorkspace>).name(), + string("MaskWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<SpecialWorkspace2D>).name(), + string("SpecialWorkspace2D")); + typestrings.emplace(typeid(boost::shared_ptr<IMDHistoWorkspace>).name(), + string("IMDHistoWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<SplittersWorkspace>).name(), + string("SplittersWorkspace")); + typestrings.emplace(typeid(boost::shared_ptr<SpecialWorkspace2D>).name(), + string("SpecialWorkspace2D")); + typestrings.emplace(typeid(boost::shared_ptr<TableWorkspace>).name(), + string("TableWorkspace")); // FunctionProperty - typestrings.insert(make_pair(typeid(boost::shared_ptr<IFunction>).name(), - string("Function"))); - typestrings.insert(make_pair(typeid(boost::shared_ptr<IAlgorithm>).name(), - string("IAlgorithm"))); + typestrings.emplace(typeid(boost::shared_ptr<IFunction>).name(), + string("Function")); + typestrings.emplace(typeid(boost::shared_ptr<IAlgorithm>).name(), + string("IAlgorithm")); } std::map<std::string, std::string>::const_iterator mitr = typestrings.find(type.name()); diff --git a/Framework/LiveData/src/SNSLiveEventDataListener.cpp b/Framework/LiveData/src/SNSLiveEventDataListener.cpp index d83c527a47e..b1a2d0057d3 100644 --- a/Framework/LiveData/src/SNSLiveEventDataListener.cpp +++ b/Framework/LiveData/src/SNSLiveEventDataListener.cpp @@ -854,8 +854,8 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::VariableU32Pkt &pkt) { // Check to see if we should process this packet now. If not, add it to the // variable map because we might need to process it later if (ignorePacket(pkt)) { - boost::shared_ptr<ADARA::Packet> ptr(new ADARA::VariableU32Pkt(pkt)); - m_variableMap.insert(std::make_pair(std::make_pair(devId, pvId), ptr)); + m_variableMap.emplace(std::make_pair(devId, pvId), + boost::make_shared<ADARA::VariableU32Pkt>(pkt)); } else { // Look up the name of this variable NameMapType::const_iterator it = @@ -905,8 +905,8 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::VariableDoublePkt &pkt) { // Check to see if we should process this packet now. If not, add it to the // variable map because we might need to process it later if (ignorePacket(pkt)) { - boost::shared_ptr<ADARA::Packet> ptr(new ADARA::VariableDoublePkt(pkt)); - m_variableMap.insert(std::make_pair(std::make_pair(devId, pvId), ptr)); + m_variableMap.emplace(std::make_pair(devId, pvId), + boost::make_shared<ADARA::VariableDoublePkt>(pkt)); } else { // Look up the name of this variable NameMapType::const_iterator it = @@ -959,8 +959,8 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::VariableStringPkt &pkt) { // Check to see if we should process this packet now. If not, add it to the // variable map because we might need to process it later if (ignorePacket(pkt)) { - boost::shared_ptr<ADARA::Packet> ptr(new ADARA::VariableStringPkt(pkt)); - m_variableMap.insert(std::make_pair(std::make_pair(devId, pvId), ptr)); + m_variableMap.emplace(std::make_pair(devId, pvId), + boost::make_shared<ADARA::VariableStringPkt>(pkt)); } else { // Look up the name of this variable NameMapType::const_iterator it = diff --git a/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp b/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp index 84b71925e96..ada4baae0f2 100644 --- a/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp +++ b/Framework/MDAlgorithms/src/ImportMDHistoWorkspaceBase.cpp @@ -187,7 +187,7 @@ ImportMDHistoWorkspaceBase::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/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp index 0557a9a29df..4c1086d629d 100644 --- a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp +++ b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp @@ -445,7 +445,7 @@ Mantid::MDAlgorithms::IntegrateMDHistoWorkspace::validateInputs() { std::vector<double> binning = this->getProperty(propertyName); std::string result = checkBinning(binning); if (!result.empty()) { - errors.insert(std::make_pair(propertyName, result)); + errors.emplace(propertyName, result); } } return errors; diff --git a/Framework/MDAlgorithms/src/ReplicateMD.cpp b/Framework/MDAlgorithms/src/ReplicateMD.cpp index 340f280f2be..567f86459c4 100644 --- a/Framework/MDAlgorithms/src/ReplicateMD.cpp +++ b/Framework/MDAlgorithms/src/ReplicateMD.cpp @@ -187,9 +187,9 @@ std::map<std::string, std::string> ReplicateMD::validateInputs() { IMDHistoWorkspace_sptr dataWS = this->getProperty("DataWorkspace"); if (shapeWS->getNonIntegratedDimensions().size() != dataWS->getNonIntegratedDimensions().size() + 1) { - errorMap.insert(std::make_pair( + errorMap.emplace( "DataWorkspace", - "Expect to have n-1 non-interated dimensions of ShapeWorkspace")); + "Expect to have n-1 non-interated dimensions of ShapeWorkspace"); } size_t nonMatchingCount = 0; @@ -209,7 +209,7 @@ std::map<std::string, std::string> ReplicateMD::validateInputs() { stream << "Dimension with id " << shapeDim->getDimensionId() << "in ShapeWorkspace has a different number of bins as the " "same id dimension in the DataWorkspace"; - errorMap.insert(std::make_pair("DataWorkspace", stream.str())); + errorMap.emplace("DataWorkspace", stream.str()); } } } else { @@ -219,10 +219,10 @@ std::map<std::string, std::string> ReplicateMD::validateInputs() { // Check number of missing/integrated dimensions if (nonMatchingCount != 1) { - errorMap.insert(std::make_pair("DataWorkspace", - "There should be ONLY 1 dimension present " - "in the ShapeWorkspace that is not present " - "(or integrated out) in the DataWorkspace")); + errorMap.emplace("DataWorkspace", + "There should be ONLY 1 dimension present " + "in the ShapeWorkspace that is not present " + "(or integrated out) in the DataWorkspace"); } return errorMap; diff --git a/Framework/MDAlgorithms/src/SmoothMD.cpp b/Framework/MDAlgorithms/src/SmoothMD.cpp index 72243e086fd..4ae42e1571f 100644 --- a/Framework/MDAlgorithms/src/SmoothMD.cpp +++ b/Framework/MDAlgorithms/src/SmoothMD.cpp @@ -60,11 +60,8 @@ std::vector<std::string> functions() { * @return function map */ SmoothFunctionMap makeFunctionMap(Mantid::MDAlgorithms::SmoothMD *instance) { - SmoothFunctionMap map; - map.insert(std::make_pair( - "Hat", boost::bind(&Mantid::MDAlgorithms::SmoothMD::hatSmooth, instance, - _1, _2, _3))); - return map; + return {{"Hat", boost::bind(&Mantid::MDAlgorithms::SmoothMD::hatSmooth, + instance, _1, _2, _3)}}; } } @@ -287,11 +284,11 @@ std::map<std::string, std::string> SmoothMD::validateInputs() { if (widthVector.size() != 1 && widthVector.size() != toSmoothWs->getNumDims()) { - product.insert(std::make_pair(widthVectorPropertyName, - widthVectorPropertyName + - " can either have one entry or needs to " - "have entries for each dimension of the " - "InputWorkspace.")); + product.emplace(widthVectorPropertyName, + widthVectorPropertyName + + " can either have one entry or needs to " + "have entries for each dimension of the " + "InputWorkspace."); } else { for (auto it = widthVector.begin(); it != widthVector.end(); ++it) { const int widthEntry = *it; @@ -299,7 +296,7 @@ std::map<std::string, std::string> SmoothMD::validateInputs() { std::stringstream message; message << widthVectorPropertyName << " entries must be odd numbers. Bad entry is " << widthEntry; - product.insert(std::make_pair(widthVectorPropertyName, message.str())); + product.emplace(widthVectorPropertyName, message.str()); } } } @@ -333,8 +330,7 @@ std::map<std::string, std::string> SmoothMD::validateInputs() { << " do not match. " << nBinsSmooth << " expected. Got " << nBinsNorm << ". Shapes of inputs must be the same. Cannot " "continue smoothing."; - product.insert(std::make_pair(normalisationWorkspacePropertyName, - message.str())); + product.emplace(normalisationWorkspacePropertyName, message.str()); break; } } diff --git a/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp b/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp index a04cca60616..30a4c00328f 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Registry/PropertyWithValueFactory.cpp @@ -26,14 +26,13 @@ void initTypeLookup(PyTypeIndex &index) { // Map the Python types to the best match in C++ typedef TypedPropertyValueHandler<double> FloatHandler; - index.insert( - std::make_pair(&PyFloat_Type, boost::make_shared<FloatHandler>())); + index.emplace(&PyFloat_Type, boost::make_shared<FloatHandler>()); typedef TypedPropertyValueHandler<long> IntHandler; - index.insert(std::make_pair(&PyInt_Type, boost::make_shared<IntHandler>())); + index.emplace(&PyInt_Type, boost::make_shared<IntHandler>()); typedef TypedPropertyValueHandler<bool> BoolHandler; - index.insert(std::make_pair(&PyBool_Type, boost::make_shared<BoolHandler>())); + index.emplace(&PyBool_Type, boost::make_shared<BoolHandler>()); typedef TypedPropertyValueHandler<std::string> StrHandler; index.insert( @@ -70,8 +69,7 @@ void initArrayLookup(PyArrayIndex &index) { std::make_pair("IntArray", boost::make_shared<IntArrayHandler>())); typedef SequenceTypeHandler<std::vector<long>> LongIntArrayHandler; - index.insert(std::make_pair("LongIntArray", - boost::make_shared<LongIntArrayHandler>())); + index.emplace("LongIntArray", boost::make_shared<LongIntArrayHandler>()); typedef SequenceTypeHandler<std::vector<std::string>> StringArrayHandler; index.insert( diff --git a/Framework/PythonInterface/mantid/kernel/src/Registry/TypeRegistry.cpp b/Framework/PythonInterface/mantid/kernel/src/Registry/TypeRegistry.cpp index ddc83fb3e8c..f111c609993 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Registry/TypeRegistry.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Registry/TypeRegistry.cpp @@ -71,8 +71,8 @@ void TypeRegistry::subscribe(const std::type_info &typeObject, TypeIDMap &typeHandlers = typeRegistry(); boost::python::type_info typeInfo(typeObject); if (typeHandlers.find(typeInfo) == typeHandlers.end()) { - typeHandlers.insert(std::make_pair( - typeInfo, boost::shared_ptr<PropertyValueHandler>(handler))); + typeHandlers.emplace(typeInfo, + boost::shared_ptr<PropertyValueHandler>(handler)); } else { throw std::invalid_argument( std::string("TypeRegistry::subscribe() - A handler has already " diff --git a/Framework/RemoteJobManagers/src/LSFJobManager.cpp b/Framework/RemoteJobManagers/src/LSFJobManager.cpp index b878a20fb34..9d05616b51f 100644 --- a/Framework/RemoteJobManagers/src/LSFJobManager.cpp +++ b/Framework/RemoteJobManagers/src/LSFJobManager.cpp @@ -1322,10 +1322,10 @@ LSFJobManager::makeHeaders(const std::string &contentType, std::pair<std::string, std::string>("Content-Type", contentType)); } if (!token.empty()) { - headers.insert(std::make_pair("Cookie", token)); + headers.emplace("Cookie", token); } if (!acceptType.empty()) { - headers.insert(std::make_pair("Accept", acceptType)); + headers.emplace("Accept", acceptType); } return headers; diff --git a/MantidPlot/src/Mantid/MantidMatrix.cpp b/MantidPlot/src/Mantid/MantidMatrix.cpp index 610fd72b834..f5fef83d251 100644 --- a/MantidPlot/src/Mantid/MantidMatrix.cpp +++ b/MantidPlot/src/Mantid/MantidMatrix.cpp @@ -1294,7 +1294,7 @@ void MantidMatrix::setupNewExtension(MantidMatrixModel::Type type) { extension.tableView= new QTableView(); // Add it to the extension collection, so we can set it up in place - m_extensions.insert(std::make_pair(type, extension)); + m_extensions.emplace(type, extension); auto mapped_extension = m_extensions[type]; // Add a new tab diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp index ac7d94624d7..cef1e339c52 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectBayes.cpp @@ -26,12 +26,12 @@ IndirectBayes::IndirectBayes(QWidget *parent) Mantid::Kernel::ConfigService::Instance().addObserver(m_changeObserver); // insert each tab into the interface on creation - m_bayesTabs.insert(std::make_pair( - RES_NORM, new ResNorm(m_uiForm.indirectBayesTabs->widget(RES_NORM)))); - m_bayesTabs.insert(std::make_pair( - QUASI, new Quasi(m_uiForm.indirectBayesTabs->widget(QUASI)))); - m_bayesTabs.insert(std::make_pair( - STRETCH, new Stretch(m_uiForm.indirectBayesTabs->widget(STRETCH)))); + m_bayesTabs.emplace( + RES_NORM, new ResNorm(m_uiForm.indirectBayesTabs->widget(RES_NORM))); + m_bayesTabs.emplace(QUASI, + new Quasi(m_uiForm.indirectBayesTabs->widget(QUASI))); + m_bayesTabs.emplace(STRETCH, + new Stretch(m_uiForm.indirectBayesTabs->widget(STRETCH))); // Connect each tab to the actions available in this GUI std::map<unsigned int, IndirectBayesTab *>::iterator iter; diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectCorrections.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectCorrections.cpp index e79ebdaba0b..004dc8b88a1 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectCorrections.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectCorrections.cpp @@ -36,17 +36,16 @@ IndirectCorrections::IndirectCorrections(QWidget *parent) // All tabs MUST appear here to be shown in interface. // We make the assumption that each map key corresponds to the order in which // the tabs appear. - m_tabs.insert(std::make_pair(CONTAINER_SUBTRACTION, - new ContainerSubtraction(m_uiForm.twTabs->widget( - CONTAINER_SUBTRACTION)))); - m_tabs.insert(std::make_pair( - CALC_CORR, - new CalculatePaalmanPings(m_uiForm.twTabs->widget(CALC_CORR)))); - m_tabs.insert(std::make_pair( - APPLY_CORR, new ApplyPaalmanPings(m_uiForm.twTabs->widget(APPLY_CORR)))); - m_tabs.insert(std::make_pair( - ABSORPTION_CORRECTIONS, new AbsorptionCorrections(m_uiForm.twTabs->widget( - ABSORPTION_CORRECTIONS)))); + m_tabs.emplace( + CONTAINER_SUBTRACTION, + new ContainerSubtraction(m_uiForm.twTabs->widget(CONTAINER_SUBTRACTION))); + m_tabs.emplace(CALC_CORR, + new CalculatePaalmanPings(m_uiForm.twTabs->widget(CALC_CORR))); + m_tabs.emplace(APPLY_CORR, + new ApplyPaalmanPings(m_uiForm.twTabs->widget(APPLY_CORR))); + m_tabs.emplace(ABSORPTION_CORRECTIONS, + new AbsorptionCorrections( + m_uiForm.twTabs->widget(ABSORPTION_CORRECTIONS))); } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp index 65a32052600..92969722d40 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectDataAnalysis.cpp @@ -39,17 +39,12 @@ IndirectDataAnalysis::IndirectDataAnalysis(QWidget *parent) // All tabs MUST appear here to be shown in interface. // We make the assumption that each map key corresponds to the order in which // the tabs appear. - m_tabs.insert( - std::make_pair(ELWIN, new Elwin(m_uiForm.twIDATabs->widget(ELWIN)))); - m_tabs.insert( - std::make_pair(MSD_FIT, new MSDFit(m_uiForm.twIDATabs->widget(MSD_FIT)))); - m_tabs.insert(std::make_pair(IQT, new Iqt(m_uiForm.twIDATabs->widget(IQT)))); - m_tabs.insert( - std::make_pair(IQT_FIT, new IqtFit(m_uiForm.twIDATabs->widget(IQT_FIT)))); - m_tabs.insert(std::make_pair( - CONV_FIT, new ConvFit(m_uiForm.twIDATabs->widget(CONV_FIT)))); - m_tabs.insert(std::make_pair( - JUMP_FIT, new JumpFit(m_uiForm.twIDATabs->widget(JUMP_FIT)))); + m_tabs.emplace(ELWIN, new Elwin(m_uiForm.twIDATabs->widget(ELWIN))); + m_tabs.emplace(MSD_FIT, new MSDFit(m_uiForm.twIDATabs->widget(MSD_FIT))); + m_tabs.emplace(IQT, new Iqt(m_uiForm.twIDATabs->widget(IQT))); + m_tabs.emplace(IQT_FIT, new IqtFit(m_uiForm.twIDATabs->widget(IQT_FIT))); + m_tabs.emplace(CONV_FIT, new ConvFit(m_uiForm.twIDATabs->widget(CONV_FIT))); + m_tabs.emplace(JUMP_FIT, new JumpFit(m_uiForm.twIDATabs->widget(JUMP_FIT))); } /** diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp index 79454dfac03..4c9e4808cec 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectSimulation.cpp @@ -37,9 +37,14 @@ void IndirectSimulation::initLayout() Mantid::Kernel::ConfigService::Instance().addObserver(m_changeObserver); // Insert each tab into the interface on creation - m_simulationTabs.insert(std::make_pair(MOLDYN, new IndirectMolDyn(m_uiForm.IndirectSimulationTabs->widget(MOLDYN)))); - m_simulationTabs.insert(std::make_pair(SASSENA, new IndirectSassena(m_uiForm.IndirectSimulationTabs->widget(SASSENA)))); - m_simulationTabs.insert(std::make_pair(DOS, new DensityOfStates(m_uiForm.IndirectSimulationTabs->widget(DOS)))); + m_simulationTabs.emplace( + MOLDYN, + new IndirectMolDyn(m_uiForm.IndirectSimulationTabs->widget(MOLDYN))); + m_simulationTabs.emplace( + SASSENA, + new IndirectSassena(m_uiForm.IndirectSimulationTabs->widget(SASSENA))); + m_simulationTabs.emplace( + DOS, new DensityOfStates(m_uiForm.IndirectSimulationTabs->widget(DOS))); // Connect each tab to the actions available in this GUI std::map<unsigned int, IndirectSimulationTab*>::iterator iter; diff --git a/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp b/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp index 12d5730862c..09d37af4c93 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/IndirectTools.cpp @@ -33,10 +33,13 @@ void IndirectTools::initLayout() Mantid::Kernel::ConfigService::Instance().addObserver(m_changeObserver); // Insert each tab into the interface on creation - m_tabs.insert(std::make_pair(TRANSMISSION, new IndirectTransmissionCalc(m_uiForm.IndirectToolsTabs->widget(TRANSMISSION)))); - m_tabs.insert(std::make_pair(LOAD_ILL, new IndirectLoadILL(m_uiForm.IndirectToolsTabs->widget(LOAD_ILL)))); + m_tabs.emplace(TRANSMISSION, + new IndirectTransmissionCalc( + m_uiForm.IndirectToolsTabs->widget(TRANSMISSION))); + m_tabs.emplace(LOAD_ILL, new IndirectLoadILL( + m_uiForm.IndirectToolsTabs->widget(LOAD_ILL))); - //Connect each tab to the actions available in this GUI + //Connect each tab to the actions available in this GUI std::map<unsigned int, IndirectToolsTab*>::iterator iter; for (iter = m_tabs.begin(); iter != m_tabs.end(); ++iter) { diff --git a/MantidQt/CustomInterfaces/src/Reflectometry/ReflTableSchema.cpp b/MantidQt/CustomInterfaces/src/Reflectometry/ReflTableSchema.cpp index d0325ef1de8..c6082d7ca6d 100644 --- a/MantidQt/CustomInterfaces/src/Reflectometry/ReflTableSchema.cpp +++ b/MantidQt/CustomInterfaces/src/Reflectometry/ReflTableSchema.cpp @@ -6,24 +6,22 @@ namespace CustomInterfaces { namespace ReflTableSchema { ColumnIndexNameMap makeColumnIndexMap(){ - ColumnIndexNameMap columnMap; - columnMap.insert(std::make_pair(COL_RUNS, RUNS)); - columnMap.insert(std::make_pair(COL_ANGLE, ANGLE)); - columnMap.insert(std::make_pair(COL_TRANSMISSION, TRANSMISSION)); - columnMap.insert(std::make_pair(COL_QMIN, QMINDEF)); - columnMap.insert(std::make_pair(COL_QMAX, QMAXDEF)); - columnMap.insert(std::make_pair(COL_DQQ, DQQ)); - columnMap.insert(std::make_pair(COL_SCALE, SCALE)); - columnMap.insert(std::make_pair(COL_GROUP, GROUP)); - columnMap.insert(std::make_pair(COL_OPTIONS, OPTIONS)); - return columnMap; + return {{COL_RUNS, RUNS}, + {COL_ANGLE, ANGLE}, + {COL_TRANSMISSION, TRANSMISSION}, + {COL_QMIN, QMINDEF}, + {COL_QMAX, QMAXDEF}, + {COL_DQQ, DQQ}, + {COL_SCALE, SCALE}, + {COL_GROUP, GROUP}, + {COL_OPTIONS, OPTIONS}}; } ColumnNameIndexMap makeColumnNameMap(){ auto indexMap = makeColumnIndexMap(); ColumnNameIndexMap columnMap; for(auto it = indexMap.begin(); it != indexMap.end(); ++it){ - columnMap.insert(std::make_pair(it->second, it->first)); + columnMap.emplace(it->second, it->first); } return columnMap; } diff --git a/MantidQt/SliceViewer/src/PeakPalette.cpp b/MantidQt/SliceViewer/src/PeakPalette.cpp index 6c1d17c3a2e..47015c6e8f6 100644 --- a/MantidQt/SliceViewer/src/PeakPalette.cpp +++ b/MantidQt/SliceViewer/src/PeakPalette.cpp @@ -10,28 +10,28 @@ namespace MantidQt PeakPalette::PeakPalette() { int index = 0; - m_foregroundMap.insert(std::make_pair(index++, QColor("#bf7651"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#bd97cb"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#ceeeea"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#da4a52"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#9bc888"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#ffe181"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#e8b7c1"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#f38235"))); - m_foregroundMap.insert(std::make_pair(index++, QColor("#8390c6"))); - m_foregroundMap.insert(std::make_pair(index, QColor("#4ca0ac"))); + m_foregroundMap.emplace(index++, QColor("#bf7651")); + m_foregroundMap.emplace(index++, QColor("#bd97cb")); + m_foregroundMap.emplace(index++, QColor("#ceeeea")); + m_foregroundMap.emplace(index++, QColor("#da4a52")); + m_foregroundMap.emplace(index++, QColor("#9bc888")); + m_foregroundMap.emplace(index++, QColor("#ffe181")); + m_foregroundMap.emplace(index++, QColor("#e8b7c1")); + m_foregroundMap.emplace(index++, QColor("#f38235")); + m_foregroundMap.emplace(index++, QColor("#8390c6")); + m_foregroundMap.emplace(index, QColor("#4ca0ac")); index = 0; - m_backgroundMap.insert(std::make_pair(index++, QColor("#bf7651"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#bd97cb"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#ceeeea"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#da4a52"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#9bc888"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#ffe181"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#e8b7c1"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#f38235"))); - m_backgroundMap.insert(std::make_pair(index++, QColor("#8390c6"))); - m_backgroundMap.insert(std::make_pair(index, QColor("#4ca0ac"))); + m_backgroundMap.emplace(index++, QColor("#bf7651")); + m_backgroundMap.emplace(index++, QColor("#bd97cb")); + m_backgroundMap.emplace(index++, QColor("#ceeeea")); + m_backgroundMap.emplace(index++, QColor("#da4a52")); + m_backgroundMap.emplace(index++, QColor("#9bc888")); + m_backgroundMap.emplace(index++, QColor("#ffe181")); + m_backgroundMap.emplace(index++, QColor("#e8b7c1")); + m_backgroundMap.emplace(index++, QColor("#f38235")); + m_backgroundMap.emplace(index++, QColor("#8390c6")); + m_backgroundMap.emplace(index, QColor("#4ca0ac")); } PeakPalette::PeakPalette(const PeakPalette& other) : m_backgroundMap(other.m_backgroundMap), m_foregroundMap(other.m_foregroundMap) diff --git a/MantidQt/SliceViewer/src/QPeaksTableModel.cpp b/MantidQt/SliceViewer/src/QPeaksTableModel.cpp index 49369f62f9d..d8db67c8f67 100644 --- a/MantidQt/SliceViewer/src/QPeaksTableModel.cpp +++ b/MantidQt/SliceViewer/src/QPeaksTableModel.cpp @@ -159,47 +159,47 @@ namespace MantidQt m_peaksWS(peaksWS) { int index = 0; - m_columnNameMap.insert(std::make_pair(index++, RUNNUMBER)); - m_columnNameMap.insert(std::make_pair(index++, DETID)); - m_columnNameMap.insert(std::make_pair(index++, H)); - m_columnNameMap.insert(std::make_pair(index++, K)); - m_columnNameMap.insert(std::make_pair(index++, L)); - m_columnNameMap.insert(std::make_pair(index++, WAVELENGTH)); - m_columnNameMap.insert(std::make_pair(index++, INITIAL_ENERGY)); - m_columnNameMap.insert(std::make_pair(index++, FINAL_ENERGY)); - m_columnNameMap.insert(std::make_pair(index++, ENERGY)); - m_columnNameMap.insert(std::make_pair(index++, TOF)); - m_columnNameMap.insert(std::make_pair(index++, DSPACING)); - m_columnNameMap.insert(std::make_pair(index++, INT)); - m_columnNameMap.insert(std::make_pair(index++, SIGMINT)); - m_columnNameMap.insert(std::make_pair(index++, INT_SIGINT)); - m_columnNameMap.insert(std::make_pair(index++, BINCOUNT)); - m_columnNameMap.insert(std::make_pair(index++, BANKNAME)); - m_columnNameMap.insert(std::make_pair(index++, ROW)); - m_columnNameMap.insert(std::make_pair(index++, COL)); - m_columnNameMap.insert(std::make_pair(index++, QLAB)); - m_columnNameMap.insert(std::make_pair(index++, QSAMPLE)); - - m_sortableColumns.insert(std::make_pair(RUNNUMBER, true)); - m_sortableColumns.insert(std::make_pair(DETID, true)); - m_sortableColumns.insert(std::make_pair(H,true)); - m_sortableColumns.insert(std::make_pair(K,true)); - m_sortableColumns.insert(std::make_pair(L,true)); - m_sortableColumns.insert(std::make_pair(WAVELENGTH,true)); - m_sortableColumns.insert(std::make_pair(ENERGY,false)); - m_sortableColumns.insert(std::make_pair(INITIAL_ENERGY,true)); - m_sortableColumns.insert(std::make_pair(FINAL_ENERGY,true)); - m_sortableColumns.insert(std::make_pair(TOF,true)); - m_sortableColumns.insert(std::make_pair(DSPACING, true)); - m_sortableColumns.insert(std::make_pair(INT, true)); - m_sortableColumns.insert(std::make_pair(SIGMINT, true)); - m_sortableColumns.insert(std::make_pair(INT_SIGINT, false)); - m_sortableColumns.insert(std::make_pair(BINCOUNT, true)); - m_sortableColumns.insert(std::make_pair(BANKNAME, true)); - m_sortableColumns.insert(std::make_pair(ROW, true)); - m_sortableColumns.insert(std::make_pair(COL, true)); - m_sortableColumns.insert(std::make_pair(QLAB, false)); - m_sortableColumns.insert(std::make_pair(QSAMPLE, false)); + m_columnNameMap.emplace(index++, RUNNUMBER); + m_columnNameMap.emplace(index++, DETID); + m_columnNameMap.emplace(index++, H); + m_columnNameMap.emplace(index++, K); + m_columnNameMap.emplace(index++, L); + m_columnNameMap.emplace(index++, WAVELENGTH); + m_columnNameMap.emplace(index++, INITIAL_ENERGY); + m_columnNameMap.emplace(index++, FINAL_ENERGY); + m_columnNameMap.emplace(index++, ENERGY); + m_columnNameMap.emplace(index++, TOF); + m_columnNameMap.emplace(index++, DSPACING); + m_columnNameMap.emplace(index++, INT); + m_columnNameMap.emplace(index++, SIGMINT); + m_columnNameMap.emplace(index++, INT_SIGINT); + m_columnNameMap.emplace(index++, BINCOUNT); + m_columnNameMap.emplace(index++, BANKNAME); + m_columnNameMap.emplace(index++, ROW); + m_columnNameMap.emplace(index++, COL); + m_columnNameMap.emplace(index++, QLAB); + m_columnNameMap.emplace(index++, QSAMPLE); + + m_sortableColumns.emplace(RUNNUMBER, true); + m_sortableColumns.emplace(DETID, true); + m_sortableColumns.emplace(H, true); + m_sortableColumns.emplace(K, true); + m_sortableColumns.emplace(L, true); + m_sortableColumns.emplace(WAVELENGTH, true); + m_sortableColumns.emplace(ENERGY, false); + m_sortableColumns.emplace(INITIAL_ENERGY, true); + m_sortableColumns.emplace(FINAL_ENERGY, true); + m_sortableColumns.emplace(TOF, true); + m_sortableColumns.emplace(DSPACING, true); + m_sortableColumns.emplace(INT, true); + m_sortableColumns.emplace(SIGMINT, true); + m_sortableColumns.emplace(INT_SIGINT, false); + m_sortableColumns.emplace(BINCOUNT, true); + m_sortableColumns.emplace(BANKNAME, true); + m_sortableColumns.emplace(ROW, true); + m_sortableColumns.emplace(COL, true); + m_sortableColumns.emplace(QLAB, false); + m_sortableColumns.emplace(QSAMPLE, false); if (!Mantid::Kernel::ConfigService::Instance().getValue("PeakColumn.hklPrec", m_hklPrec)) m_hklPrec = 2; -- GitLab