From 7d98ff91f7e85f01318af9c401d15bb8d66729e1 Mon Sep 17 00:00:00 2001 From: Steven Hahn <hahnse@ornl.gov> Date: Wed, 3 Feb 2016 17:43:35 -0500 Subject: [PATCH] When possible, use initializer lists instead of emplace. --- Framework/API/src/NotebookBuilder.cpp | 5 +- Framework/API/src/ScriptBuilder.cpp | 5 +- Framework/API/test/AlgorithmProxyTest.h | 4 +- Framework/API/test/AlgorithmTest.h | 3 +- Framework/API/test/ExpressionTest.h | 28 ++----- Framework/API/test/FileFinderTest.h | 5 +- Framework/API/test/MultipleFilePropertyTest.h | 5 +- .../Algorithms/src/AbsorptionCorrection.cpp | 9 +-- .../Algorithms/src/BinaryOperateMasks.cpp | 6 +- .../src/CalculateFlatBackground.cpp | 9 +-- Framework/Algorithms/src/ConvertUnits.cpp | 5 +- Framework/Algorithms/src/CopyLogs.cpp | 6 +- Framework/Algorithms/src/CorrectKiKf.cpp | 4 +- Framework/Algorithms/src/CorrectToFile.cpp | 3 +- .../src/CreateGroupingWorkspace.cpp | 7 +- .../Algorithms/src/CreateSampleWorkspace.cpp | 4 +- .../src/CreateTransmissionWorkspaceAuto.cpp | 5 +- .../Algorithms/src/ExportTimeSeriesLog.cpp | 4 +- Framework/Algorithms/src/FFT.cpp | 4 +- Framework/Algorithms/src/FFTSmooth.cpp | 4 +- Framework/Algorithms/src/FFTSmooth2.cpp | 5 +- Framework/Algorithms/src/FilterEvents.cpp | 12 +-- .../Algorithms/src/FindPeakBackground.cpp | 5 +- Framework/Algorithms/src/FindPeaks.cpp | 5 +- Framework/Algorithms/src/FitPeak.cpp | 14 +--- .../Algorithms/src/GenerateEventsFilter.cpp | 19 +---- .../src/GenerateIPythonNotebook.cpp | 9 +-- Framework/Algorithms/src/GeneratePeaks.cpp | 12 +-- .../Algorithms/src/GeneratePythonScript.cpp | 9 +-- .../src/GetDetOffsetsMultiPeaks.cpp | 11 +-- .../Algorithms/src/GetDetectorOffsets.cpp | 4 +- .../src/GetTimeSeriesLogInformation.cpp | 5 +- .../Algorithms/src/HRPDSlabCanAbsorption.cpp | 4 +- Framework/Algorithms/src/ModeratorTzero.cpp | 5 +- .../src/PDDetermineCharacterizations.cpp | 24 ++---- .../src/PlotAsymmetryByLogValue.cpp | 17 +--- .../Algorithms/src/PolynomialCorrection.cpp | 4 +- Framework/Algorithms/src/RRFMuon.cpp | 5 +- .../Algorithms/src/ReadGroupsFromFile.cpp | 4 +- Framework/Algorithms/src/RealFFT.cpp | 4 +- .../Algorithms/src/RecordPythonScript.cpp | 4 +- .../src/ReflectometryReductionOneAuto.cpp | 5 +- Framework/Algorithms/src/RemoveBins.cpp | 4 +- .../Algorithms/src/SetInstrumentParameter.cpp | 4 +- Framework/Algorithms/src/SmoothNeighbours.cpp | 11 +-- Framework/Algorithms/src/SofQW.cpp | 4 +- Framework/Algorithms/src/SofQWCentre.cpp | 4 +- Framework/Algorithms/src/SortEvents.cpp | 6 +- Framework/Algorithms/src/StripPeaks.cpp | 4 +- .../Algorithms/src/StripVanadiumPeaks2.cpp | 4 +- Framework/Algorithms/src/SumRowColumn.cpp | 4 +- .../test/CheckWorkspacesMatchTest.h | 5 +- .../Algorithms/test/CompareWorkspacesTest.h | 10 +-- .../Algorithms/test/CreateWorkspaceTest.h | 10 +-- Framework/Algorithms/test/MergeRunsTest.h | 4 +- .../Algorithms/test/RebinByTimeAtSampleTest.h | 6 +- .../Algorithms/test/SpatialGroupingTest.h | 22 ++--- .../Crystal/inc/MantidCrystal/PeakHKLErrors.h | 5 +- Framework/Crystal/src/FilterPeaks.cpp | 15 +--- .../src/OptimizeExtinctionParameters.cpp | 16 ++-- Framework/Crystal/src/SCDCalibratePanels.cpp | 17 ++-- Framework/Crystal/src/SaveHKL.cpp | 5 +- Framework/Crystal/src/SaveIsawPeaks.cpp | 4 +- Framework/Crystal/src/SaveLauenorm.cpp | 6 +- Framework/Crystal/src/SetGoniometer.cpp | 5 +- .../src/StatisticsOfPeaksWorkspace.cpp | 7 +- Framework/Crystal/src/TOFExtinction.cpp | 16 ++-- .../test/IntegratePeaksUsingClustersTest.h | 8 +- Framework/Crystal/test/SortHKLTest.h | 14 ++-- .../src/Algorithms/FitPowderDiffPeaks.cpp | 8 +- .../CurveFitting/src/Algorithms/LeBailFit.cpp | 18 ++--- .../CurveFitting/src/Algorithms/PawleyFit.cpp | 11 +-- .../src/Algorithms/PlotPeakByLogValue.cpp | 4 +- .../RefinePowderInstrumentParameters.cpp | 11 +-- .../RefinePowderInstrumentParameters3.cpp | 8 +- .../CurveFitting/src/Functions/BSpline.cpp | 9 +-- .../src/Functions/DynamicKuboToyabe.cpp | 4 +- .../src/Functions/FullprofPolynomial.cpp | 6 +- .../CurveFitting/src/Functions/Polynomial.cpp | 6 +- .../src/Functions/ProcessBackground.cpp | 25 ++---- .../CurveFitting/src/IFittingAlgorithm.cpp | 5 +- .../test/Algorithms/FitPowderDiffPeaksTest.h | 12 +-- .../test/Algorithms/LeBailFitTest.h | 4 +- .../test/Algorithms/LeBailFunctionTest.h | 12 +-- .../RefinePowderInstrumentParametersTest.h | 12 +-- .../test/MultiDomainCreatorTest.h | 16 +--- .../src/AppendGeometryToSNSNexus.cpp | 4 +- .../src/CreateChunkingFromInstrument.cpp | 7 +- .../src/FilterEventsByLogValuePreNexus.cpp | 10 +-- Framework/DataHandling/src/LoadDaveGrp.cpp | 6 +- Framework/DataHandling/src/LoadDspacemap.cpp | 6 +- .../DataHandling/src/LoadEventPreNexus.cpp | 5 +- .../DataHandling/src/LoadEventPreNexus2.cpp | 5 +- Framework/DataHandling/src/LoadISISNexus2.cpp | 5 +- Framework/DataHandling/src/LoadMuonNexus.cpp | 4 +- Framework/DataHandling/src/LoadPreNexus.cpp | 5 +- .../DataHandling/src/LoadSpiceXML2DDet.cpp | 5 +- .../DataHandling/src/LoadVulcanCalFile.cpp | 5 +- Framework/DataHandling/src/NexusTester.cpp | 6 +- Framework/DataHandling/src/SaveCanSAS1D.cpp | 23 +++--- .../src/SaveGSASInstrumentFile.cpp | 9 +-- .../DataObjects/test/EventWorkspaceTest.h | 8 +- .../Crystal/SymmetryOperationSymbolParser.cpp | 6 +- .../test/CompositeBraggScattererTest.h | 72 +++++------------ Framework/Geometry/test/CylinderTest.h | 5 +- Framework/Geometry/test/IndexingUtilsTest.h | 37 +++------ .../Geometry/test/LineIntersectVisitTest.h | 18 ++--- Framework/Geometry/test/ObjComponentTest.h | 9 +-- Framework/Geometry/test/ObjectTest.h | 51 ++++-------- Framework/Geometry/test/ParObjComponentTest.h | 9 +-- .../Geometry/test/ReflectionGeneratorTest.h | 5 +- Framework/Geometry/test/SphereTest.h | 5 +- Framework/Geometry/test/SurfaceTest.h | 5 +- .../test/SymmetryOperationFactoryTest.h | 3 +- Framework/Kernel/test/FileValidatorTest.h | 11 +-- Framework/Kernel/test/ListValidatorTest.h | 45 +++-------- .../Kernel/test/MultiFileValidatorTest.h | 9 +-- Framework/Kernel/test/PropertyWithValueTest.h | 16 +--- .../Kernel/test/StartsWithValidatorTest.h | 5 +- Framework/Kernel/test/StatisticsTest.h | 24 +----- .../Kernel/test/StringContainsValidatorTest.h | 31 ++----- Framework/Kernel/test/StringsTest.h | 19 +---- .../Kernel/test/TimeSeriesPropertyTest.h | 8 +- Framework/Kernel/test/V3DTest.h | 7 +- Framework/LiveData/src/LiveDataAlgorithm.cpp | 10 +-- Framework/MDAlgorithms/src/AccumulateMD.cpp | 5 +- .../MDAlgorithms/src/CalculateCoverageDGS.cpp | 6 +- .../MDAlgorithms/src/CentroidPeaksMD.cpp | 6 +- .../src/ConvertCWPDMDToSpectra.cpp | 6 +- .../MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp | 3 +- .../src/ConvertSpiceDataToRealSpace.cpp | 3 +- .../src/ConvertToDiffractionMDWorkspace.cpp | 6 +- .../src/ConvertToMDMinMaxGlobal.cpp | 5 +- Framework/MDAlgorithms/src/CreateMD.cpp | 5 +- .../MDAlgorithms/src/CreateMDWorkspace.cpp | 4 +- .../src/GetSpiceDataRawCountsFromMD.cpp | 5 +- .../MDAlgorithms/src/IntegratePeaksMD.cpp | 6 +- .../MDAlgorithms/src/IntegratePeaksMD2.cpp | 6 +- Framework/MDAlgorithms/src/SmoothMD.cpp | 7 +- .../MDAlgorithms/test/AccumulateMDTest.h | 19 +---- .../test/CalculateCoverageDGSTest.h | 3 +- .../MDAlgorithms/test/Integrate3DEventsTest.h | 7 +- .../src/SCARFTomoReconstruction.cpp | 80 +++++++------------ 143 files changed, 391 insertions(+), 1016 deletions(-) diff --git a/Framework/API/src/NotebookBuilder.cpp b/Framework/API/src/NotebookBuilder.cpp index d294462bada..48d755c22c8 100644 --- a/Framework/API/src/NotebookBuilder.cpp +++ b/Framework/API/src/NotebookBuilder.cpp @@ -163,10 +163,7 @@ NotebookBuilder::buildPropertyString(PropertyHistory_const_sptr propHistory) { using Mantid::Kernel::Direction; // Create a vector of all non workspace property type names - std::vector<std::string> nonWorkspaceTypes; - nonWorkspaceTypes.emplace_back("number"); - nonWorkspaceTypes.emplace_back("boolean"); - nonWorkspaceTypes.emplace_back("string"); + std::vector<std::string> nonWorkspaceTypes{"number", "boolean", "string"}; std::string prop = ""; // No need to specify value for default properties diff --git a/Framework/API/src/ScriptBuilder.cpp b/Framework/API/src/ScriptBuilder.cpp index bd8880c2215..7868d7e9ed6 100644 --- a/Framework/API/src/ScriptBuilder.cpp +++ b/Framework/API/src/ScriptBuilder.cpp @@ -190,10 +190,7 @@ ScriptBuilder::buildPropertyString(PropertyHistory_const_sptr propHistory) { using Mantid::Kernel::Direction; // Create a vector of all non workspace property type names - std::vector<std::string> nonWorkspaceTypes; - nonWorkspaceTypes.emplace_back("number"); - nonWorkspaceTypes.emplace_back("boolean"); - nonWorkspaceTypes.emplace_back("string"); + std::vector<std::string> nonWorkspaceTypes{"number", "boolean", "string"}; std::string prop = ""; // No need to specify value for default properties diff --git a/Framework/API/test/AlgorithmProxyTest.h b/Framework/API/test/AlgorithmProxyTest.h index 2694b97e76f..13f4b60cfa1 100644 --- a/Framework/API/test/AlgorithmProxyTest.h +++ b/Framework/API/test/AlgorithmProxyTest.h @@ -140,9 +140,7 @@ public: TS_ASSERT_EQUALS(alg->name(), "ToyAlgorithmProxyMultipleCategory"); TS_ASSERT_EQUALS(alg->version(), 1); TS_ASSERT_EQUALS(alg->category(), "ProxyCat;ProxyLeopard"); - std::vector<std::string> result; - result.emplace_back("ProxyCat"); - result.emplace_back("ProxyLeopard"); + std::vector<std::string> result{"ProxyCat", "ProxyLeopard"}; TS_ASSERT_EQUALS(alg->categories(), result); TS_ASSERT_EQUALS(alg->alias(), "Dog"); TS_ASSERT(alg->isInitialized()); diff --git a/Framework/API/test/AlgorithmTest.h b/Framework/API/test/AlgorithmTest.h index 5df8fd66bee..7720936bc94 100644 --- a/Framework/API/test/AlgorithmTest.h +++ b/Framework/API/test/AlgorithmTest.h @@ -190,8 +190,7 @@ public: } void testCategories() { - std::vector<std::string> result; - result.emplace_back("Cat"); + std::vector<std::string> result{"Cat"}; TS_ASSERT_EQUALS(alg.categories(), result); result.emplace_back("Leopard"); result.emplace_back("Mink"); diff --git a/Framework/API/test/ExpressionTest.h b/Framework/API/test/ExpressionTest.h index 9fb34110dbc..44db56d28e1 100644 --- a/Framework/API/test/ExpressionTest.h +++ b/Framework/API/test/ExpressionTest.h @@ -128,11 +128,7 @@ public: } void testOperators() { - std::vector<std::string> ops; - ops.emplace_back(","); - ops.emplace_back("="); - - Expression expr(ops); + Expression expr({",", "="}); TS_ASSERT_THROWS_NOTHING(expr.parse("x=-1\"(2)\",y=2a+b*(x+y) ")); TS_ASSERT_EQUALS(expr[0][1].name(), "-1\"(2)\""); @@ -174,11 +170,8 @@ public: TS_ASSERT_EQUALS(e4[0].name(), "x"); TS_ASSERT_EQUALS(e4[1].name(), "+"); - std::vector<std::string> bin_ops; - bin_ops.emplace_back("="); - std::set<std::string> un_ops; - un_ops.insert("!"); - un_ops.insert("%%"); + std::vector<std::string> bin_ops{"="}; + std::set<std::string> un_ops{"!", "%%"}; Expression e5(bin_ops, un_ops); TS_ASSERT_THROWS_NOTHING(e5.parse("x=!1")); @@ -212,11 +205,8 @@ public: TS_ASSERT_EQUALS(e8[0].name(), "x"); TS_ASSERT_EQUALS(e8[1].name(), "%%"); - std::vector<std::string> bin_ops1; - bin_ops1.emplace_back("=="); - std::set<std::string> un_ops1; - un_ops1.insert("!"); - un_ops1.insert("%%"); + std::vector<std::string> bin_ops1{"=="}; + std::set<std::string> un_ops1{"!", "%%"}; Expression e9(bin_ops1, un_ops1); TS_ASSERT_THROWS_NOTHING(e9.parse("x==!1")); @@ -256,12 +246,8 @@ public: Expression e14(bin_ops1, un_ops1); TS_ASSERT_THROWS(e14.parse("x==%% "), std::runtime_error); - std::vector<std::string> bin_ops2; - bin_ops2.emplace_back("-"); - bin_ops2.emplace_back("--"); - std::set<std::string> un_ops2; - un_ops2.insert("-"); - un_ops2.insert("--"); + std::vector<std::string> bin_ops2{"-", "--"}; + std::set<std::string> un_ops2{"-", "--"}; Expression e15(bin_ops2, un_ops2); TS_ASSERT_THROWS_NOTHING(e15.parse("x--1")); diff --git a/Framework/API/test/FileFinderTest.h b/Framework/API/test/FileFinderTest.h index 2a3eb2d796b..ed76e9688fa 100644 --- a/Framework/API/test/FileFinderTest.h +++ b/Framework/API/test/FileFinderTest.h @@ -244,10 +244,7 @@ public: } void testGetExtension() { - std::vector<std::string> exts; - exts.emplace_back("_event.nxs"); - exts.emplace_back(".nxs.h5"); - exts.emplace_back(".n*"); + std::vector<std::string> exts{"_event.nxs", ".nxs.h5", ".n*"}; TS_ASSERT_EQUALS(FileFinder::Instance().getExtension("", exts), ""); TS_ASSERT_EQUALS(FileFinder::Instance().getExtension("PG31234", exts), ""); diff --git a/Framework/API/test/MultipleFilePropertyTest.h b/Framework/API/test/MultipleFilePropertyTest.h index 940dbf33b36..d036dd14e73 100644 --- a/Framework/API/test/MultipleFilePropertyTest.h +++ b/Framework/API/test/MultipleFilePropertyTest.h @@ -95,7 +95,7 @@ public: MultipleFilePropertyTest() : m_multiFileLoadingSetting(), m_oldDataSearchDirectories(), m_oldDefaultFacility(), m_oldDefaultInstrument(), m_dummyFilesDir(), - m_dirWithWhitespace(), m_tempDirs(), m_exts(), + m_dirWithWhitespace(), m_tempDirs(), m_exts{".raw", ".nxs"}, g_config(Mantid::Kernel::ConfigService::Instance()) { m_dummyFilesDir = createAbsoluteDirectory("_MultipleFilePropertyTestDummyFiles"); @@ -105,9 +105,6 @@ public: m_tempDirs.insert(m_dummyFilesDir); m_tempDirs.insert(m_dirWithWhitespace); - m_exts.emplace_back(".raw"); - m_exts.emplace_back(".nxs"); - std::set<std::string> dummyFilenames = boost::assign::list_of // Standard raw file runs. ("TSC00001.raw")("TSC00002.raw")("TSC00003.raw")("TSC00004.raw")( diff --git a/Framework/Algorithms/src/AbsorptionCorrection.cpp b/Framework/Algorithms/src/AbsorptionCorrection.cpp index 33334cee2ed..157502a9dc3 100644 --- a/Framework/Algorithms/src/AbsorptionCorrection.cpp +++ b/Framework/Algorithms/src/AbsorptionCorrection.cpp @@ -63,19 +63,14 @@ void AbsorptionCorrection::init() { "The number of wavelength points for which the numerical integral is\n" "calculated (default: all points)"); - std::vector<std::string> exp_options; - exp_options.emplace_back("Normal"); - exp_options.emplace_back("FastApprox"); + std::vector<std::string> exp_options{"Normal", "FastApprox"}; declareProperty( "ExpMethod", "Normal", boost::make_shared<StringListValidator>(exp_options), "Select the method to use to calculate exponentials, normal or a\n" "fast approximation (default: Normal)"); - std::vector<std::string> propOptions; - propOptions.emplace_back("Elastic"); - propOptions.emplace_back("Direct"); - propOptions.emplace_back("Indirect"); + std::vector<std::string> propOptions{"Elastic", "Direct", "Indirect"}; declareProperty("EMode", "Elastic", boost::make_shared<StringListValidator>(propOptions), "The energy mode (default: elastic)"); diff --git a/Framework/Algorithms/src/BinaryOperateMasks.cpp b/Framework/Algorithms/src/BinaryOperateMasks.cpp index 843b2e19eda..0d697ea0eba 100644 --- a/Framework/Algorithms/src/BinaryOperateMasks.cpp +++ b/Framework/Algorithms/src/BinaryOperateMasks.cpp @@ -28,11 +28,7 @@ BinaryOperateMasks::~BinaryOperateMasks() { void BinaryOperateMasks::init() { - std::vector<std::string> operators; - operators.emplace_back("AND"); - operators.emplace_back("OR"); - operators.emplace_back("XOR"); - operators.emplace_back("NOT"); + std::vector<std::string> operators{"AND", "OR", "XOR", "NOT"}; declareProperty(new WorkspaceProperty<DataObjects::MaskWorkspace>( "InputWorkspace1", "", Direction::Input), diff --git a/Framework/Algorithms/src/CalculateFlatBackground.cpp b/Framework/Algorithms/src/CalculateFlatBackground.cpp index ebf276d383c..4aa404389ce 100644 --- a/Framework/Algorithms/src/CalculateFlatBackground.cpp +++ b/Framework/Algorithms/src/CalculateFlatBackground.cpp @@ -46,9 +46,7 @@ void CalculateFlatBackground::init() { new ArrayProperty<int>("WorkspaceIndexList"), "Indices of the spectra that will have their background removed\n" "default: modify all spectra"); - std::vector<std::string> modeOptions; - modeOptions.emplace_back("Linear Fit"); - modeOptions.emplace_back("Mean"); + std::vector<std::string> modeOptions{"Linear Fit", "Mean"}; declareProperty("Mode", "Linear Fit", boost::make_shared<StringListValidator>(modeOptions), "The background count rate is estimated either by taking a " @@ -56,9 +54,8 @@ void CalculateFlatBackground::init() { "linear fit (default: Linear Fit)"); // Property to determine whether we subtract the background or just return the // background. - std::vector<std::string> outputOptions; - outputOptions.emplace_back("Subtract Background"); - outputOptions.emplace_back("Return Background"); + std::vector<std::string> outputOptions{"Subtract Background", + "Return Background"}; declareProperty("OutputMode", "Subtract Background", boost::make_shared<StringListValidator>(outputOptions), "Once the background has been determined it can either be " diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp index 32809cbc9eb..14d9e9f45b9 100644 --- a/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Framework/Algorithms/src/ConvertUnits.cpp @@ -60,10 +60,7 @@ void ConvertUnits::init() { "The name of the units to convert to (must be one of those " "registered in\n" "the Unit Factory)"); - std::vector<std::string> propOptions; - propOptions.emplace_back("Elastic"); - propOptions.emplace_back("Direct"); - propOptions.emplace_back("Indirect"); + std::vector<std::string> propOptions{"Elastic", "Direct", "Indirect"}; declareProperty("EMode", "Elastic", boost::make_shared<StringListValidator>(propOptions), "The energy mode (default: elastic)"); diff --git a/Framework/Algorithms/src/CopyLogs.cpp b/Framework/Algorithms/src/CopyLogs.cpp index da233c05cda..ac8cc897643 100644 --- a/Framework/Algorithms/src/CopyLogs.cpp +++ b/Framework/Algorithms/src/CopyLogs.cpp @@ -45,10 +45,8 @@ void CopyLogs::init() { "Workspace to copy logs too."); // options for the type of strategy to take - std::vector<std::string> strategies; - strategies.emplace_back("WipeExisting"); - strategies.emplace_back("MergeKeepExisting"); - strategies.emplace_back("MergeReplaceExisting"); + std::vector<std::string> strategies{"WipeExisting", "MergeKeepExisting", + "MergeReplaceExisting"}; auto strategiesValidator = boost::make_shared<StringListValidator>(strategies); diff --git a/Framework/Algorithms/src/CorrectKiKf.cpp b/Framework/Algorithms/src/CorrectKiKf.cpp index d72d3f643bf..47894ff7d7e 100644 --- a/Framework/Algorithms/src/CorrectKiKf.cpp +++ b/Framework/Algorithms/src/CorrectKiKf.cpp @@ -40,9 +40,7 @@ void CorrectKiKf::init() { Direction::Output), "Name of the output workspace, can be the same as the input"); - std::vector<std::string> propOptions; - propOptions.emplace_back("Direct"); - propOptions.emplace_back("Indirect"); + std::vector<std::string> propOptions{"Direct", "Indirect"}; this->declareProperty("EMode", "Direct", boost::make_shared<StringListValidator>(propOptions), "The energy mode (default: Direct)"); diff --git a/Framework/Algorithms/src/CorrectToFile.cpp b/Framework/Algorithms/src/CorrectToFile.cpp index d43544bb329..16ffc056124 100644 --- a/Framework/Algorithms/src/CorrectToFile.cpp +++ b/Framework/Algorithms/src/CorrectToFile.cpp @@ -31,8 +31,7 @@ void CorrectToFile::init() { "The units of the first column of the correction file " "(default wavelength)"); - std::vector<std::string> operations(1, std::string("Divide")); - operations.emplace_back("Multiply"); + std::vector<std::string> operations{"Divide", "Multiply"}; declareProperty("WorkspaceOperation", "Divide", boost::make_shared<Kernel::StringListValidator>(operations), "Allowed values: Divide, Multiply (default is divide)"); diff --git a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp index bdd540d157b..cd3216fa98f 100644 --- a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp +++ b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp @@ -80,12 +80,7 @@ void CreateGroupingWorkspace::init() { "Use / or , to separate multiple groups. " "If empty, then an empty GroupingWorkspace will be created."); - std::vector<std::string> grouping; - grouping.emplace_back(""); - grouping.emplace_back("All"); - grouping.emplace_back("Group"); - grouping.emplace_back("Column"); - grouping.emplace_back("bank"); + std::vector<std::string> grouping{"", "All", "Group", "Column", "bank"}; declareProperty( "GroupDetectorsBy", "", boost::make_shared<StringListValidator>(grouping), "Only used if GroupNames is empty: All detectors as one group, Groups " diff --git a/Framework/Algorithms/src/CreateSampleWorkspace.cpp b/Framework/Algorithms/src/CreateSampleWorkspace.cpp index a79c0da992c..9508bde6f9d 100644 --- a/Framework/Algorithms/src/CreateSampleWorkspace.cpp +++ b/Framework/Algorithms/src/CreateSampleWorkspace.cpp @@ -59,9 +59,7 @@ void CreateSampleWorkspace::init() { declareProperty( new WorkspaceProperty<>("OutputWorkspace", "", Direction::Output), "An output workspace."); - std::vector<std::string> typeOptions; - typeOptions.emplace_back("Histogram"); - typeOptions.emplace_back("Event"); + std::vector<std::string> typeOptions{"Histogram", "Event"}; declareProperty("WorkspaceType", "Histogram", boost::make_shared<StringListValidator>(typeOptions), "The type of workspace to create (default: Histogram)"); diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp index fe08ad1b46e..8add270d1b8 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp @@ -46,9 +46,8 @@ const std::string CreateTransmissionWorkspaceAuto::summary() const { */ void CreateTransmissionWorkspaceAuto::init() { - std::vector<std::string> analysis_modes; - analysis_modes.emplace_back("PointDetectorAnalysis"); - analysis_modes.emplace_back("MultiDetectorAnalysis"); + std::vector<std::string> analysis_modes{"PointDetectorAnalysis", + "MultiDetectorAnalysis"}; declareProperty("AnalysisMode", analysis_modes.at(0), boost::make_shared<StringListValidator>(analysis_modes), "Analysis Mode to Choose", Direction::Input); diff --git a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp index 89fa58c6a8e..97fb09fb4eb 100644 --- a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp +++ b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp @@ -51,9 +51,7 @@ void ExportTimeSeriesLog::init() { declareProperty("LogName", "", "Log's name to filter events."); - std::vector<std::string> units; - units.emplace_back("Seconds"); - units.emplace_back("Nano Seconds"); + std::vector<std::string> units{"Seconds", "Nano Seconds"}; declareProperty( "UnitOfTime", "Seconds", boost::make_shared<Kernel::StringListValidator>(units), diff --git a/Framework/Algorithms/src/FFT.cpp b/Framework/Algorithms/src/FFT.cpp index 9765ab2247d..78df545c301 100644 --- a/Framework/Algorithms/src/FFT.cpp +++ b/Framework/Algorithms/src/FFT.cpp @@ -52,9 +52,7 @@ void FFT::init() { declareProperty("Imaginary", EMPTY_INT(), mustBePositive, "Spectrum number to use as imaginary part for transform"); - std::vector<std::string> fft_dir; - fft_dir.emplace_back("Forward"); - fft_dir.emplace_back("Backward"); + std::vector<std::string> fft_dir{"Forward", "Backward"}; declareProperty("Transform", "Forward", boost::make_shared<StringListValidator>(fft_dir), "Direction of the transform: forward or backward"); diff --git a/Framework/Algorithms/src/FFTSmooth.cpp b/Framework/Algorithms/src/FFTSmooth.cpp index 9c9451c0aa3..4afd41392b7 100644 --- a/Framework/Algorithms/src/FFTSmooth.cpp +++ b/Framework/Algorithms/src/FFTSmooth.cpp @@ -30,9 +30,7 @@ void FFTSmooth::init() { declareProperty("WorkspaceIndex", 0, mustBePositive, "Spectrum index for smoothing"); - std::vector<std::string> type; - // type.emplace_back("Truncation"); - type.emplace_back("Zeroing"); + std::vector<std::string> type{"Zeroing"}; declareProperty("Filter", "Zeroing", boost::make_shared<StringListValidator>(type), "The type of the applied filter"); diff --git a/Framework/Algorithms/src/FFTSmooth2.cpp b/Framework/Algorithms/src/FFTSmooth2.cpp index 871ef78e96b..94dfda67be4 100644 --- a/Framework/Algorithms/src/FFTSmooth2.cpp +++ b/Framework/Algorithms/src/FFTSmooth2.cpp @@ -32,10 +32,7 @@ void FFTSmooth2::init() { declareProperty("WorkspaceIndex", 0, mustBePositive, "Spectrum index for smoothing"); - std::vector<std::string> type; - // type.emplace_back("Truncation"); - type.emplace_back("Zeroing"); - type.emplace_back("Butterworth"); + std::vector<std::string> type{"Zeroing", "Butterworth"}; declareProperty("Filter", "Zeroing", boost::make_shared<StringListValidator>(type), "The type of the applied filter"); diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index 25e210d9e61..f9e9d115cee 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -91,12 +91,8 @@ void FilterEvents::init() { "and continuous. "); // TOF correction - vector<string> corrtypes; - corrtypes.emplace_back("None"); - corrtypes.emplace_back("Customized"); - corrtypes.emplace_back("Direct"); - corrtypes.emplace_back("Elastic"); - corrtypes.emplace_back("Indirect"); + vector<string> corrtypes{"None", "Customized", "Direct", "Elastic", + "Indirect"}; declareProperty("CorrectionToSample", "None", boost::make_shared<StringListValidator>(corrtypes), "Type of correction on neutron events to sample time from " @@ -120,9 +116,7 @@ void FilterEvents::init() { new VisibleWhenProperty("CorrectionToSample", IS_EQUAL_TO, "Direct")); // Algorithm to spectra without detectors - vector<string> spec_no_det; - spec_no_det.emplace_back("Skip"); - spec_no_det.emplace_back("Skip only if TOF correction"); + vector<string> spec_no_det{"Skip", "Skip only if TOF correction"}; declareProperty("SpectrumWithoutDetector", "Skip", boost::make_shared<StringListValidator>(spec_no_det), "Approach to deal with spectrum without detectors. "); diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp index 216ef125e75..99c4ca214c4 100644 --- a/Framework/Algorithms/src/FindPeakBackground.cpp +++ b/Framework/Algorithms/src/FindPeakBackground.cpp @@ -57,10 +57,7 @@ void FindPeakBackground::init() { "The window is the same for all indices in workspace. The " "length must be exactly two."); - std::vector<std::string> bkgdtypes; - bkgdtypes.emplace_back("Flat"); - bkgdtypes.emplace_back("Linear"); - bkgdtypes.emplace_back("Quadratic"); + std::vector<std::string> bkgdtypes{"Flat", "Linear", "Quadratic"}; declareProperty("BackgroundType", "Linear", boost::make_shared<StringListValidator>(bkgdtypes), "Type of Background."); diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp index f4edc653bab..8b035e411bd 100644 --- a/Framework/Algorithms/src/FindPeaks.cpp +++ b/Framework/Algorithms/src/FindPeaks.cpp @@ -92,10 +92,7 @@ void FindPeaks::init() { declareProperty("PeakFunction", "Gaussian", boost::make_shared<StringListValidator>(peakNames)); - std::vector<std::string> bkgdtypes; - bkgdtypes.emplace_back("Flat"); - bkgdtypes.emplace_back("Linear"); - bkgdtypes.emplace_back("Quadratic"); + std::vector<std::string> bkgdtypes{"Flat", "Linear", "Quadratic"}; declareProperty("BackgroundType", "Linear", boost::make_shared<StringListValidator>(bkgdtypes), "Type of Background."); diff --git a/Framework/Algorithms/src/FitPeak.cpp b/Framework/Algorithms/src/FitPeak.cpp index 674804a56c6..f28d3d0a862 100644 --- a/Framework/Algorithms/src/FitPeak.cpp +++ b/Framework/Algorithms/src/FitPeak.cpp @@ -1130,13 +1130,9 @@ void FitPeak::init() { new ArrayProperty<double>("FittedPeakParameterValues", Direction::Output), "Fitted peak parameter values. "); - vector<string> bkgdtypes; - bkgdtypes.emplace_back("Flat"); - bkgdtypes.emplace_back("Flat (A0)"); - bkgdtypes.emplace_back("Linear"); - bkgdtypes.emplace_back("Linear (A0, A1)"); - bkgdtypes.emplace_back("Quadratic"); - bkgdtypes.emplace_back("Quadratic (A0, A1, A2)"); + vector<string> bkgdtypes{"Flat", "Flat (A0)", + "Linear", "Linear (A0, A1)", + "Quadratic", "Quadratic (A0, A1, A2)"}; declareProperty("BackgroundType", "Linear", boost::make_shared<StringListValidator>(bkgdtypes), "Type of Background."); @@ -1193,9 +1189,7 @@ void FitPeak::init() { "from proposed value more than " "the given value, fit is treated as failure. "); - vector<string> costFuncOptions; - costFuncOptions.emplace_back("Chi-Square"); - costFuncOptions.emplace_back("Rwp"); + vector<string> costFuncOptions{"Chi-Square", "Rwp"}; declareProperty("CostFunction", "Chi-Square", Kernel::IValidator_sptr( new Kernel::ListValidator<std::string>(costFuncOptions)), diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index 253fe3bf50e..eed4d7e8167 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -92,10 +92,7 @@ void GenerateEventsFilter::init() { setPropertySettings("TimeInterval", new VisibleWhenProperty("LogName", IS_EQUAL_TO, "")); - std::vector<std::string> timeoptions; - timeoptions.emplace_back("Seconds"); - timeoptions.emplace_back("Nanoseconds"); - timeoptions.emplace_back("Percent"); + std::vector<std::string> timeoptions{"Seconds", "Nanoseconds", "Percent"}; declareProperty( "UnitOfTime", "Seconds", boost::make_shared<Kernel::StringListValidator>(timeoptions), @@ -126,10 +123,7 @@ void GenerateEventsFilter::init() { setPropertySettings("LogValueInterval", new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); - std::vector<std::string> filteroptions; - filteroptions.emplace_back("Both"); - filteroptions.emplace_back("Increase"); - filteroptions.emplace_back("Decrease"); + std::vector<std::string> filteroptions{"Both", "Increase", "Decrease"}; declareProperty( "FilterLogValueByChangingDirection", "Both", boost::make_shared<Kernel::StringListValidator>(filteroptions), @@ -147,10 +141,7 @@ void GenerateEventsFilter::init() { setPropertySettings("TimeTolerance", new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); - vector<string> logboundoptions; - logboundoptions.emplace_back("Centre"); - logboundoptions.emplace_back("Left"); - logboundoptions.emplace_back("Other"); + vector<string> logboundoptions{"Centre", "Left", "Other"}; auto logvalidator = boost::make_shared<StringListValidator>(logboundoptions); declareProperty( "LogBoundary", "Centre", logvalidator, @@ -171,9 +162,7 @@ void GenerateEventsFilter::init() { "Title of output splitters workspace and information workspace."); // Linear or parallel - vector<string> processoptions; - processoptions.emplace_back("Serial"); - processoptions.emplace_back("Parallel"); + vector<string> processoptions{"Serial", "Parallel"}; auto procvalidator = boost::make_shared<StringListValidator>(processoptions); declareProperty( "UseParallelProcessing", "Serial", procvalidator, diff --git a/Framework/Algorithms/src/GenerateIPythonNotebook.cpp b/Framework/Algorithms/src/GenerateIPythonNotebook.cpp index 17c47618350..ef43c3512c3 100644 --- a/Framework/Algorithms/src/GenerateIPythonNotebook.cpp +++ b/Framework/Algorithms/src/GenerateIPythonNotebook.cpp @@ -31,8 +31,7 @@ void GenerateIPythonNotebook::init() { new WorkspaceProperty<Workspace>("InputWorkspace", "", Direction::Input), "An input workspace."); - std::vector<std::string> exts; - exts.emplace_back(".ipynb"); + std::vector<std::string> exts{".ipynb"}; declareProperty(new API::FileProperty("Filename", "", API::FileProperty::OptionalSave, exts), @@ -53,10 +52,8 @@ void GenerateIPythonNotebook::init() { "The filter end time in the format YYYY-MM-DD HH:mm:ss", Direction::Input); - std::vector<std::string> saveVersions; - saveVersions.emplace_back("Specify Old"); - saveVersions.emplace_back("Specify All"); - saveVersions.emplace_back("Specify None"); + std::vector<std::string> saveVersions{"Specify Old", "Specify All", + "Specify None"}; declareProperty( "SpecifyAlgorithmVersions", "Specify Old", boost::make_shared<StringListValidator>(saveVersions), diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp index 4714988546a..e30b238afbd 100644 --- a/Framework/Algorithms/src/GeneratePeaks.cpp +++ b/Framework/Algorithms/src/GeneratePeaks.cpp @@ -69,14 +69,10 @@ void GeneratePeaks::init() { "mapping to PeakParameterNames list. "); // Background properties - std::vector<std::string> bkgdtypes; - bkgdtypes.emplace_back("Auto"); - bkgdtypes.emplace_back("Flat (A0)"); - bkgdtypes.emplace_back("Linear (A0, A1)"); - bkgdtypes.emplace_back("Quadratic (A0, A1, A2)"); - bkgdtypes.emplace_back("Flat"); - bkgdtypes.emplace_back("Linear"); - bkgdtypes.emplace_back("Quadratic"); + std::vector<std::string> bkgdtypes{"Auto", "Flat (A0)", "Linear (A0, A1)", + "Quadratic (A0, A1, A2)", "Flat" + "Linear", + "Quadratic"}; declareProperty("BackgroundType", "Linear", boost::make_shared<StringListValidator>(bkgdtypes), "Type of Background."); diff --git a/Framework/Algorithms/src/GeneratePythonScript.cpp b/Framework/Algorithms/src/GeneratePythonScript.cpp index 453be3b8443..91a80883599 100644 --- a/Framework/Algorithms/src/GeneratePythonScript.cpp +++ b/Framework/Algorithms/src/GeneratePythonScript.cpp @@ -31,8 +31,7 @@ void GeneratePythonScript::init() { new WorkspaceProperty<Workspace>("InputWorkspace", "", Direction::Input), "An input workspace."); - std::vector<std::string> exts; - exts.emplace_back(".py"); + std::vector<std::string> exts{".py"}; declareProperty(new API::FileProperty("Filename", "", API::FileProperty::OptionalSave, exts), @@ -53,10 +52,8 @@ void GeneratePythonScript::init() { "The filter end time in the format YYYY-MM-DD HH:mm:ss", Direction::Input); - std::vector<std::string> saveVersions; - saveVersions.emplace_back("Specify Old"); - saveVersions.emplace_back("Specify All"); - saveVersions.emplace_back("Specify None"); + std::vector<std::string> saveVersions{"Specify Old", "Specify All", + "Specify None"}; declareProperty( "SpecifyAlgorithmVersions", "Specify Old", boost::make_shared<StringListValidator>(saveVersions), diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index 8efe165f907..491ccf9f300 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -159,18 +159,13 @@ void GetDetOffsetsMultiPeaks::init() { "Name of the input Tableworkspace containing peak fit window " "information for each spectrum. "); - std::vector<std::string> peaktypes; - peaktypes.emplace_back("BackToBackExponential"); - peaktypes.emplace_back("Gaussian"); - peaktypes.emplace_back("Lorentzian"); + std::vector<std::string> peaktypes{"BackToBackExponential", "Gaussian", + "Lorentzian"}; declareProperty("PeakFunction", "Gaussian", boost::make_shared<StringListValidator>(peaktypes), "Type of peak to fit"); - std::vector<std::string> bkgdtypes; - bkgdtypes.emplace_back("Flat"); - bkgdtypes.emplace_back("Linear"); - bkgdtypes.emplace_back("Quadratic"); + std::vector<std::string> bkgdtypes{"Flat", "Linear", "Quadratic"}; declareProperty( "BackgroundType", "Linear", boost::make_shared<StringListValidator>(bkgdtypes), diff --git a/Framework/Algorithms/src/GetDetectorOffsets.cpp b/Framework/Algorithms/src/GetDetectorOffsets.cpp index 29b43852cdc..63657b4e09b 100644 --- a/Framework/Algorithms/src/GetDetectorOffsets.cpp +++ b/Framework/Algorithms/src/GetDetectorOffsets.cpp @@ -74,9 +74,7 @@ void GetDetectorOffsets::init() { declareProperty("MaxOffset", 1.0, "Maximum absolute value of offsets; default is 1"); - std::vector<std::string> modes; - modes.emplace_back("Relative"); - modes.emplace_back("Absolute"); + std::vector<std::string> modes{"Relative", "Absolute"}; declareProperty("OffsetMode", "Relative", boost::make_shared<StringListValidator>(modes), diff --git a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp index b9851dbbb6a..22029c70c9b 100644 --- a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp +++ b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp @@ -58,9 +58,8 @@ void GetTimeSeriesLogInformation::init() { declareProperty("LogName", "", "Log's name to filter events."); - std::vector<std::string> timeoptions; - timeoptions.emplace_back("Absolute Time (nano second)"); - timeoptions.emplace_back("Relative Time (second)"); + std::vector<std::string> timeoptions{"Absolute Time (nano second)", + "Relative Time (second)"}; declareProperty( "TimeRangeOption", "Relative Time (second)", boost::make_shared<StringListValidator>(timeoptions), diff --git a/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp b/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp index e41b9e1ead3..054830ee7e3 100644 --- a/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp +++ b/Framework/Algorithms/src/HRPDSlabCanAbsorption.cpp @@ -50,9 +50,7 @@ void HRPDSlabCanAbsorption::init() { "The number of wavelength points for which the numerical integral is\n" "calculated (default: all points)"); - std::vector<std::string> exp_options; - exp_options.emplace_back("Normal"); - exp_options.emplace_back("FastApprox"); + std::vector<std::string> exp_options{"Normal", "FastApprox"}; declareProperty( "ExpMethod", "Normal", boost::make_shared<StringListValidator>(exp_options), diff --git a/Framework/Algorithms/src/ModeratorTzero.cpp b/Framework/Algorithms/src/ModeratorTzero.cpp index 63aa3b81300..68029fa721a 100644 --- a/Framework/Algorithms/src/ModeratorTzero.cpp +++ b/Framework/Algorithms/src/ModeratorTzero.cpp @@ -47,10 +47,7 @@ void ModeratorTzero::init() { "The name of the output workspace"); // declare the instrument scattering mode - std::vector<std::string> EModeOptions; - EModeOptions.emplace_back("Indirect"); - EModeOptions.emplace_back("Direct"); - EModeOptions.emplace_back("Elastic"); + std::vector<std::string> EModeOptions{"Indirect", "Direct", "Elastic"}; this->declareProperty("EMode", "Indirect", boost::make_shared<StringListValidator>(EModeOptions), "The energy mode (default: Indirect)"); diff --git a/Framework/Algorithms/src/PDDetermineCharacterizations.cpp b/Framework/Algorithms/src/PDDetermineCharacterizations.cpp index 00aa12603e5..8d648691225 100644 --- a/Framework/Algorithms/src/PDDetermineCharacterizations.cpp +++ b/Framework/Algorithms/src/PDDetermineCharacterizations.cpp @@ -57,18 +57,8 @@ const std::string PDDetermineCharacterizations::summary() const { * @return The list of expected column names */ std::vector<std::string> getColumnNames() { - std::vector<std::string> names; - names.emplace_back("frequency"); // double - names.emplace_back("wavelength"); // double - names.emplace_back("bank"); // integer - names.emplace_back("container"); // string - names.emplace_back("vanadium"); // string - names.emplace_back("empty"); // string - names.emplace_back("d_min"); // string - names.emplace_back("d_max"); // string - names.emplace_back("tof_min"); // double - names.emplace_back("tof_max"); // double - return names; + return {"frequency", "wavelength", "bank", "container", "vanadium", + "empty", "d_min", "d_max", "tof_min", "tof_max"}; } /// More intesive input checking. @see Algorithm::validateInputs @@ -126,17 +116,13 @@ void PDDetermineCharacterizations::init() { declareProperty(new Kernel::ArrayProperty<int32_t>("NormBackRun", "0"), "Normalization background" + defaultMsg); - std::vector<std::string> defaultFrequencyNames; - defaultFrequencyNames.emplace_back("SpeedRequest1"); - defaultFrequencyNames.emplace_back("Speed1"); - defaultFrequencyNames.emplace_back("frequency"); + std::vector<std::string> defaultFrequencyNames{"SpeedRequest1", "Speed1", + "frequency"}; declareProperty(new Kernel::ArrayProperty<std::string>(FREQ_PROP_NAME, defaultFrequencyNames), "Candidate log names for frequency"); - std::vector<std::string> defaultWavelengthNames; - defaultWavelengthNames.emplace_back("LambdaRequest"); - defaultWavelengthNames.emplace_back("lambda"); + std::vector<std::string> defaultWavelengthNames{"LambdaRequest", "lambda"}; declareProperty(new Kernel::ArrayProperty<std::string>( WL_PROP_NAME, defaultWavelengthNames), "Candidate log names for wave length"); diff --git a/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp b/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp index ef05dc06fa7..edd094e9a61 100644 --- a/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp +++ b/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp @@ -97,12 +97,7 @@ void PlotAsymmetryByLogValue::init() { "The name of the log values which will be used as the x-axis " "in the output workspace."); - std::vector<std::string> optionsLog; - optionsLog.emplace_back("Mean"); - optionsLog.emplace_back("Min"); - optionsLog.emplace_back("Max"); - optionsLog.emplace_back("First"); - optionsLog.emplace_back("Last"); + std::vector<std::string> optionsLog{"Mean", "Min", "Max", "First", "Last"}; declareProperty( "Function", "Last", boost::make_shared<StringListValidator>(optionsLog), "The function to apply: 'Mean', 'Min', 'Max', 'First' or 'Last'."); @@ -111,9 +106,7 @@ void PlotAsymmetryByLogValue::init() { declareProperty("Green", EMPTY_INT(), "The period number for the 'green' data."); - std::vector<std::string> options; - options.emplace_back("Integral"); - options.emplace_back("Differential"); + std::vector<std::string> options{"Integral", "Differential"}; declareProperty("Type", "Integral", boost::make_shared<StringListValidator>(options), "The calculation type: 'Integral' or 'Differential'."); @@ -135,10 +128,8 @@ void PlotAsymmetryByLogValue::init() { "available. The backward will use the second of these " "groups."); - std::vector<std::string> deadTimeCorrTypes; - deadTimeCorrTypes.emplace_back("None"); - deadTimeCorrTypes.emplace_back("FromRunData"); - deadTimeCorrTypes.emplace_back("FromSpecifiedFile"); + std::vector<std::string> deadTimeCorrTypes{"None", "FromRunData", + "FromSpecifiedFile"}; declareProperty("DeadTimeCorrType", deadTimeCorrTypes[0], boost::make_shared<StringListValidator>(deadTimeCorrTypes), diff --git a/Framework/Algorithms/src/PolynomialCorrection.cpp b/Framework/Algorithms/src/PolynomialCorrection.cpp index 9c80fd2d2a5..19907dbb77e 100644 --- a/Framework/Algorithms/src/PolynomialCorrection.cpp +++ b/Framework/Algorithms/src/PolynomialCorrection.cpp @@ -29,9 +29,7 @@ void PolynomialCorrection::defineProperties() { "Array Property containing the coefficients of the polynomial correction " "function in ascending powers of X. Can be given as a comma separated " "list in string form."); - std::vector<std::string> propOptions; - propOptions.emplace_back("Multiply"); - propOptions.emplace_back("Divide"); + std::vector<std::string> propOptions{"Multiply", "Divide"}; declareProperty("Operation", "Multiply", boost::make_shared<StringListValidator>(propOptions), "The operation with which the correction is applied to the " diff --git a/Framework/Algorithms/src/RRFMuon.cpp b/Framework/Algorithms/src/RRFMuon.cpp index 73292be4261..7709d5485bc 100644 --- a/Framework/Algorithms/src/RRFMuon.cpp +++ b/Framework/Algorithms/src/RRFMuon.cpp @@ -31,10 +31,7 @@ void RRFMuon::init() { new PropertyWithValue<double>("Frequency", 0, Direction::Input), "Frequency of the oscillations"); - std::vector<std::string> unitOptions; - unitOptions.emplace_back("MHz"); - unitOptions.emplace_back("Gauss"); - unitOptions.emplace_back("Mrad/s"); + std::vector<std::string> unitOptions{"MHz", "Gauss", "Mrad/s"}; declareProperty("FrequencyUnits", "MHz", boost::make_shared<StringListValidator>(unitOptions), "The frequency units"); diff --git a/Framework/Algorithms/src/ReadGroupsFromFile.cpp b/Framework/Algorithms/src/ReadGroupsFromFile.cpp index 91b07c8f745..b1034751578 100644 --- a/Framework/Algorithms/src/ReadGroupsFromFile.cpp +++ b/Framework/Algorithms/src/ReadGroupsFromFile.cpp @@ -58,9 +58,7 @@ void ReadGroupsFromFile::init() { "Either as a XML grouping file (see [[GroupDetectors]]) or as a " "[[CalFile]] (.cal extension)."); // Flag to consider unselected detectors in the cal file - std::vector<std::string> select; - select.emplace_back("True"); - select.emplace_back("False"); + std::vector<std::string> select{"True", "False"}; declareProperty("ShowUnselected", "True", boost::make_shared<StringListValidator>(select), "Whether to show detectors that are not in any group"); diff --git a/Framework/Algorithms/src/RealFFT.cpp b/Framework/Algorithms/src/RealFFT.cpp index 2c69a3b7ff2..c153b931960 100644 --- a/Framework/Algorithms/src/RealFFT.cpp +++ b/Framework/Algorithms/src/RealFFT.cpp @@ -49,9 +49,7 @@ void RealFFT::init() { "WorkspaceIndex", 0, mustBePositive, "The index of the spectrum in the input workspace to transform."); - std::vector<std::string> fft_dir; - fft_dir.emplace_back("Forward"); - fft_dir.emplace_back("Backward"); + std::vector<std::string> fft_dir{"Forward", "Backward"}; declareProperty( "Transform", "Forward", boost::make_shared<StringListValidator>(fft_dir), "The direction of the transform: \"Forward\" or \"Backward\"."); diff --git a/Framework/Algorithms/src/RecordPythonScript.cpp b/Framework/Algorithms/src/RecordPythonScript.cpp index 5039e6cd307..29b86d8435e 100644 --- a/Framework/Algorithms/src/RecordPythonScript.cpp +++ b/Framework/Algorithms/src/RecordPythonScript.cpp @@ -25,11 +25,9 @@ RecordPythonScript::RecordPythonScript() /** Initialize the algorithm's properties. */ void RecordPythonScript::init() { - std::vector<std::string> exts; - exts.emplace_back(".py"); declareProperty( - new API::FileProperty("Filename", "", API::FileProperty::Save, exts), + new API::FileProperty("Filename", "", API::FileProperty::Save, {".py"}), "The file into which the Python script will be generated."); } diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp index 1795d19d1b1..ab3278e5374 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp @@ -57,9 +57,8 @@ void ReflectometryReductionOneAuto::init() { "InputWorkspace", "", Direction::Input, PropertyMode::Mandatory), "Input run in TOF or Lambda"); - std::vector<std::string> analysis_modes; - analysis_modes.emplace_back("PointDetectorAnalysis"); - analysis_modes.emplace_back("MultiDetectorAnalysis"); + std::vector<std::string> analysis_modes{"PointDetectorAnalysis", + "MultiDetectorAnalysis"}; auto analysis_mode_validator = boost::make_shared<StringListValidator>(analysis_modes); diff --git a/Framework/Algorithms/src/RemoveBins.cpp b/Framework/Algorithms/src/RemoveBins.cpp index cc7fb09cdfa..fcb1d36ee50 100644 --- a/Framework/Algorithms/src/RemoveBins.cpp +++ b/Framework/Algorithms/src/RemoveBins.cpp @@ -50,9 +50,7 @@ void RemoveBins::init() { "The unit in which XMin/XMax are being given. If not given, " "it will peak the unit from the Input workspace X unit."); - std::vector<std::string> propOptions; - propOptions.emplace_back("None"); - propOptions.emplace_back("Linear"); + std::vector<std::string> propOptions{"None", "Linear"}; declareProperty("Interpolation", "None", boost::make_shared<StringListValidator>(propOptions), "Whether mid-axis bins should be interpolated linearly " diff --git a/Framework/Algorithms/src/SetInstrumentParameter.cpp b/Framework/Algorithms/src/SetInstrumentParameter.cpp index 48a3e4f50b8..49febf5ad3a 100644 --- a/Framework/Algorithms/src/SetInstrumentParameter.cpp +++ b/Framework/Algorithms/src/SetInstrumentParameter.cpp @@ -60,9 +60,7 @@ void SetInstrumentParameter::init() { boost::make_shared<MandatoryValidator<std::string>>(), "The name that will identify the parameter"); - std::vector<std::string> propOptions; - propOptions.emplace_back("String"); - propOptions.emplace_back("Number"); + std::vector<std::string> propOptions{"String", "Number"}; declareProperty("ParameterType", "String", boost::make_shared<StringListValidator>(propOptions), "The type that the parameter value will be."); diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp index a600a6f89b3..32e7e2a3629 100644 --- a/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -63,11 +63,8 @@ void SmoothNeighbours::init() { auto mustBePositive = boost::make_shared<BoundedValidator<int>>(); mustBePositive->setLower(0); - std::vector<std::string> propOptions; - propOptions.emplace_back("Flat"); - propOptions.emplace_back("Linear"); - propOptions.emplace_back("Parabolic"); - propOptions.emplace_back("Gaussian"); + std::vector<std::string> propOptions{"Flat", "Linear", "Parabolic", + "Gaussian"}; declareProperty("WeightedSum", "Flat", boost::make_shared<StringListValidator>(propOptions), "What sort of Weighting scheme to use?\n" @@ -130,9 +127,7 @@ void SmoothNeighbours::init() { // -- Non-uniform properties // ---------------------------------------------------------------------- - std::vector<std::string> radiusPropOptions; - radiusPropOptions.emplace_back("Meters"); - radiusPropOptions.emplace_back("NumberOfPixels"); + std::vector<std::string> radiusPropOptions{"Meters", "NumberOfPixels"}; declareProperty( "RadiusUnits", "Meters", boost::make_shared<StringListValidator>(radiusPropOptions), diff --git a/Framework/Algorithms/src/SofQW.cpp b/Framework/Algorithms/src/SofQW.cpp index 7d9d4421bf4..cf37874d2ec 100644 --- a/Framework/Algorithms/src/SofQW.cpp +++ b/Framework/Algorithms/src/SofQW.cpp @@ -96,9 +96,7 @@ void SofQW::createCommonInputProperties(API::Algorithm &alg) { "The bin parameters to use for the q axis (in the format used by the " ":ref:`algm-Rebin` algorithm)."); - std::vector<std::string> propOptions; - propOptions.emplace_back("Direct"); - propOptions.emplace_back("Indirect"); + std::vector<std::string> propOptions{"Direct", "Indirect"}; alg.declareProperty("EMode", "", boost::make_shared<StringListValidator>(propOptions), "The energy transfer analysis mode (Direct/Indirect)"); diff --git a/Framework/Algorithms/src/SofQWCentre.cpp b/Framework/Algorithms/src/SofQWCentre.cpp index f035bd2cf5a..a1f88ad3d45 100644 --- a/Framework/Algorithms/src/SofQWCentre.cpp +++ b/Framework/Algorithms/src/SofQWCentre.cpp @@ -70,9 +70,7 @@ void SofQWCentre::createInputProperties(API::Algorithm &alg) { "The bin parameters to use for the q axis (in the format used by the " ":ref:`algm-Rebin` algorithm)."); - std::vector<std::string> propOptions; - propOptions.emplace_back("Direct"); - propOptions.emplace_back("Indirect"); + std::vector<std::string> propOptions{"Direct", "Indirect"}; alg.declareProperty("EMode", "", boost::make_shared<StringListValidator>(propOptions), "The energy transfer analysis mode (Direct/Indirect)"); diff --git a/Framework/Algorithms/src/SortEvents.cpp b/Framework/Algorithms/src/SortEvents.cpp index 60c142178e6..db1738cdd2e 100644 --- a/Framework/Algorithms/src/SortEvents.cpp +++ b/Framework/Algorithms/src/SortEvents.cpp @@ -27,10 +27,8 @@ void SortEvents::init() { Direction::InOut), "EventWorkspace to be sorted."); - std::vector<std::string> propOptions; - propOptions.emplace_back("X Value"); - propOptions.emplace_back("Pulse Time"); - propOptions.emplace_back("Pulse Time + TOF"); + std::vector<std::string> propOptions{"X Value", "Pulse Time", + "Pulse Time + TOF"}; declareProperty("SortBy", "X Value", boost::make_shared<StringListValidator>(propOptions), "How to sort the events:\n" diff --git a/Framework/Algorithms/src/StripPeaks.cpp b/Framework/Algorithms/src/StripPeaks.cpp index 40b0e8b0402..db9b8546983 100644 --- a/Framework/Algorithms/src/StripPeaks.cpp +++ b/Framework/Algorithms/src/StripPeaks.cpp @@ -47,9 +47,7 @@ void StripPeaks::init() { "peak positions. Non-positive value indicates that this " "option is turned off."); - std::vector<std::string> bkgdtypes; - bkgdtypes.emplace_back("Linear"); - bkgdtypes.emplace_back("Quadratic"); + std::vector<std::string> bkgdtypes{"Linear", "Quadratic"}; declareProperty( "BackgroundType", "Linear", boost::make_shared<StringListValidator>(bkgdtypes), diff --git a/Framework/Algorithms/src/StripVanadiumPeaks2.cpp b/Framework/Algorithms/src/StripVanadiumPeaks2.cpp index 7ac7f5ebf77..f235a74d3ee 100644 --- a/Framework/Algorithms/src/StripVanadiumPeaks2.cpp +++ b/Framework/Algorithms/src/StripVanadiumPeaks2.cpp @@ -49,9 +49,7 @@ void StripVanadiumPeaks2::init() { "candidates. Passed through to " "FindPeaks. Default 4."); - std::vector<std::string> bkgdtypes; - bkgdtypes.emplace_back("Linear"); - bkgdtypes.emplace_back("Quadratic"); + std::vector<std::string> bkgdtypes{"Linear", "Quadratic"}; declareProperty("BackgroundType", "Linear", boost::make_shared<StringListValidator>(bkgdtypes), "The type of background of the histogram. Present choices " diff --git a/Framework/Algorithms/src/SumRowColumn.cpp b/Framework/Algorithms/src/SumRowColumn.cpp index 3405a548ab3..e0f8f38ecf5 100644 --- a/Framework/Algorithms/src/SumRowColumn.cpp +++ b/Framework/Algorithms/src/SumRowColumn.cpp @@ -25,9 +25,7 @@ void SumRowColumn::init() { "The name of the workspace in which to store the result."); // Need to select whether to sum rows or columns - std::vector<std::string> orientation; - orientation.emplace_back("D_H"); - orientation.emplace_back("D_V"); + std::vector<std::string> orientation{"D_H", "D_V"}; declareProperty("Orientation", "", boost::make_shared<StringListValidator>(orientation), "Whether to sum rows (D_H) or columns (D_V)."); diff --git a/Framework/Algorithms/test/CheckWorkspacesMatchTest.h b/Framework/Algorithms/test/CheckWorkspacesMatchTest.h index 49b778014b8..f1ca5209b3e 100644 --- a/Framework/Algorithms/test/CheckWorkspacesMatchTest.h +++ b/Framework/Algorithms/test/CheckWorkspacesMatchTest.h @@ -456,10 +456,7 @@ public: std::size_t numBins[dims] = {10, 10, 10}; Mantid::coord_t min[dims] = {0.0, 0.0, 0.0}; Mantid::coord_t max[dims] = {10.0, 10.0, 10.0}; - std::vector<std::string> names; - names.emplace_back("h"); - names.emplace_back("k"); - names.emplace_back("l"); + std::vector<std::string> names{"h", "k", "l"}; MDHistoWorkspace_sptr mdhws2 = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral( 3, 5.0, 1.0, numBins, min, max, names); diff --git a/Framework/Algorithms/test/CompareWorkspacesTest.h b/Framework/Algorithms/test/CompareWorkspacesTest.h index e999c03ee43..52b117f59ba 100644 --- a/Framework/Algorithms/test/CompareWorkspacesTest.h +++ b/Framework/Algorithms/test/CompareWorkspacesTest.h @@ -439,10 +439,7 @@ public: std::size_t numBins[dims] = {10, 10, 10}; Mantid::coord_t min[dims] = {0.0, 0.0, 0.0}; Mantid::coord_t max[dims] = {10.0, 10.0, 10.0}; - std::vector<std::string> names; - names.emplace_back("h"); - names.emplace_back("k"); - names.emplace_back("l"); + std::vector<std::string> names{"h", "k", "l"}; MDHistoWorkspace_sptr mdhws2 = MDEventsTestHelper::makeFakeMDHistoWorkspaceGeneral( 3, 5.0, 1.0, numBins, min, max, names); @@ -1007,11 +1004,8 @@ public: zero->mutableRun().addProperty( new PropertyWithValue<double>("ExtraLog", 10)); - std::map<std::string, std::string> otherProps; - otherProps.emplace("CheckSample", "1"); - doGroupTest(groupOneName, groupTwoName, "Different numbers of logs", - otherProps); + {{"CheckSample", "1"}}); // Cleanup cleanupGroup(groupOne); diff --git a/Framework/Algorithms/test/CreateWorkspaceTest.h b/Framework/Algorithms/test/CreateWorkspaceTest.h index d2a8d0709a8..202f2262779 100644 --- a/Framework/Algorithms/test/CreateWorkspaceTest.h +++ b/Framework/Algorithms/test/CreateWorkspaceTest.h @@ -25,8 +25,7 @@ public: dataEYX.push_back(i * 1.234); } - std::vector<std::string> qvals; - qvals.emplace_back("9.876"); + std::vector<std::string> qvals{"9.876"}; TS_ASSERT_THROWS_NOTHING(alg.setProperty<int>("NSpec", 1)); TS_ASSERT_THROWS_NOTHING( @@ -89,11 +88,8 @@ public: alg.setPropertyValue("UnitX", "Wavelength"); alg.setPropertyValue("VerticalAxisUnit", "Text"); - std::vector<std::string> textAxis; - textAxis.emplace_back("I've Got"); - textAxis.emplace_back("A Lovely"); - textAxis.emplace_back("Bunch Of"); - textAxis.emplace_back("Coconuts"); + std::vector<std::string> textAxis{"I've Got", "A Lovely", "Bunch Of", + "Coconuts"}; alg.setProperty<std::vector<std::string>>("VerticalAxisValues", textAxis); alg.setProperty<int>("NSpec", 4); diff --git a/Framework/Algorithms/test/MergeRunsTest.h b/Framework/Algorithms/test/MergeRunsTest.h index 612f5eabf11..fa271b8eefb 100644 --- a/Framework/Algorithms/test/MergeRunsTest.h +++ b/Framework/Algorithms/test/MergeRunsTest.h @@ -450,9 +450,7 @@ public: GroupWorkspaces grpwsalg; grpwsalg.initialize(); - std::vector<std::string> input; - input.emplace_back("ev1"); - input.emplace_back("ev2"); + std::vector<std::string> input{"ev1", "ev2"}; TS_ASSERT_THROWS_NOTHING(grpwsalg.setProperty("InputWorkspaces", input)); TS_ASSERT_THROWS_NOTHING( grpwsalg.setProperty("OutputWorkspace", "ev1_and_ev2_workspace_group")); diff --git a/Framework/Algorithms/test/RebinByTimeAtSampleTest.h b/Framework/Algorithms/test/RebinByTimeAtSampleTest.h index 4a9ad285658..df703fc6d5d 100644 --- a/Framework/Algorithms/test/RebinByTimeAtSampleTest.h +++ b/Framework/Algorithms/test/RebinByTimeAtSampleTest.h @@ -200,10 +200,8 @@ public: V3D sample(L1, 0, 0); // Sample at L1 V3D source(0, 0, 0); - std::vector<V3D> detectorPositions; - detectorPositions.emplace_back(L2_spec1, 0, 0); - detectorPositions.emplace_back(L2_spec2, 0, 0); - detectorPositions.emplace_back(L2_spec3, 0, 0); + std::vector<V3D> detectorPositions{ + {L2_spec1, 0, 0}, {L2_spec2, 0, 0}, {L2_spec3, 0, 0}}; auto inWS = createSinglePulseEventWorkspace(source, sample, detectorPositions, tofValues); diff --git a/Framework/Algorithms/test/SpatialGroupingTest.h b/Framework/Algorithms/test/SpatialGroupingTest.h index 022cf113ae4..6bffcd9cd60 100644 --- a/Framework/Algorithms/test/SpatialGroupingTest.h +++ b/Framework/Algorithms/test/SpatialGroupingTest.h @@ -78,16 +78,18 @@ public: TS_ASSERT(input.is_open()); // Testing file - std::vector<std::string> expected; - expected.emplace_back("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); - expected.push_back( - "<!-- XML Grouping File created by SpatialGrouping Algorithm -->"); - expected.emplace_back("<detector-grouping>"); - expected.push_back( - "<group name=\"group1\"><detids val=\"1,2,3,4,5,6,7,8,9\"/></group>"); - expected.emplace_back("<group name=\"group2\"><detids " - "val=\"10,11,12,13,14,15,16,17,18\"/></group>"); - expected.emplace_back("</detector-grouping>"); + std:: + vector<std::string> expected{"<?xml version=\"1.0\" encoding=\"UTF-8\" " + "?>", + "<!-- XML Grouping File created by " + "SpatialGrouping Algorithm -->", + "<detector-grouping>", + "<group name=\"group1\"><detids " + "val=\"1,2,3,4,5,6,7,8,9\"/></group>", + "<group name=\"group2\"><detids " + "val=\"10,11,12,13,14,15,16,17,18\"/></" + "group>", + "</detector-grouping>"}; std::vector<std::string>::iterator iter = expected.begin(); diff --git a/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h b/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h index 9e3a2d35125..31b60b492b2 100644 --- a/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h +++ b/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h @@ -84,10 +84,7 @@ public: getNewInstrument(DataObjects::PeaksWorkspace_sptr Peaks) const; std::vector<std::string> getAttributeNames() const { - std::vector<std::string> Res; - Res.emplace_back("OptRuns"); - Res.emplace_back("PeakWorkspaceName"); - return Res; + return {"OptRuns", "PeakWorkspaceName"}; } IFunction::Attribute getAttribute(const std::string &attName) const { diff --git a/Framework/Crystal/src/FilterPeaks.cpp b/Framework/Crystal/src/FilterPeaks.cpp index 3d504282438..c4642b37330 100644 --- a/Framework/Crystal/src/FilterPeaks.cpp +++ b/Framework/Crystal/src/FilterPeaks.cpp @@ -60,12 +60,8 @@ void FilterPeaks::init() { Direction::Output), "The filtered workspace"); - std::vector<std::string> filters; - filters.emplace_back("h+k+l"); - filters.emplace_back("h^2+k^2+l^2"); - filters.emplace_back("Intensity"); - filters.emplace_back("Signal/Noise"); - filters.emplace_back("QMod"); + std::vector<std::string> filters{"h+k+l", "h^2+k^2+l^2", "Intensity", + "Signal/Noise", "QMod"}; declareProperty("FilterVariable", "", boost::make_shared<StringListValidator>(filters), "The variable on which to filter the peaks"); @@ -74,12 +70,7 @@ void FilterPeaks::init() { boost::make_shared<MandatoryValidator<double>>(), "The value of the FilterVariable to compare each peak to"); - std::vector<std::string> operation; - operation.emplace_back("<"); - operation.emplace_back(">"); - operation.emplace_back("="); - operation.emplace_back("<="); - operation.emplace_back(">="); + std::vector<std::string> operation{"<", ">", "=", "<=", ">="}; declareProperty("Operator", "<", boost::make_shared<StringListValidator>(operation), ""); } diff --git a/Framework/Crystal/src/OptimizeExtinctionParameters.cpp b/Framework/Crystal/src/OptimizeExtinctionParameters.cpp index fbbee7ab49b..de1769271aa 100644 --- a/Framework/Crystal/src/OptimizeExtinctionParameters.cpp +++ b/Framework/Crystal/src/OptimizeExtinctionParameters.cpp @@ -60,17 +60,11 @@ void OptimizeExtinctionParameters::init() { declareProperty(new WorkspaceProperty<PeaksWorkspace>("InputWorkspace", "", Direction::InOut), "An input PeaksWorkspace with an instrument."); - std::vector<std::string> corrOptions; - corrOptions.emplace_back("Type I Zachariasen"); - corrOptions.emplace_back("Type I Gaussian"); - corrOptions.emplace_back("Type I Lorentzian"); - corrOptions.emplace_back("Type II Zachariasen"); - corrOptions.emplace_back("Type II Gaussian"); - corrOptions.emplace_back("Type II Lorentzian"); - corrOptions.emplace_back("Type I&II Zachariasen"); - corrOptions.emplace_back("Type I&II Gaussian"); - corrOptions.emplace_back("Type I&II Lorentzian"); - corrOptions.emplace_back("None, Scaling Only"); + std::vector<std::string> corrOptions{ + "Type I Zachariasen", "Type I Gaussian", "Type I Lorentzian", + "Type II Zachariasen", "Type II Gaussian", "Type II Lorentzian", + "Type I&II Zachariasen", "Type I&II Gaussian", "Type I&II Lorentzian", + "None, Scaling Only"}; declareProperty("ExtinctionCorrectionType", corrOptions[0], boost::make_shared<StringListValidator>(corrOptions), "Select the type of extinction correction."); diff --git a/Framework/Crystal/src/SCDCalibratePanels.cpp b/Framework/Crystal/src/SCDCalibratePanels.cpp index 9d124af9628..8b9322f460d 100644 --- a/Framework/Crystal/src/SCDCalibratePanels.cpp +++ b/Framework/Crystal/src/SCDCalibratePanels.cpp @@ -1330,10 +1330,8 @@ void SCDCalibratePanels::init() { "PeakWorkspace", "", Kernel::Direction::Input), "Workspace of Indexed Peaks"); - vector<string> choices; - choices.emplace_back("OnePanelPerGroup"); - choices.emplace_back("AllPanelsInOneGroup"); - choices.emplace_back("SpecifyGroups"); + vector<string> choices{"OnePanelPerGroup", "AllPanelsInOneGroup", + "SpecifyGroups"}; declareProperty(string("PanelGroups"), string("OnePanelPerGroup"), boost::make_shared<Kernel::StringListValidator>(choices), "Select grouping of Panels"); @@ -1381,19 +1379,16 @@ void SCDCalibratePanels::init() { declareProperty("SampleZoffset", 0.0, "Specify Sample z offset"); // ---------- preprocessing - vector<string> preProcessOptions; - preProcessOptions.push_back(string("A)No PreProcessing")); - preProcessOptions.emplace_back("B)Apply a ISAW.DetCal File"); - preProcessOptions.emplace_back("C)Apply a LoadParameter.xml type file"); + vector<string> preProcessOptions{"A)No PreProcessing", + "B)Apply a ISAW.DetCal File", + "C)Apply a LoadParameter.xml type file"}; declareProperty( string("PreProcessInstrument"), string("A)No PreProcessing"), boost::make_shared<Kernel::StringListValidator>(preProcessOptions), "Select PreProcessing info"); - vector<string> exts2; - exts2.emplace_back(".DetCal"); - exts2.emplace_back(".xml"); + vector<string> exts2{".DetCal", ".xml"}; declareProperty(new FileProperty("PreProcFilename", "", FileProperty::OptionalLoad, exts2), "Path to file with preprocessing information"); diff --git a/Framework/Crystal/src/SaveHKL.cpp b/Framework/Crystal/src/SaveHKL.cpp index 944633fe1fd..14b4b5a14ea 100644 --- a/Framework/Crystal/src/SaveHKL.cpp +++ b/Framework/Crystal/src/SaveHKL.cpp @@ -81,10 +81,7 @@ void SaveHKL::init() { new FileProperty("Filename", "", FileProperty::Save, {".hkl"}), "Path to an hkl file to save."); - std::vector<std::string> histoTypes; - histoTypes.emplace_back("Bank"); - histoTypes.emplace_back("RunNumber"); - histoTypes.emplace_back(""); + std::vector<std::string> histoTypes{"Bank", "RunNumber", ""}; declareProperty("SortBy", histoTypes[2], boost::make_shared<StringListValidator>(histoTypes), "Sort the histograms by bank, run number or both (default)."); diff --git a/Framework/Crystal/src/SaveIsawPeaks.cpp b/Framework/Crystal/src/SaveIsawPeaks.cpp index f738ac14874..76e1bd62152 100644 --- a/Framework/Crystal/src/SaveIsawPeaks.cpp +++ b/Framework/Crystal/src/SaveIsawPeaks.cpp @@ -44,9 +44,7 @@ void SaveIsawPeaks::init() { declareProperty("AppendFile", false, "Append to file if true.\n" "If false, new file (default)."); - std::vector<std::string> exts; - exts.emplace_back(".peaks"); - exts.emplace_back(".integrate"); + std::vector<std::string> exts{".peaks", ".integrate"}; declareProperty(new FileProperty("Filename", "", FileProperty::Save, {".peaks", ".integrate"}), diff --git a/Framework/Crystal/src/SaveLauenorm.cpp b/Framework/Crystal/src/SaveLauenorm.cpp index e2718cfe2fa..1dca4d93ad8 100644 --- a/Framework/Crystal/src/SaveLauenorm.cpp +++ b/Framework/Crystal/src/SaveLauenorm.cpp @@ -55,10 +55,8 @@ void SaveLauenorm::init() { declareProperty("MinWavelength", 0.0, "Minimum wavelength (Angstroms)"); declareProperty("MaxWavelength", EMPTY_DBL(), "Maximum wavelength (Angstroms)"); - std::vector<std::string> histoTypes; - histoTypes.emplace_back("Bank"); - histoTypes.emplace_back("RunNumber"); - histoTypes.emplace_back("Both Bank and RunNumber"); + std::vector<std::string> histoTypes{"Bank", "RunNumber", + "Both Bank and RunNumber"}; declareProperty("SortFilesBy", histoTypes[0], boost::make_shared<StringListValidator>(histoTypes), "Sort into files by bank(default), run number or both."); diff --git a/Framework/Crystal/src/SetGoniometer.cpp b/Framework/Crystal/src/SetGoniometer.cpp index 9b6ec57051d..399ab3a7826 100644 --- a/Framework/Crystal/src/SetGoniometer.cpp +++ b/Framework/Crystal/src/SetGoniometer.cpp @@ -37,9 +37,8 @@ void SetGoniometer::init() { new WorkspaceProperty<>("Workspace", "", Direction::InOut), "An workspace that will be modified with the new goniometer created."); - std::vector<std::string> gonOptions; - gonOptions.emplace_back("None, Specify Individually"); - gonOptions.emplace_back("Universal"); + std::vector<std::string> gonOptions{"None, Specify Individually", + "Universal"}; declareProperty("Goniometers", gonOptions[0], boost::make_shared<StringListValidator>(gonOptions), "Set the axes and motor names according to goniometers that " diff --git a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp index 97b17e3234a..e40d598310d 100644 --- a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp +++ b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp @@ -65,11 +65,8 @@ void StatisticsOfPeaksWorkspace::init() { declareProperty(new WorkspaceProperty<ITableWorkspace>( "StatisticsTable", "StatisticsTable", Direction::Output), "An output table workspace for the statistics of the peaks."); - std::vector<std::string> sortTypes; - sortTypes.emplace_back("ResolutionShell"); - sortTypes.emplace_back("Bank"); - sortTypes.emplace_back("RunNumber"); - sortTypes.emplace_back("Overall"); + std::vector<std::string> sortTypes{"ResolutionShell", "Bank", "RunNumber", + "Overall"}; declareProperty("SortBy", sortTypes[0], boost::make_shared<StringListValidator>(sortTypes), "Sort the peaks by bank, run number(default) or only overall " diff --git a/Framework/Crystal/src/TOFExtinction.cpp b/Framework/Crystal/src/TOFExtinction.cpp index 877f7093e25..c82b0d6917d 100644 --- a/Framework/Crystal/src/TOFExtinction.cpp +++ b/Framework/Crystal/src/TOFExtinction.cpp @@ -41,17 +41,11 @@ void TOFExtinction::init() { "An input PeaksWorkspace with an instrument."); declareProperty(new WorkspaceProperty<PeaksWorkspace>("OutputWorkspace", "", Direction::Output)); - std::vector<std::string> corrOptions; - corrOptions.emplace_back("Type I Zachariasen"); - corrOptions.emplace_back("Type I Gaussian"); - corrOptions.emplace_back("Type I Lorentzian"); - corrOptions.emplace_back("Type II Zachariasen"); - corrOptions.emplace_back("Type II Gaussian"); - corrOptions.emplace_back("Type II Lorentzian"); - corrOptions.emplace_back("Type I&II Zachariasen"); - corrOptions.emplace_back("Type I&II Gaussian"); - corrOptions.emplace_back("Type I&II Lorentzian"); - corrOptions.emplace_back("None, Scaling Only"); + std::vector<std::string> corrOptions{ + "Type I Zachariasen", "Type I Gaussian", "Type I Lorentzian", + "Type II Zachariasen", "Type II Gaussian", "Type II Lorentzian", + "Type I&II Zachariasen", "Type I&II Gaussian", "Type I&II Lorentzian", + "None, Scaling Only"}; declareProperty("ExtinctionCorrectionType", corrOptions[0], boost::make_shared<StringListValidator>(corrOptions), "Select the type of extinction correction."); diff --git a/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h b/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h index f8ba7c8beba..9fb958cbb3b 100644 --- a/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h +++ b/Framework/Crystal/test/IntegratePeaksUsingClustersTest.h @@ -107,7 +107,7 @@ public: void test_threshold_too_high_gives_no_peaks() { // ------- Make the fake input - std::vector<V3D> hklValues{V3D(2, 2, 2)}; + std::vector<V3D> hklValues{{2, 2, 2}}; const double peakRadius = 1; const double threshold = 10000; // Threshold will filter out everything // given the nEventsInPeak restriction. @@ -138,7 +138,7 @@ public: void test_integrate_single_peak() { // ------- Make the fake input - std::vector<V3D> hklValues{V3D(2, 2, 2)}; + std::vector<V3D> hklValues{{2, 2, 2}}; const double peakRadius = 1; const double threshold = 100; const size_t nEventsInPeak = 10000; @@ -179,7 +179,7 @@ public: void test_integrate_two_separate_but_identical_peaks() { // ------- Make the fake input // Add several peaks. These are NOT overlapping. - std::vector<V3D> hklValues{V3D(1, 1, 1), V3D(6, 6, 6)}; + std::vector<V3D> hklValues{{1, 1, 1}, {6, 6, 6}}; const double peakRadius = 1; const double threshold = 100; const size_t nEventsInPeak = 10000; @@ -229,7 +229,7 @@ public: void test_integrate_two_peaks_of_different_magnitude() { // ------- Make the fake input // Add several peaks. These are NOT overlapping. - std::vector<V3D> hklValues{V3D(1, 1, 1), V3D(6, 6, 6)}; + std::vector<V3D> hklValues{{1, 1, 1}, {6, 6, 6}}; const double peakRadius = 1; const double threshold = 100; std::vector<size_t> nEventsInPeakVec; diff --git a/Framework/Crystal/test/SortHKLTest.h b/Framework/Crystal/test/SortHKLTest.h index d951e857043..a2206c88c62 100644 --- a/Framework/Crystal/test/SortHKLTest.h +++ b/Framework/Crystal/test/SortHKLTest.h @@ -150,7 +150,7 @@ public: void test_PeaksStatisticsOneObservation() { std::map<V3D, UniqueReflection> uniques{ - {V3D(1, 1, 1), getReflectionWithPeaks({56.0}, {4.5}, 1.0)}}; + {{1, 1, 1}, getReflectionWithPeaks({56.0}, {4.5}, 1.0)}}; PeaksStatistics statistics(uniques, 1); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 1); @@ -166,8 +166,8 @@ public: void test_PeaksStatisticsOneObservationTwoUnique() { 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))}}; + {{1, 1, 1}, getReflectionWithPeaks({56.0}, {4.5}, 1.0)}, + {{1, 1, 2}, UniqueReflection(V3D(1, 1, 2))}}; PeaksStatistics statistics(uniques, 1); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 1); @@ -184,8 +184,8 @@ public: void test_PeaksStatisticsTwoObservationTwoUnique() { 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)}}; + {{1, 1, 1}, getReflectionWithPeaks({10.0}, {1.0}, 1.0)}, + {{1, 1, 2}, getReflectionWithPeaks({20.0}, {1.0}, 2.0)}}; PeaksStatistics statistics(uniques, 2); TS_ASSERT_EQUALS(statistics.m_peaks.size(), 2); @@ -201,7 +201,7 @@ public: void test_PeaksStatisticsTwoObservationOneUnique() { std::map<V3D, UniqueReflection> uniques{ - {V3D(1, 1, 1), getReflectionWithPeaks({10.0, 20.0}, {0.1, 0.1}, 1.0)}}; + {{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); @@ -219,7 +219,7 @@ public: void test_PeaksStatisticsThreeObservationOneUnique() { std::map<V3D, UniqueReflection> uniques{ - {V3D(1, 1, 1), + {{1, 1, 1}, getReflectionWithPeaks({10.0, 20.0, 15.0}, {0.1, 0.1, 0.1}, 1.0)}}; PeaksStatistics statistics(uniques, 3); diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index 51dd9821a99..2971289eff1 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -147,9 +147,7 @@ void FitPowderDiffPeaks::init() { "BraggPeakParameterWorkspace." "Otherwise, calculate each peak's centre from d-spacing."); - vector<string> genpeakoptions; - genpeakoptions.emplace_back("(HKL) & Calculation"); - genpeakoptions.emplace_back("From Bragg Peak Table"); + vector<string> genpeakoptions{"(HKL) & Calculation", "From Bragg Peak Table"}; auto propvalidator = boost::make_shared<StringListValidator>(genpeakoptions); declareProperty("PeakParametersStartingValueFrom", "(HKL) & Calculation", propvalidator, "Choice of how to generate starting values of " @@ -821,9 +819,7 @@ bool FitPowderDiffPeaks::fitSinglePeakRobust( peak->setParameter("I", height * fwhm); peak->setParameter("X0", tof_h); - vector<string> paramsinmc; - paramsinmc.emplace_back("A"); - paramsinmc.emplace_back("B"); + vector<string> paramsinmc{"A", "B"}; fitSinglePeakSimulatedAnnealing(peak, paramsinmc); } diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 4b63c37cd16..f55df11c200 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -129,18 +129,14 @@ void LeBailFit::init() { "Region of data (TOF) for LeBail fit. Default is whole range. "); // Functionality: Fit/Calculation/Background - std::vector<std::string> functions; - functions.emplace_back("LeBailFit"); - functions.emplace_back("Calculation"); - functions.emplace_back("MonteCarlo"); - functions.emplace_back("RefineBackground"); + std::vector<std::string> functions{"LeBailFit", "Calculation", "MonteCarlo", + "RefineBackground"}; auto validator = boost::make_shared<Kernel::StringListValidator>(functions); this->declareProperty("Function", "LeBailFit", validator, "Functionality"); // Peak type - vector<string> peaktypes; - peaktypes.emplace_back("ThermalNeutronBk2BkExpConvPVoigt"); - peaktypes.emplace_back("NeutronBk2BkExpConvPVoigt"); + vector<string> peaktypes{"ThermalNeutronBk2BkExpConvPVoigt", + "NeutronBk2BkExpConvPVoigt"}; auto peaktypevalidator = boost::make_shared<StringListValidator>(peaktypes); declareProperty("PeakType", "ThermalNeutronBk2BkExpConvPVoigt", peaktypevalidator, "Peak profile type."); @@ -148,10 +144,8 @@ void LeBailFit::init() { /*------------------------ Background Related Properties * ---------------------------------*/ // About background: Background type, input (table workspace or array) - std::vector<std::string> bkgdtype; - bkgdtype.emplace_back("Polynomial"); - bkgdtype.emplace_back("Chebyshev"); - bkgdtype.emplace_back("FullprofPolynomial"); + std::vector<std::string> bkgdtype{"Polynomial", "Chebyshev", + "FullprofPolynomial"}; auto bkgdvalidator = boost::make_shared<Kernel::StringListValidator>(bkgdtype); declareProperty("BackgroundType", "Polynomial", bkgdvalidator, diff --git a/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp index fde2bf4d3b6..ea46561bcde 100644 --- a/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp @@ -199,14 +199,9 @@ void PawleyFit::init() { declareProperty("StartX", 0.0, "Lower border of fitted data range."); declareProperty("EndX", 0.0, "Upper border of fitted data range."); - std::vector<std::string> latticeSystems; - latticeSystems.emplace_back("Cubic"); - latticeSystems.emplace_back("Tetragonal"); - latticeSystems.emplace_back("Hexagonal"); - latticeSystems.emplace_back("Rhombohedral"); - latticeSystems.emplace_back("Orthorhombic"); - latticeSystems.emplace_back("Monoclinic"); - latticeSystems.emplace_back("Triclinic"); + std::vector<std::string> latticeSystems{ + "Cubic", "Tetragonal", "Hexagonal", "Rhombohedral", + "Orthorhombic", "Monoclinic", "Triclinic"}; auto latticeSystemValidator = boost::make_shared<StringListValidator>(latticeSystems); diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index e4b81b8e35e..80cb69dec15 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -84,9 +84,7 @@ void PlotPeakByLogValue::init() { "of, the last bin the fitting range\n" "(default the highest value of x)"); - std::vector<std::string> fitOptions; - fitOptions.emplace_back("Sequential"); - fitOptions.emplace_back("Individual"); + std::vector<std::string> fitOptions{"Sequential", "Individual"}; declareProperty("FitType", "Sequential", boost::make_shared<StringListValidator>(fitOptions), "Defines the way of setting initial values. \n" diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index 17cc9001f48..efcba12be4a 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -97,9 +97,7 @@ void RefinePowderInstrumentParameters::init() { "Minimum number of fitted peaks for refining instrument parameters."); // Refinement algorithm - vector<string> algoptions; - algoptions.emplace_back("DirectFit"); - algoptions.emplace_back("MonteCarlo"); + vector<string> algoptions{"DirectFit", "MonteCarlo"}; auto validator = boost::make_shared<Kernel::StringListValidator>(algoptions); declareProperty("RefinementAlgorithm", "MonteCarlo", validator, "Algorithm to refine the instrument parameters."); @@ -117,9 +115,7 @@ void RefinePowderInstrumentParameters::init() { "Minimum allowed value for Sigma of a peak."); // Method to calcualte the standard error of peaks - vector<string> stdoptions; - stdoptions.emplace_back("ConstantValue"); - stdoptions.emplace_back("InvertedPeakHeight"); + vector<string> stdoptions{"ConstantValue", "InvertedPeakHeight"}; auto listvalidator = boost::make_shared<Kernel::StringListValidator>(stdoptions); declareProperty( @@ -755,8 +751,7 @@ void RefinePowderInstrumentParameters::doParameterSpaceRandomWalk( paramvalues[paramindex] = newvalue; // ii. Add the new values to vector - vector<double> parametervalues = paramvalues; - m_BestMCParameters.emplace_back(newchi2, parametervalues); + m_BestMCParameters.emplace_back(newchi2, paramvalues); // iii. Sort and delete the last if necessary sort(m_BestMCParameters.begin(), m_BestMCParameters.end()); diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index 1e092506fc9..797cfe0a6f6 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -68,9 +68,7 @@ void RefinePowderInstrumentParameters3::init() { "Output tableworkspace containing instrument's fitted parameters. "); // Refinement algorithm - vector<string> algoptions; - algoptions.emplace_back("OneStepFit"); - algoptions.emplace_back("MonteCarlo"); + vector<string> algoptions{"OneStepFit", "MonteCarlo"}; auto validator = boost::make_shared<Kernel::StringListValidator>(algoptions); declareProperty("RefinementAlgorithm", "MonteCarlo", validator, "Algorithm to refine the instrument parameters."); @@ -84,9 +82,7 @@ void RefinePowderInstrumentParameters3::init() { "Random seed for Monte Carlo simulation. "); // Method to calcualte the standard error of peaks - vector<string> stdoptions; - stdoptions.emplace_back("ConstantValue"); - stdoptions.emplace_back("UseInputValue"); + vector<string> stdoptions{"ConstantValue", "UseInputValue"}; auto listvalidator = boost::make_shared<Kernel::StringListValidator>(stdoptions); declareProperty( diff --git a/Framework/CurveFitting/src/Functions/BSpline.cpp b/Framework/CurveFitting/src/Functions/BSpline.cpp index 9ce3ff35f61..0b94d12c2ee 100644 --- a/Framework/CurveFitting/src/Functions/BSpline.cpp +++ b/Framework/CurveFitting/src/Functions/BSpline.cpp @@ -158,14 +158,7 @@ void BSpline::setAttribute(const std::string &attName, * @return Names of all declared attributes in correct order. */ std::vector<std::string> BSpline::getAttributeNames() const { - std::vector<std::string> names; - names.emplace_back("Uniform"); - names.emplace_back("Order"); - names.emplace_back("NBreak"); - names.emplace_back("StartX"); - names.emplace_back("EndX"); - names.emplace_back("BreakPoints"); - return names; + return {"Uniform", "Order", "NBreak", "StartX", "EndX", "BreakPoints"}; } /** diff --git a/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp index 23e45f139d7..e4c5fff1e17 100644 --- a/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp +++ b/Framework/CurveFitting/src/Functions/DynamicKuboToyabe.cpp @@ -309,9 +309,7 @@ void DynamicKuboToyabe::setActiveParameter(size_t i, double value) { * @return A list of attribute names */ std::vector<std::string> DynamicKuboToyabe::getAttributeNames() const { - std::vector<std::string> res; - res.emplace_back("BinWidth"); - return res; + return {"BinWidth"}; } //---------------------------------------------------------------------------------------------- diff --git a/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp index bed0760e968..56d715a55a7 100644 --- a/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp +++ b/Framework/CurveFitting/src/Functions/FullprofPolynomial.cpp @@ -92,11 +92,7 @@ void FullprofPolynomial::functionDeriv1D(API::Jacobian *out, * @return A list of attribute names (identical toFullprofPolynomial) */ std::vector<std::string> FullprofPolynomial::getAttributeNames() const { - std::vector<std::string> res; - res.emplace_back("n"); - res.emplace_back("Bkpos"); - - return res; + return {"n", "Bkpos"}; } //---------------------------------------------------------------------------------------------- diff --git a/Framework/CurveFitting/src/Functions/Polynomial.cpp b/Framework/CurveFitting/src/Functions/Polynomial.cpp index 1afd396be24..e3a2643ac86 100644 --- a/Framework/CurveFitting/src/Functions/Polynomial.cpp +++ b/Framework/CurveFitting/src/Functions/Polynomial.cpp @@ -104,11 +104,7 @@ void Polynomial::functionDeriv1D(API::Jacobian *out, const double *xValues, /** Get Attribute names * @return A list of attribute names (identical to Polynomial) */ -std::vector<std::string> Polynomial::getAttributeNames() const { - std::vector<std::string> res; - res.emplace_back("n"); - return res; -} +std::vector<std::string> Polynomial::getAttributeNames() const { return {"n"}; } //---------------------------------------------------------------------------------------------- /** Get Attribute diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index 1a2d7e55c85..f2c8318059a 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -68,11 +68,8 @@ void ProcessBackground::init() { "Output workspace containing processed background"); // Function Options - std::vector<std::string> options; - options.emplace_back("SelectBackgroundPoints"); - options.emplace_back("RemovePeaks"); - options.emplace_back("DeleteRegion"); - options.emplace_back("AddRegion"); + std::vector<std::string> options{"SelectBackgroundPoints", "RemovePeaks", + "DeleteRegion", "AddRegion"}; auto validator = boost::make_shared<Kernel::StringListValidator>(options); declareProperty("Options", "RemovePeaks", validator, @@ -93,9 +90,7 @@ void ProcessBackground::init() { new VisibleWhenProperty("Options", IS_EQUAL_TO, "AddRegion")); // Optional Function Type - std::vector<std::string> bkgdtype; - bkgdtype.emplace_back("Polynomial"); - bkgdtype.emplace_back("Chebyshev"); + std::vector<std::string> bkgdtype{"Polynomial", "Chebyshev"}; // bkgdtype.emplace_back("FullprofPolynomial"); auto bkgdvalidator = boost::make_shared<Kernel::StringListValidator>(bkgdtype); @@ -106,10 +101,7 @@ void ProcessBackground::init() { new VisibleWhenProperty("Options", IS_EQUAL_TO, "SelectBackgroundPoints")); - vector<string> funcoptions; - funcoptions.emplace_back("N/A"); - funcoptions.emplace_back("FitGivenDataPoints"); - funcoptions.emplace_back("UserFunction"); + vector<string> funcoptions{"N/A", "FitGivenDataPoints", "UserFunction"}; auto fovalidator = boost::make_shared<StringListValidator>(funcoptions); declareProperty("SelectionMode", "N/A", fovalidator, "If choise is UserFunction, background will be selected by " @@ -154,9 +146,8 @@ void ProcessBackground::init() { new VisibleWhenProperty("SelectionMode", IS_EQUAL_TO, "UserFunction")); // Mode to select background - vector<string> pointsselectmode; - pointsselectmode.emplace_back("All Background Points"); - pointsselectmode.emplace_back("Input Background Points Only"); + vector<string> pointsselectmode{"All Background Points", + "Input Background Points Only"}; auto modevalidator = boost::make_shared<StringListValidator>(pointsselectmode); declareProperty("BackgroundPointSelectMode", "All Background Points", @@ -201,9 +192,7 @@ void ProcessBackground::init() { "SelectBackgroundPoints")); // Output background type. - std::vector<std::string> outbkgdtype; - outbkgdtype.emplace_back("Polynomial"); - outbkgdtype.emplace_back("Chebyshev"); + std::vector<std::string> outbkgdtype{"Polynomial", "Chebyshev"}; auto outbkgdvalidator = boost::make_shared<Kernel::StringListValidator>(bkgdtype); declareProperty("OutputBackgroundType", "Polynomial", outbkgdvalidator, diff --git a/Framework/CurveFitting/src/IFittingAlgorithm.cpp b/Framework/CurveFitting/src/IFittingAlgorithm.cpp index dea5c6cdb92..49001631dab 100644 --- a/Framework/CurveFitting/src/IFittingAlgorithm.cpp +++ b/Framework/CurveFitting/src/IFittingAlgorithm.cpp @@ -85,10 +85,7 @@ void IFittingAlgorithm::init() { declareProperty("IgnoreInvalidData", false, "Flag to ignore infinities, NaNs and data with zero errors."); - std::vector<std::string> domainTypes; - domainTypes.emplace_back("Simple"); - domainTypes.emplace_back("Sequential"); - domainTypes.emplace_back("Parallel"); + std::vector<std::string> domainTypes{"Simple", "Sequential", "Parallel"}; declareProperty( "DomainType", "Simple", Kernel::IValidator_sptr( diff --git a/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h index 94950935c52..4156dc0411b 100644 --- a/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h +++ b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h @@ -388,15 +388,9 @@ public: DataObjects::TableWorkspace_sptr geomws = DataObjects::TableWorkspace_sptr(tablews); - std::vector<std::string> paramnames; - paramnames.emplace_back("Zero"); - paramnames.emplace_back("Zerot"); - paramnames.emplace_back("Dtt1"); - paramnames.emplace_back("Dtt1t"); - paramnames.emplace_back("Dtt2t"); - paramnames.emplace_back("Tcross"); - paramnames.emplace_back("Width"); - paramnames.emplace_back("LatticeConstant"); + std::vector<std::string> paramnames{"Zero", "Zerot", "Dtt1", + "Dtt1t", "Dtt2t", "Tcross", + "Width", "LatticeConstant"}; tablews->addColumn("str", "Name"); tablews->addColumn("double", "Value"); diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h index 9939e449cfc..2a549bc897b 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h @@ -506,9 +506,7 @@ public: // c) Generate TableWorkspaces std::vector<double> pkheights(numpeaks, 1.0); - map<string, double> modmap; - modmap.emplace("Alph0", 5.0); - modmap.emplace("Beta0", 5.0); + map<string, double> modmap{{"Alph0", 5.0}, {"Beta0", 5.0}}; parameterws = createPeakParameterWorkspace(modmap, 2); hklws = createInputHKLWorkspace(hkls, pkheights); bkgdws = createBackgroundParameterWorksapce(1); diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h index d28104b51f7..0e66d8496aa 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h @@ -65,16 +65,8 @@ public: lebailfunction.setProfileParameterValues(parammap); // Add background functions - std::vector<double> parvalues; - std::vector<std::string> parnames; - parnames.emplace_back("A0"); - parvalues.push_back(1.0); - parnames.emplace_back("A1"); - parvalues.push_back(1.0); - parnames.emplace_back("A2"); - parvalues.push_back(1.0); - parnames.emplace_back("A3"); - parvalues.push_back(1.0); + std::vector<double> parvalues{1.0, 1.0, 1.0, 1.0}; + std::vector<std::string> parnames{"A0", "A1", "A2", "A3"}; // Chebyshev TS_ASSERT_THROWS_NOTHING(lebailfunction.addBackgroundFunction( diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index 1019efdcf4f..0478f530fe6 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -402,15 +402,9 @@ public: DataObjects::TableWorkspace_sptr geomws = DataObjects::TableWorkspace_sptr(tablews); - std::vector<std::string> paramnames; - paramnames.emplace_back("Zero"); - paramnames.emplace_back("Zerot"); - paramnames.emplace_back("Dtt1"); - paramnames.emplace_back("Dtt1t"); - paramnames.emplace_back("Dtt2t"); - paramnames.emplace_back("Tcross"); - paramnames.emplace_back("Width"); - paramnames.emplace_back("LatticeConstant"); + std::vector<std::string> paramnames{"Zero", "Zerot", "Dtt1", + "Dtt1t", "Dtt2t", "Tcross", + "Width", "LatticeConstant"}; tablews->addColumn("str", "Name"); tablews->addColumn("double", "Value"); diff --git a/Framework/CurveFitting/test/MultiDomainCreatorTest.h b/Framework/CurveFitting/test/MultiDomainCreatorTest.h index ee46db7fb23..6629607ca81 100644 --- a/Framework/CurveFitting/test/MultiDomainCreatorTest.h +++ b/Framework/CurveFitting/test/MultiDomainCreatorTest.h @@ -104,10 +104,7 @@ public: manager.declareProperty( new WorkspaceProperty<Workspace>("WS3", "", Direction::Input)); - std::vector<std::string> propNames; - propNames.emplace_back("WS1"); - propNames.emplace_back("WS2"); - propNames.emplace_back("WS3"); + std::vector<std::string> propNames{"WS1", "WS2", "WS3"}; MultiDomainCreator multi(&manager, propNames); TS_ASSERT_EQUALS(multi.getNCreators(), 3); @@ -176,10 +173,7 @@ public: manager.declareProperty( new WorkspaceProperty<Workspace>("WS3", "", Direction::Input)); - std::vector<std::string> propNames; - propNames.emplace_back("WS1"); - propNames.emplace_back("WS2"); - propNames.emplace_back("WS3"); + std::vector<std::string> propNames{"WS1", "WS2", "WS3"}; MultiDomainCreator multi(&manager, propNames); manager.setProperty("WS1", ws1); @@ -255,10 +249,8 @@ public: manager.declareProperty( new WorkspaceProperty<Workspace>("WS3", "", Direction::Input)); - std::vector<std::string> propNames; - propNames.emplace_back("WS1"); - propNames.emplace_back("WS2"); - propNames.emplace_back("WS3"); + std::vector<std::string> propNames{"WS1", "WS2", "WS3"}; + MultiDomainCreator multi(&manager, propNames); manager.setProperty("WS1", ws1); diff --git a/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp b/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp index 8d8e33e4a76..1a9fc5688f8 100644 --- a/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp +++ b/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp @@ -55,9 +55,7 @@ const std::string AppendGeometryToSNSNexus::category() const { */ void AppendGeometryToSNSNexus::init() { // Declare potential extensions for input NeXus file - std::vector<std::string> extensions; - extensions.emplace_back(".nxs"); - extensions.emplace_back(".h5"); + std::vector<std::string> extensions{".nxs", ".h5"}; declareProperty(new API::FileProperty("Filename", "", API::FileProperty::Load, extensions), diff --git a/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp b/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp index dc3393c4c28..a9b9b618484 100644 --- a/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp +++ b/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp @@ -116,12 +116,7 @@ void CreateChunkingFromInstrument::init() { "as separate groups. " "Use / or , to separate multiple groups. " "If empty, then an empty GroupingWorkspace will be created."); - vector<string> grouping; - grouping.emplace_back(""); - grouping.emplace_back("All"); - grouping.emplace_back("Group"); - grouping.emplace_back("Column"); - grouping.emplace_back("bank"); + vector<string> grouping{"", "All", "Group", "Column", "bank"}; declareProperty( PARAM_CHUNK_BY, "", boost::make_shared<StringListValidator>(grouping), "Only used if GroupNames is empty: All detectors as one group, Groups " diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index a6a9ebe8026..8f52b179fe5 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -291,10 +291,7 @@ void FilterEventsByLogValuePreNexus::init() { new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); // Loading option - std::vector<std::string> propOptions; - propOptions.emplace_back("Auto"); - propOptions.emplace_back("Serial"); - propOptions.emplace_back("Parallel"); + std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", boost::make_shared<StringListValidator>(propOptions), "Use multiple cores for loading the data?\n" @@ -316,10 +313,7 @@ void FilterEventsByLogValuePreNexus::init() { "(pixel) information. "); // - std::vector<std::string> vecfunmode; - vecfunmode.emplace_back("LoadData"); - vecfunmode.emplace_back("Filter"); - vecfunmode.emplace_back("ExamineEventLog"); + std::vector<std::string> vecfunmode{"LoadData", "Filter", "ExamineEventLog"}; declareProperty("FunctionMode", "LoadData", boost::make_shared<StringListValidator>(vecfunmode), "Function mode for different purpose. "); diff --git a/Framework/DataHandling/src/LoadDaveGrp.cpp b/Framework/DataHandling/src/LoadDaveGrp.cpp index 0e9fc2d2eb8..be8b9e29ea5 100644 --- a/Framework/DataHandling/src/LoadDaveGrp.cpp +++ b/Framework/DataHandling/src/LoadDaveGrp.cpp @@ -70,11 +70,7 @@ int LoadDaveGrp::confidence(Kernel::FileDescriptor &descriptor) const { } void LoadDaveGrp::init() { - std::vector<std::string> exts; - exts.emplace_back(".grp"); - exts.emplace_back(".sqe"); - exts.emplace_back(".txt"); - exts.emplace_back(".dat"); + std::vector<std::string> exts{".grp", ".sqe", ".txt", ".dat"}; this->declareProperty( new API::FileProperty("Filename", "", API::FileProperty::Load, exts), diff --git a/Framework/DataHandling/src/LoadDspacemap.cpp b/Framework/DataHandling/src/LoadDspacemap.cpp index 0bbb5aa4de0..495f6f28129 100644 --- a/Framework/DataHandling/src/LoadDspacemap.cpp +++ b/Framework/DataHandling/src/LoadDspacemap.cpp @@ -45,10 +45,8 @@ void LoadDspacemap::init() { new FileProperty("Filename", "", FileProperty::Load, {".dat", ".bin"}), "The DspacemapFile containing the d-space mapping."); - std::vector<std::string> propOptions; - propOptions.emplace_back("POWGEN"); - propOptions.emplace_back("VULCAN-ASCII"); - propOptions.emplace_back("VULCAN-Binary"); + std::vector<std::string> propOptions{"POWGEN", "VULCAN-ASCII", + "VULCAN-Binary"}; declareProperty("FileType", "POWGEN", boost::make_shared<StringListValidator>(propOptions), "The type of file being read."); diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 0ebe76e325b..601539f5f9f 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -157,10 +157,7 @@ void LoadEventPreNexus::init() { setPropertySettings("TotalChunks", new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); - std::vector<std::string> propOptions; - propOptions.emplace_back("Auto"); - propOptions.emplace_back("Serial"); - propOptions.emplace_back("Parallel"); + std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", boost::make_shared<StringListValidator>(propOptions), "Use multiple cores for loading the data?\n" diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index f41137cd9f1..2dcdb6f5968 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -280,10 +280,7 @@ void LoadEventPreNexus2::init() { setPropertySettings("TotalChunks", new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); - std::vector<std::string> propOptions; - propOptions.emplace_back("Auto"); - propOptions.emplace_back("Serial"); - propOptions.emplace_back("Parallel"); + std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", boost::make_shared<StringListValidator>(propOptions), "Use multiple cores for loading the data?\n" diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index ed7e539a5d7..9a7a6800952 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -90,10 +90,7 @@ void LoadISISNexus2::init() { "A positive number identifies one entry to be loaded, into " "one worskspace"); - std::vector<std::string> monitorOptions; - monitorOptions.emplace_back("Include"); - monitorOptions.emplace_back("Exclude"); - monitorOptions.emplace_back("Separate"); + std::vector<std::string> monitorOptions{"Include", "Exclude", "Separate"}; std::map<std::string, std::string> monitorOptionsAliases; monitorOptionsAliases["1"] = "Separate"; monitorOptionsAliases["0"] = "Exclude"; diff --git a/Framework/DataHandling/src/LoadMuonNexus.cpp b/Framework/DataHandling/src/LoadMuonNexus.cpp index eb59ee8c1da..e3e2fb7d995 100644 --- a/Framework/DataHandling/src/LoadMuonNexus.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus.cpp @@ -74,9 +74,7 @@ void LoadMuonNexus::init() { "A positive number identifies one entry to be loaded, into " "one worskspace"); - std::vector<std::string> FieldOptions; - FieldOptions.emplace_back("Transverse"); - FieldOptions.emplace_back("Longitudinal"); + std::vector<std::string> FieldOptions{"Transverse", "Longitudinal"}; declareProperty("MainFieldDirection", "Transverse", boost::make_shared<StringListValidator>(FieldOptions), "Output the main field direction if specified in Nexus file " diff --git a/Framework/DataHandling/src/LoadPreNexus.cpp b/Framework/DataHandling/src/LoadPreNexus.cpp index ecdcdab6b49..d81fd0694fa 100644 --- a/Framework/DataHandling/src/LoadPreNexus.cpp +++ b/Framework/DataHandling/src/LoadPreNexus.cpp @@ -98,10 +98,7 @@ void LoadPreNexus::init() { // validation setPropertySettings("TotalChunks", new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); - std::vector<std::string> propOptions; - propOptions.emplace_back("Auto"); - propOptions.emplace_back("Serial"); - propOptions.emplace_back("Parallel"); + std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", boost::make_shared<StringListValidator>(propOptions), "Use multiple cores for loading the data?\n" diff --git a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp index 350f6194f61..e4fb7e97fec 100644 --- a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp +++ b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp @@ -180,10 +180,9 @@ const std::string LoadSpiceXML2DDet::summary() const { * @brief LoadSpiceXML2DDet::init */ void LoadSpiceXML2DDet::init() { - std::vector<std::string> xmlext; - xmlext.emplace_back(".xml"); declareProperty( - new FileProperty("Filename", "", FileProperty::FileAction::Load, xmlext), + new FileProperty("Filename", "", FileProperty::FileAction::Load, + {".xml"}), "XML file name for one scan including 2D detectors counts from SPICE"); declareProperty( diff --git a/Framework/DataHandling/src/LoadVulcanCalFile.cpp b/Framework/DataHandling/src/LoadVulcanCalFile.cpp index dd4619cc05b..d50fc14d79a 100644 --- a/Framework/DataHandling/src/LoadVulcanCalFile.cpp +++ b/Framework/DataHandling/src/LoadVulcanCalFile.cpp @@ -58,10 +58,7 @@ void LoadVulcanCalFile::init() { new FileProperty("OffsetFilename", "", FileProperty::Load, ".dat"), "Path to the VULCAN offset file. "); - vector<string> groupoptions; - groupoptions.emplace_back("6Modules"); - groupoptions.emplace_back("2Banks"); - groupoptions.emplace_back("1Bank"); + vector<string> groupoptions{"6Modules", "2Banks", "1Bank"}; declareProperty( "Grouping", "6Modules", diff --git a/Framework/DataHandling/src/NexusTester.cpp b/Framework/DataHandling/src/NexusTester.cpp index b0864895336..4154494cbb8 100644 --- a/Framework/DataHandling/src/NexusTester.cpp +++ b/Framework/DataHandling/src/NexusTester.cpp @@ -67,10 +67,8 @@ void NexusTester::init() { "Clear the linux disk cache before loading.\n" "Only works on linux AND you need to run MantidPlot in sudo mode (!)."); - std::vector<std::string> types; - types.emplace_back("Zeros"); - types.emplace_back("Incrementing Numbers"); - types.emplace_back("Random Numbers"); + std::vector<std::string> types{"Zeros", "Incrementing Numbers", + "Random Numbers"}; declareProperty("FakeData", "Incrementing Numbers", boost::make_shared<StringListValidator>(types), "For writing: type of fake data to generate."); diff --git a/Framework/DataHandling/src/SaveCanSAS1D.cpp b/Framework/DataHandling/src/SaveCanSAS1D.cpp index 9b27916f7d8..efe64ac8084 100644 --- a/Framework/DataHandling/src/SaveCanSAS1D.cpp +++ b/Framework/DataHandling/src/SaveCanSAS1D.cpp @@ -43,18 +43,17 @@ void SaveCanSAS1D::init() { new API::FileProperty("Filename", "", API::FileProperty::Save, ".xml"), "The name of the xml file to save"); - std::vector<std::string> radiation_source; - radiation_source.emplace_back("Spallation Neutron Source"); - radiation_source.emplace_back("Pulsed Reactor Neutron Source"); - radiation_source.emplace_back("Reactor Neutron Source"); - radiation_source.emplace_back("Synchrotron X-ray Source"); - radiation_source.emplace_back("Pulsed Muon Source"); - radiation_source.emplace_back("Rotating Anode X-ray"); - radiation_source.emplace_back("Fixed Tube X-ray"); - radiation_source.emplace_back("neutron"); - radiation_source.emplace_back("x-ray"); - radiation_source.emplace_back("muon"); - radiation_source.emplace_back("electron"); + std::vector<std::string> radiation_source{"Spallation Neutron Source", + "Pulsed Reactor Neutron Source", + "Reactor Neutron Source", + "Synchrotron X-ray Source", + "Pulsed Muon Source", + "Rotating Anode X-ray", + "Fixed Tube X-ray", + "neutron", + "x-ray", + "muon", + "electron"}; declareProperty( "RadiationSource", "Spallation Neutron Source", boost::make_shared<Kernel::StringListValidator>(radiation_source), diff --git a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp index b9f4209ec39..5b035fac133 100644 --- a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp @@ -311,18 +311,13 @@ void SaveGSASInstrumentFile::init() { new ArrayProperty<unsigned int>("BankIDs"), "Bank IDs of the banks to be written to GSAS instrument file."); - vector<string> instruments; - instruments.emplace_back("powgen"); - instruments.emplace_back("nomad"); + vector<string> instruments{"powgen", "nomad"}; declareProperty("Instrument", "powgen", boost::make_shared<StringListValidator>(instruments), "Name of the instrument that parameters are belonged to. " "So far, only PG3 and NOM are supported."); - vector<string> vecfreq; - vecfreq.emplace_back("10"); - vecfreq.emplace_back("30"); - vecfreq.emplace_back("60"); + vector<string> vecfreq{"10", "30", "60"}; declareProperty("ChopperFrequency", "60", boost::make_shared<StringListValidator>(vecfreq), "Frequency of the chopper. "); diff --git a/Framework/DataObjects/test/EventWorkspaceTest.h b/Framework/DataObjects/test/EventWorkspaceTest.h index 143e93849ee..102cd6979ef 100644 --- a/Framework/DataObjects/test/EventWorkspaceTest.h +++ b/Framework/DataObjects/test/EventWorkspaceTest.h @@ -621,11 +621,9 @@ public: V3D source(0, 0, 0); V3D sample(10, 0, 0); - std::vector<V3D> detectorPositions; - - detectorPositions.emplace_back(11, 1, 0); // First detector pos - detectorPositions.emplace_back(11, 1, - 0); // Second detector sits on the first. + std::vector<V3D> detectorPositions{{11, 1, 0}, {11, 1, 0}}; + // First detector pos + // Second detector sits on the first. WorkspaceCreationHelper::createInstrumentForWorkspaceWithDistances( ws, source, sample, detectorPositions); diff --git a/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp b/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp index 819c8ce58fd..a598da3674b 100644 --- a/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp @@ -90,11 +90,7 @@ std::string SymmetryOperationSymbolParser::getNormalizedIdentifier( throw std::runtime_error("Matrix is not a 3x3 matrix."); } - std::vector<std::string> symbols; - symbols.emplace_back("x"); - symbols.emplace_back("y"); - symbols.emplace_back("z"); - + std::vector<std::string> symbols{"x", "y", "z"}; std::vector<std::string> components; for (size_t r = 0; r < 3; ++r) { diff --git a/Framework/Geometry/test/CompositeBraggScattererTest.h b/Framework/Geometry/test/CompositeBraggScattererTest.h index e708b69833a..37dac22d375 100644 --- a/Framework/Geometry/test/CompositeBraggScattererTest.h +++ b/Framework/Geometry/test/CompositeBraggScattererTest.h @@ -176,60 +176,24 @@ private: } std::map<V3D, double> getCalculatedStructureFactors() { - 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}}; + return {{{2, 0, 0}, 167.84}, {{3, 0, 0}, 153.50}, {{4, 0, 0}, 19.76}, + {{5, 0, 0}, 176.21}, {{1, 1, 0}, 2.44}, {{2, 1, 0}, 15.83}, + {{3, 1, 0}, 14.48}, {{4, 1, 0}, 1.86}, {{5, 1, 0}, 16.62}, + {{2, 2, 0}, 104.66}, {{3, 2, 0}, 95.72}, {{4, 2, 0}, 12.32}, + {{5, 2, 0}, 109.88}, {{3, 3, 0}, 90.10}, {{4, 3, 0}, 11.60}, + {{5, 3, 0}, 103.43}, {{4, 4, 0}, 1.55}, {{5, 4, 0}, 13.86}, + {{5, 5, 0}, 130.22}, {{1, 1, 1}, 16.45}, {{2, 1, 1}, 2.26}, + {{3, 1, 1}, 21.53}, {{4, 1, 1}, 1.80}, {{5, 1, 1}, 10.47}, + {{2, 2, 1}, 14.95}, {{3, 2, 1}, 142.33}, {{4, 2, 1}, 11.92}, + {{5, 2, 1}, 69.17}, {{3, 3, 1}, 133.97}, {{4, 3, 1}, 11.22}, + {{5, 3, 1}, 65.11}, {{4, 4, 1}, 1.50}, {{5, 4, 1}, 8.73}, + {{5, 5, 1}, 81.98}, {{2, 2, 2}, 14.36}, {{3, 2, 2}, 88.94}, + {{4, 2, 2}, 77.57}, {{5, 2, 2}, 9.52}, {{3, 3, 2}, 83.72}, + {{4, 3, 2}, 73.02}, {{5, 3, 2}, 8.96}, {{4, 4, 2}, 9.79}, + {{5, 4, 2}, 1.20}, {{5, 5, 2}, 11.29}, {{3, 3, 3}, 11.44}, + {{4, 3, 3}, 103.89}, {{5, 3, 3}, 8.30}, {{4, 4, 3}, 13.93}, + {{5, 4, 3}, 1.11}, {{5, 5, 3}, 10.45}, {{4, 4, 4}, 8.33}, + {{5, 4, 4}, 6.93}, {{5, 5, 4}, 65.05}, {{5, 5, 5}, 88.57}}; } }; diff --git a/Framework/Geometry/test/CylinderTest.h b/Framework/Geometry/test/CylinderTest.h index 22c0e968415..144eb7ee29e 100644 --- a/Framework/Geometry/test/CylinderTest.h +++ b/Framework/Geometry/test/CylinderTest.h @@ -158,9 +158,8 @@ public: Test the distance of a point from the cylinder */ { - std::vector<std::string> CylStr; - CylStr.emplace_back("cx 1"); // Cylinder origin - CylStr.emplace_back("c/x 1.0 1.0 1.0"); // also cylinder at ?origin? + std::vector<std::string> CylStr{"cx 1", "c/x 1.0 1.0 1.0"}; + // Cylinder origin // also cylinder at ?origin? Kernel::V3D P(0, -1.2, 0); double results[] = {1.2 - 1, 1.41661}; diff --git a/Framework/Geometry/test/IndexingUtilsTest.h b/Framework/Geometry/test/IndexingUtilsTest.h index 470e67323cd..0ea3277ca6e 100644 --- a/Framework/Geometry/test/IndexingUtilsTest.h +++ b/Framework/Geometry/test/IndexingUtilsTest.h @@ -16,19 +16,13 @@ using Mantid::Kernel::Matrix; class IndexingUtilsTest : public CxxTest::TestSuite { public: static std::vector<V3D> getNatroliteQs() { - std::vector<V3D> q_vectors; - q_vectors.emplace_back(-0.57582, -0.35322, -0.19974); - q_vectors.emplace_back(-1.41754, -0.78704, -0.75974); - q_vectors.emplace_back(-1.12030, -0.53578, -0.27559); - q_vectors.emplace_back(-0.68911, -0.59397, -0.12716); - q_vectors.emplace_back(-1.06863, -0.43255, 0.01688); - q_vectors.emplace_back(-1.82007, -0.49671, -0.06266); - q_vectors.emplace_back(-1.10465, -0.73708, -0.01939); - q_vectors.emplace_back(-0.12747, -0.32380, 0.00821); - q_vectors.emplace_back(-0.84210, -0.37038, 0.15403); - q_vectors.emplace_back(-0.54099, -0.46900, 0.11535); - q_vectors.emplace_back(-0.90478, -0.50667, 0.51072); - q_vectors.emplace_back(-0.50387, -0.58561, 0.43502); + std::vector<V3D> q_vectors{ + {-0.57582, -0.35322, -0.19974}, {-1.41754, -0.78704, -0.75974}, + {-1.12030, -0.53578, -0.27559}, {-0.68911, -0.59397, -0.12716}, + {-1.06863, -0.43255, 0.01688}, {-1.82007, -0.49671, -0.06266}, + {-1.10465, -0.73708, -0.01939}, {-0.12747, -0.32380, 0.00821}, + {-0.84210, -0.37038, 0.15403}, {-0.54099, -0.46900, 0.11535}, + {-0.90478, -0.50667, 0.51072}, {-0.50387, -0.58561, 0.43502}}; // Dec 2011: Change convention for Q = 2 pi / wavelength for (size_t i = 0; i < q_vectors.size(); i++) q_vectors[i] *= (2.0 * M_PI); @@ -36,19 +30,10 @@ public: } static std::vector<V3D> getNatroliteIndices() { - std::vector<V3D> correct_indices; - correct_indices.emplace_back(1, 9, -9); - correct_indices.emplace_back(4, 20, -24); - correct_indices.emplace_back(2, 18, -14); - correct_indices.emplace_back(0, 12, -12); - correct_indices.emplace_back(1, 19, -9); - correct_indices.emplace_back(3, 31, -13); - correct_indices.emplace_back(0, 20, -14); - correct_indices.emplace_back(-1, 3, -5); - correct_indices.emplace_back(0, 16, -6); - correct_indices.emplace_back(-1, 11, -7); - correct_indices.emplace_back(-2, 20, -4); - correct_indices.emplace_back(-3, 13, -5); + std::vector<V3D> correct_indices{{1, 9, -9}, {4, 20, -24}, {2, 18, -14}, + {0, 12, -12}, {1, 19, -9}, {3, 31, -13}, + {0, 20, -14}, {-1, 3, -5}, {0, 16, -6}, + {-1, 11, -7}, {-2, 20, -4}, {-3, 13, -5}}; return correct_indices; } diff --git a/Framework/Geometry/test/LineIntersectVisitTest.h b/Framework/Geometry/test/LineIntersectVisitTest.h index e1319955bd9..5142e4d6883 100644 --- a/Framework/Geometry/test/LineIntersectVisitTest.h +++ b/Framework/Geometry/test/LineIntersectVisitTest.h @@ -31,11 +31,9 @@ public: TS_ASSERT_EQUALS(extractString(B), "-1 px 0\n"); A.Accept(B); TS_ASSERT_EQUALS(A.getNPoints(), 1); - std::list<Kernel::V3D> Pnts; - Pnts.emplace_back(0.0, -1.0, -1.0); + std::list<Kernel::V3D> Pnts{{0.0, -1.0, -1.0}}; TS_ASSERT_EQUALS(A.getPoints(), Pnts); - std::list<double> Dist; - Dist.push_back(1.0); + std::list<double> Dist{1.0}; TS_ASSERT_EQUALS(A.getDistance(), Dist); } @@ -45,10 +43,10 @@ public: Sphere B; B.setSurface("s 0.0 0.0 0.0 2"); A.Accept(B); - std::list<V3D> pntOut; + // changed for forward going only intercepts on quadratice surfaces // pntOut.emplace_back(-2.0,0.0,0.0); - pntOut.emplace_back(2.0, 0.0, 0.0); + std::list<V3D> pntOut{{2.0, 0.0, 0.0}}; TS_ASSERT_EQUALS(A.getNPoints(), 1); TS_ASSERT_EQUALS(A.getPoints(), pntOut); std::list<double> Dist; @@ -85,10 +83,10 @@ public: TS_ASSERT_EQUALS(B.getNormal(), V3D(0, 1, 0)); A.Accept(B); - std::list<V3D> pntOut; + // forward only // pntOut.emplace_back(-1.0,0.0,0.0); - pntOut.emplace_back(1.0, 0.0, 0.0); + std::list<V3D> pntOut{{1.0, 0.0, 0.0}}; TS_ASSERT_EQUALS(A.getNPoints(), 1); TS_ASSERT_EQUALS(A.getPoints(), pntOut); std::list<double> Dist; @@ -99,9 +97,7 @@ public: LineIntersectVisit C(V3D(1.1, 0.0, 0.0), V3D(-1.0, 0.0, 0.0)); C.Accept(B); TS_ASSERT_EQUALS(C.getNPoints(), 2); - std::list<V3D> pntOut2; - pntOut2.emplace_back(-1.0, 0.0, 0.0); - pntOut2.emplace_back(1.0, 0.0, 0.0); + std::list<V3D> pntOut2{{-1.0, 0.0, 0.0}, {1.0, 0.0, 0.0}}; TS_ASSERT_EQUALS(C.getPoints(), pntOut2); } diff --git a/Framework/Geometry/test/ObjComponentTest.h b/Framework/Geometry/test/ObjComponentTest.h index 7334c2fc0a9..f884556e9b9 100644 --- a/Framework/Geometry/test/ObjComponentTest.h +++ b/Framework/Geometry/test/ObjComponentTest.h @@ -276,13 +276,8 @@ public: TS_ASSERT_DELTA(point.Y(), 10.0, 1e-6); TS_ASSERT_DELTA(point.Z(), -10.0, 1e-6); // Cuboid not on principle axes - std::vector<std::string> planes; - planes.emplace_back("px 0.5"); - planes.emplace_back("px 1.5"); - planes.emplace_back("py -22"); - planes.emplace_back("py -21"); - planes.emplace_back("pz -0.5"); - planes.emplace_back("pz 0.5"); + std::vector<std::string> planes{"px 0.5", "px 1.5", "py -22", + "py -21", "pz -0.5", "pz 0.5"}; ObjComponent D("ocube", createCuboid(planes)); D.setPos(10, 0, 0); D.setRot(Quat(90.0, V3D(0, 0, 1))); diff --git a/Framework/Geometry/test/ObjectTest.h b/Framework/Geometry/test/ObjectTest.h index 91115407f60..a5fc0f12782 100644 --- a/Framework/Geometry/test/ObjectTest.h +++ b/Framework/Geometry/test/ObjectTest.h @@ -560,41 +560,23 @@ public: TS_ASSERT_EQUALS(geom_obj->getPointInObject(pt), 1); TS_ASSERT_EQUALS(pt, V3D(0, 0, 0)); // initial guess not in object, but on x-axis - std::vector<std::string> planes; - planes.emplace_back("px 10"); - planes.emplace_back("px 11"); - planes.emplace_back("py -0.5"); - planes.emplace_back("py 0.5"); - planes.emplace_back("pz -0.5"); - planes.emplace_back("pz 0.5"); + std::vector<std::string> planes{"px 10", "px 11", "py -0.5", + "py 0.5", "pz -0.5", "pz 0.5"}; Object_sptr B = createCuboid(planes); TS_ASSERT_EQUALS(B->getPointInObject(pt), 1); TS_ASSERT_EQUALS(pt, V3D(10, 0, 0)); // on y axis - planes.clear(); - planes.emplace_back("px -0.5"); - planes.emplace_back("px 0.5"); - planes.emplace_back("py -22"); - planes.emplace_back("py -21"); - planes.emplace_back("pz -0.5"); - planes.emplace_back("pz 0.5"); + planes = {"px -0.5", "px 0.5", "py -22", "py -21", "pz -0.5", "pz 0.5"}; Object_sptr C = createCuboid(planes); TS_ASSERT_EQUALS(C->getPointInObject(pt), 1); TS_ASSERT_EQUALS(pt, V3D(0, -21, 0)); // not on principle axis, now works using getBoundingBox - planes.clear(); - planes.emplace_back("px 0.5"); - planes.emplace_back("px 1.5"); - planes.emplace_back("py -22"); - planes.emplace_back("py -21"); - planes.emplace_back("pz -0.5"); - planes.emplace_back("pz 0.5"); + planes = {"px 0.5", "px 1.5", "py -22", "py -21", "pz -0.5", "pz 0.5"}; Object_sptr D = createCuboid(planes); TS_ASSERT_EQUALS(D->getPointInObject(pt), 1); TS_ASSERT_DELTA(pt.X(), 1.0, 1e-6); TS_ASSERT_DELTA(pt.Y(), -21.5, 1e-6); TS_ASSERT_DELTA(pt.Z(), 0.0, 1e-6); - planes.clear(); // Test non axis aligned (AA) case - getPointInObject works because the // object is on a principle axis // However, if not on a principle axis then the getBoundingBox fails to find @@ -604,29 +586,28 @@ public: // for defining non-AA objects. However, BoundingBox is poor for non-AA and // needs improvement if these are // common - planes.emplace_back("p 1 0 0 -0.5"); - planes.emplace_back("p 1 0 0 0.5"); - planes.emplace_back("p 0 .70710678118 .70710678118 -1.1"); - planes.emplace_back("p 0 .70710678118 .70710678118 -0.1"); - planes.emplace_back("p 0 -.70710678118 .70710678118 -0.5"); - planes.emplace_back("p 0 -.70710678118 .70710678118 0.5"); + planes = {"p 1 0 0 -0.5", + "p 1 0 0 0.5", + "p 0 .70710678118 .70710678118 -1.1", + "p 0 .70710678118 .70710678118 -0.1", + "p 0 -.70710678118 .70710678118 -0.5", + "p 0 -.70710678118 .70710678118 0.5"}; Object_sptr E = createCuboid(planes); TS_ASSERT_EQUALS(E->getPointInObject(pt), 1); TS_ASSERT_DELTA(pt.X(), 0.0, 1e-6); TS_ASSERT_DELTA(pt.Y(), -0.1414213562373, 1e-6); TS_ASSERT_DELTA(pt.Z(), 0.0, 1e-6); - planes.clear(); // This test used to fail to find a point in object, as object not on a // principle axis and getBoundingBox did not give a useful result in this // case. Framework has now been updated to support this automatically. // Object is unit cube located at +-0.5 in x but centred on z=y=-1.606.. and // rotated 45deg to these two axes - planes.emplace_back("p 1 0 0 -0.5"); - planes.emplace_back("p 1 0 0 0.5"); - planes.emplace_back("p 0 .70710678118 .70710678118 -2"); - planes.emplace_back("p 0 .70710678118 .70710678118 -1"); - planes.emplace_back("p 0 -.70710678118 .70710678118 -0.5"); - planes.emplace_back("p 0 -.70710678118 .70710678118 0.5"); + planes = {"p 1 0 0 -0.5", + "p 1 0 0 0.5", + "p 0 .70710678118 .70710678118 -2", + "p 0 .70710678118 .70710678118 -1", + "p 0 -.70710678118 .70710678118 -0.5", + "p 0 -.70710678118 .70710678118 0.5"}; Object_sptr F = createCuboid(planes); TS_ASSERT_EQUALS(F->getPointInObject(pt), 1); // This now succeeds // Test use of defineBoundingBox to explictly set the bounding box, when the diff --git a/Framework/Geometry/test/ParObjComponentTest.h b/Framework/Geometry/test/ParObjComponentTest.h index 8524957f838..31f8e7567d2 100644 --- a/Framework/Geometry/test/ParObjComponentTest.h +++ b/Framework/Geometry/test/ParObjComponentTest.h @@ -273,13 +273,8 @@ public: TS_ASSERT_DELTA(point.Y(), 10.0, 1e-6); TS_ASSERT_DELTA(point.Z(), -10.0, 1e-6); // Cuboid not on principle axes - std::vector<std::string> planes; - planes.emplace_back("px 0.5"); - planes.emplace_back("px 1.5"); - planes.emplace_back("py -22"); - planes.emplace_back("py -21"); - planes.emplace_back("pz -0.5"); - planes.emplace_back("pz 0.5"); + std::vector<std::string> planes{"px 0.5", "px 1.5", "py -22", + "py -21", "pz -0.5", "pz 0.5"}; ObjComponent D("ocube", createCuboid(planes)); D.setPos(10, 0, 0); D.setRot(Quat(90.0, V3D(0, 0, 1))); diff --git a/Framework/Geometry/test/ReflectionGeneratorTest.h b/Framework/Geometry/test/ReflectionGeneratorTest.h index 23516463984..eb9935e3afa 100644 --- a/Framework/Geometry/test/ReflectionGeneratorTest.h +++ b/Framework/Geometry/test/ReflectionGeneratorTest.h @@ -61,10 +61,7 @@ public: } void test_getDValues() { - std::vector<V3D> hkls; - hkls.emplace_back(1, 0, 0); - hkls.emplace_back(0, 1, 0); - hkls.emplace_back(0, 0, 1); + std::vector<V3D> hkls{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; ReflectionGenerator generator( CrystalStructure("2 3 5", "P -1", "Si 0 0 0 1.0 0.01")); diff --git a/Framework/Geometry/test/SphereTest.h b/Framework/Geometry/test/SphereTest.h index 5fdccc4d9a2..aa2e67fbb87 100644 --- a/Framework/Geometry/test/SphereTest.h +++ b/Framework/Geometry/test/SphereTest.h @@ -190,9 +190,8 @@ public: @retval 0 :: All passed */ { - std::vector<std::string> SphStr; - SphStr.emplace_back("so 1"); // sphere origin - SphStr.emplace_back("s 1.5 -2.5 1.8 1"); // sphere + std::vector<std::string> SphStr{ + "so 1", "s 1.5 -2.5 1.8 1"}; // sphere origin, sphere Kernel::V3D P(3, 7, 4); Kernel::V3D Q(0, 0, 4); std::vector<std::string>::const_iterator vc; diff --git a/Framework/Geometry/test/SurfaceTest.h b/Framework/Geometry/test/SurfaceTest.h index b583a94fcf7..0ede93b7836 100644 --- a/Framework/Geometry/test/SurfaceTest.h +++ b/Framework/Geometry/test/SurfaceTest.h @@ -28,9 +28,8 @@ public: Test the distance of a point from the cone */ { - std::vector<std::string> ConeStr; - ConeStr.emplace_back("kx 0 1"); // cone at origin - ConeStr.emplace_back("k/x 0 0 0 1"); // also cone at origin + std::vector<std::string> ConeStr{ + "kx 0 1", "k/x 0 0 0 1"}; // cone at origin, also cone at origin Kernel::V3D P(-1, -1.2, 0); const double results[] = {sin(atan(1.2) - M_PI / 4) * sqrt(2.44), sin(atan(1.2) - M_PI / 4) * sqrt(2.44)}; diff --git a/Framework/Geometry/test/SymmetryOperationFactoryTest.h b/Framework/Geometry/test/SymmetryOperationFactoryTest.h index 8f53b3bf996..0f5c6e412c5 100644 --- a/Framework/Geometry/test/SymmetryOperationFactoryTest.h +++ b/Framework/Geometry/test/SymmetryOperationFactoryTest.h @@ -52,8 +52,7 @@ public: } void testCreateSymOpsVector() { - std::vector<std::string> opStrings; - opStrings.emplace_back("x,y,z"); + std::vector<std::string> opStrings{"x,y,z"}; std::vector<SymmetryOperation> symOps = SymmetryOperationFactory::Instance().createSymOps(opStrings); diff --git a/Framework/Kernel/test/FileValidatorTest.h b/Framework/Kernel/test/FileValidatorTest.h index aa511e6e573..90c9fa45d2f 100644 --- a/Framework/Kernel/test/FileValidatorTest.h +++ b/Framework/Kernel/test/FileValidatorTest.h @@ -16,10 +16,7 @@ public: TS_ASSERT_EQUALS(v1.allowedValues().size(), 0); // one with a vector of extensions - std::vector<std::string> vec; - vec.emplace_back("raw"); - vec.emplace_back("RAW"); - FileValidator v2(vec); + FileValidator v2({"raw", "RAW"}); // File extensions are converted to lowercase so should have one unique // extension @@ -85,16 +82,14 @@ public: void testFailsOnNonexistentFile() { std::string NoFile("myJunkFile_hgfvj.cpp"); - std::vector<std::string> vec; - vec.emplace_back("cpp"); + std::vector<std::string> vec{"cpp"}; FileValidator v(vec); TS_ASSERT_EQUALS(v.isValid(NoFile), "File \"" + NoFile + "\" not found"); } void testPassesOnNonexistentFile() { std::string NoFile("myJunkFile_hgfvj.cpp"); - std::vector<std::string> vec; - vec.emplace_back("cpp"); + std::vector<std::string> vec{"cpp"}; FileValidator v(vec, false); TS_ASSERT_EQUALS(v.isValid(NoFile), ""); } diff --git a/Framework/Kernel/test/ListValidatorTest.h b/Framework/Kernel/test/ListValidatorTest.h index 3052d11c720..6dddb0f8eb8 100644 --- a/Framework/Kernel/test/ListValidatorTest.h +++ b/Framework/Kernel/test/ListValidatorTest.h @@ -15,10 +15,7 @@ public: } void testVectorConstructor() { - std::vector<std::string> vec; - vec.emplace_back("one"); - vec.emplace_back("two"); - vec.emplace_back("three"); + std::vector<std::string> vec{"one", "two", "three"}; StringListValidator v(vec); TS_ASSERT_EQUALS(v.allowedValues().size(), 3) } @@ -72,14 +69,9 @@ public: } void testAliasString() { - std::vector<std::string> values; - values.emplace_back("one"); - values.emplace_back("three"); - values.emplace_back("two"); - std::map<std::string, std::string> aliases; - aliases["1"] = "one"; - aliases["2"] = "two"; - aliases["3"] = "three"; + std::vector<std::string> values{"one", "three", "two"}; + std::map<std::string, std::string> aliases{ + {"1", "one"}, {"2", "two"}, {"3", "three"}}; StringListValidator validator(values, aliases); TS_ASSERT_EQUALS(validator.isValid("one"), "") TS_ASSERT_EQUALS(validator.isValid("two"), "") @@ -99,14 +91,9 @@ public: } void testAliasInt() { - std::vector<int> values; - values.push_back(1); - values.push_back(5); - values.push_back(3); - std::map<std::string, std::string> aliases; - aliases["11"] = "1"; - aliases["33"] = "3"; - aliases["55"] = "5"; + std::vector<int> values{1, 5, 3}; + std::map<std::string, std::string> aliases{ + {"11", "1"}, {"33", "3"}, {"55", "5"}}; ListValidator<int> validator(values, aliases); TS_ASSERT_EQUALS(validator.isValid(1), "") TS_ASSERT_EQUALS(validator.isValid(3), "") @@ -126,24 +113,16 @@ public: } void test_wrong_alias() { - std::vector<std::string> values; - values.emplace_back("one"); - values.emplace_back("three"); - std::map<std::string, std::string> aliases; - aliases["1"] = "one"; - aliases["2"] = "two"; + std::vector<std::string> values{"one", "three"}; + std::map<std::string, std::string> aliases{{"1", "one"}, {"2", "two"}}; TS_ASSERT_THROWS(StringListValidator validator(values, aliases), std::invalid_argument); } void test_self_alias() { - std::vector<std::string> values; - values.emplace_back("one"); - values.emplace_back("three"); - std::map<std::string, std::string> aliases; - aliases["1"] = "one"; - aliases["three"] = "three"; - aliases["one"] = "three"; + std::vector<std::string> values{"one", "three"}; + std::map<std::string, std::string> aliases{ + {"1", "one"}, {"three", "three"}, {"one", "three"}}; StringListValidator validator(values, aliases); TS_ASSERT_EQUALS(validator.isValid("one"), "") diff --git a/Framework/Kernel/test/MultiFileValidatorTest.h b/Framework/Kernel/test/MultiFileValidatorTest.h index 41113fcfa5a..bd2e0b3332b 100644 --- a/Framework/Kernel/test/MultiFileValidatorTest.h +++ b/Framework/Kernel/test/MultiFileValidatorTest.h @@ -23,9 +23,7 @@ using namespace Mantid::Kernel; class MultiFileValidatorTest : public CxxTest::TestSuite { public: void testVectorConstructor() { - std::vector<std::string> vec; - vec.emplace_back("raw"); - vec.emplace_back("RAW"); + std::vector<std::string> vec{"raw", "RAW"}; FileValidator v(vec); // File extensions are converted to lowercase so should have one unique @@ -34,10 +32,7 @@ public: } void testCopyConstructor() { - std::vector<std::string> vec; - vec.emplace_back("raw"); - vec.emplace_back("RAW"); - FileValidator v(vec); + FileValidator v({"raw", "RAW"}); FileValidator copy(v); // File extensions are converted to lowercase so should have one unique diff --git a/Framework/Kernel/test/PropertyWithValueTest.h b/Framework/Kernel/test/PropertyWithValueTest.h index 8f33ae46dc8..bfbd3a30361 100644 --- a/Framework/Kernel/test/PropertyWithValueTest.h +++ b/Framework/Kernel/test/PropertyWithValueTest.h @@ -623,13 +623,7 @@ public: delete p2; // --- Vectors are appennded together ---- - std::vector<int> v1, v2; - v1.push_back(1); - v1.push_back(2); - v1.push_back(3); - v1.push_back(4); - v1.push_back(5); - v1.push_back(6); + std::vector<int> v1{1, 2, 3, 4, 5, 6}, v2; p1 = new PropertyWithValue<std::vector<int>>("Prop1", v1); p2 = new PropertyWithValue<std::vector<int>>("Prop1", v2); (*p1) += p2; @@ -643,12 +637,8 @@ public: void test_string_property_alias() { // system("pause"); - std::vector<std::string> allowedValues; - allowedValues.emplace_back("Hello"); - allowedValues.emplace_back("World"); - std::map<std::string, std::string> alias; - alias["1"] = "Hello"; - alias["0"] = "World"; + std::vector<std::string> allowedValues{"Hello", "World"}; + std::map<std::string, std::string> alias{{"1", "Hello"}, {"0", "World"}}; auto validator = boost::make_shared<ListValidator<std::string>>(allowedValues, alias); PropertyWithValue<std::string> prop("String", "", validator); diff --git a/Framework/Kernel/test/StartsWithValidatorTest.h b/Framework/Kernel/test/StartsWithValidatorTest.h index 0c4dc8ce25b..f9e6bc34199 100644 --- a/Framework/Kernel/test/StartsWithValidatorTest.h +++ b/Framework/Kernel/test/StartsWithValidatorTest.h @@ -15,10 +15,7 @@ public: } void testVectorConstructor() { - std::vector<std::string> vec; - vec.emplace_back("one"); - vec.emplace_back("two"); - vec.emplace_back("three"); + std::vector<std::string> vec{"one", "two", "three"}; StartsWithValidator v(vec); TS_ASSERT_EQUALS(v.allowedValues().size(), 3) } diff --git a/Framework/Kernel/test/StatisticsTest.h b/Framework/Kernel/test/StatisticsTest.h index 0f99cc8cafb..c4857ffead4 100644 --- a/Framework/Kernel/test/StatisticsTest.h +++ b/Framework/Kernel/test/StatisticsTest.h @@ -169,8 +169,7 @@ public: bool my_isnan(const double number) { return number != number; } void testString() { - vector<string> data; - data.emplace_back("hi there"); + vector<string> data{"hi there"}; Statistics stats = getStatistics(data); @@ -212,24 +211,9 @@ public: /** Test throw exception */ void testRwpException1() { - vector<double> obsY(4); - vector<double> calY(4); - vector<double> obsE(3); - - obsY[0] = 1.0; - calY[0] = 1.1; - obsE[0] = 1.0; - - obsY[1] = 2.0; - calY[1] = 2.1; - obsE[1] = 1.2; - - obsY[2] = 3.0; - calY[2] = 3.5; - obsE[2] = 1.4; - - obsY[3] = 1.0; - calY[3] = 1.3; + vector<double> obsY{1.0, 2.0, 3.0, 1.0}; + vector<double> calY{1.1, 2.1, 3.5, 1.3}; + vector<double> obsE{1.0, 1.2, 1.4}; TS_ASSERT_THROWS_ANYTHING(getRFactor(obsY, calY, obsE)); } diff --git a/Framework/Kernel/test/StringContainsValidatorTest.h b/Framework/Kernel/test/StringContainsValidatorTest.h index 47a4cf2b381..19828592ef2 100644 --- a/Framework/Kernel/test/StringContainsValidatorTest.h +++ b/Framework/Kernel/test/StringContainsValidatorTest.h @@ -25,28 +25,21 @@ public: void test_one_word_required() { StringContainsValidator validator; - auto required = std::vector<std::string>(); - required.emplace_back("test"); - validator.setRequiredStrings(required); + validator.setRequiredStrings({"test"}); const std::string input = "This is a test string"; TS_ASSERT_EQUALS("", validator.isValid(input)); } void test_multiple_words_required() { StringContainsValidator validator; - auto required = std::vector<std::string>(); - required.emplace_back("test"); - required.emplace_back("This"); - validator.setRequiredStrings(required); + validator.setRequiredStrings({"test", "This"}); const std::string input = "This is a test string"; TS_ASSERT_EQUALS("", validator.isValid(input)); } void test_capitalisation_is_enforced_correctly() { StringContainsValidator validator; - auto required = std::vector<std::string>(); - required.emplace_back("this"); - validator.setRequiredStrings(required); + validator.setRequiredStrings({"this"}); const std::string input = "This is a test string"; const std::string error = "Error not all the required substrings were " "contained within the input '" + @@ -56,10 +49,7 @@ public: void test_error_produced_if_string_does_not_contain_all_the_substrings() { StringContainsValidator validator; - auto required = std::vector<std::string>(); - required.emplace_back("not"); - required.emplace_back("present"); - validator.setRequiredStrings(required); + validator.setRequiredStrings({"not", "present"}); const std::string input = "This is a test string"; const std::string error = "Error not all the required substrings were " "contained within the input '" + @@ -69,10 +59,7 @@ public: void test_error_produced_if_string_only_contains_some_of_the_substrings() { StringContainsValidator validator; - auto required = std::vector<std::string>(); - required.emplace_back("not"); - required.emplace_back("This"); - validator.setRequiredStrings(required); + validator.setRequiredStrings({"not", "This"}); const std::string input = "This is a test string"; const std::string error = "Error not all the required substrings were " "contained within the input '" + @@ -82,18 +69,14 @@ public: void test_substring_is_allowed_to_contain_punctuation() { StringContainsValidator validator; - auto required = std::vector<std::string>(); - required.emplace_back(","); - validator.setRequiredStrings(required); + validator.setRequiredStrings({","}); const std::string input = "This, is a test string"; TS_ASSERT_EQUALS("", validator.isValid(input)); } void test_an_empty_string_produces_an_error() { StringContainsValidator validator; - auto required = std::vector<std::string>(); - required.emplace_back(","); - validator.setRequiredStrings(required); + validator.setRequiredStrings({","}); const std::string input = ""; const std::string error = "A value must be entered for this parameter."; TS_ASSERT_EQUALS(error, validator.isValid(input)); diff --git a/Framework/Kernel/test/StringsTest.h b/Framework/Kernel/test/StringsTest.h index 3c20eb8ab23..105ae299476 100644 --- a/Framework/Kernel/test/StringsTest.h +++ b/Framework/Kernel/test/StringsTest.h @@ -279,11 +279,7 @@ public: } void test_isMember() { - std::vector<std::string> group(5, ""); - group[0] = "A"; - group[1] = "A1"; - group[2] = "B0"; - group[3] = "C"; + std::vector<std::string> group{"A", "A1", "B0", "C"}; TS_ASSERT_EQUALS(1, isMember(group, "A1")); TS_ASSERT_EQUALS(-1, isMember(group, " ")); @@ -295,13 +291,7 @@ public: void test_parseRange_defaultSimple() { std::vector<int> result; TS_ASSERT_THROWS_NOTHING(result = parseRange("3,1,4,0,2,5")); - std::vector<int> expected(6); - expected[0] = 3; - expected[1] = 1; - expected[2] = 4; - expected[3] = 0; - expected[4] = 2; - expected[5] = 5; + std::vector<int> expected{3, 1, 4, 0, 2, 5}; TS_ASSERT_EQUALS(result, expected); } @@ -319,10 +309,7 @@ public: } void test_parseRange_emptyElements() { - std::vector<int> expected(3); - expected[0] = 1; - expected[1] = 2; - expected[2] = 3; + std::vector<int> expected{1, 2, 3}; std::vector<int> result1; TS_ASSERT_THROWS_NOTHING(result1 = parseRange(",1,2,3")); diff --git a/Framework/Kernel/test/TimeSeriesPropertyTest.h b/Framework/Kernel/test/TimeSeriesPropertyTest.h index 734ae4ac157..ee6e36a0384 100644 --- a/Framework/Kernel/test/TimeSeriesPropertyTest.h +++ b/Framework/Kernel/test/TimeSeriesPropertyTest.h @@ -1166,11 +1166,9 @@ public: TS_ASSERT_THROWS_NOTHING(p->addValue("2007-11-30T16:17:30", 4.00)); // 2. What is correct - std::vector<std::string> correctS; - correctS.emplace_back("2007-Nov-30 16:17:00 1"); - correctS.emplace_back("2007-Nov-30 16:17:10 2"); - correctS.emplace_back("2007-Nov-30 16:17:20 3"); - correctS.emplace_back("2007-Nov-30 16:17:30 4"); + std::vector<std::string> correctS{ + "2007-Nov-30 16:17:00 1", "2007-Nov-30 16:17:10 2", + "2007-Nov-30 16:17:20 3", "2007-Nov-30 16:17:30 4"}; // 3. Check std::vector<std::string> tvalues = p->time_tValue(); diff --git a/Framework/Kernel/test/V3DTest.h b/Framework/Kernel/test/V3DTest.h index 6ccf7c7228f..66393d0d847 100644 --- a/Framework/Kernel/test/V3DTest.h +++ b/Framework/Kernel/test/V3DTest.h @@ -397,12 +397,9 @@ public: } void test_makeVectorsOrthogonal() { - std::vector<V3D> in, out; // Simple case - in.clear(); - in.emplace_back(1, 0, 0); - in.emplace_back(0, 1, 0); - out = V3D::makeVectorsOrthogonal(in); + std::vector<V3D> in{{1, 0, 0}, {0, 1, 0}}; + auto out = V3D::makeVectorsOrthogonal(in); TS_ASSERT(out[0] == V3D(1, 0, 0)); TS_ASSERT(out[1] == V3D(0, 1, 0)); TS_ASSERT(out[2] == V3D(0, 0, 1)); diff --git a/Framework/LiveData/src/LiveDataAlgorithm.cpp b/Framework/LiveData/src/LiveDataAlgorithm.cpp index dccebf57442..fc2f730fe65 100644 --- a/Framework/LiveData/src/LiveDataAlgorithm.cpp +++ b/Framework/LiveData/src/LiveDataAlgorithm.cpp @@ -81,10 +81,7 @@ void LiveDataAlgorithm::initProps() { "data. Only for command line usage, does not appear on the " "user interface."); - std::vector<std::string> propOptions; - propOptions.emplace_back("Add"); - propOptions.emplace_back("Replace"); - propOptions.emplace_back("Append"); + std::vector<std::string> propOptions{"Add", "Replace", "Append"}; declareProperty( "AccumulationMethod", "Add", boost::make_shared<StringListValidator>(propOptions), @@ -121,10 +118,7 @@ void LiveDataAlgorithm::initProps() { Direction::Input), "A Python script that will be run to process the accumulated data."); - std::vector<std::string> runOptions; - runOptions.emplace_back("Restart"); - runOptions.emplace_back("Stop"); - runOptions.emplace_back("Rename"); + std::vector<std::string> runOptions{"Restart", "Stop", "Rename"}; declareProperty("RunTransitionBehavior", "Restart", boost::make_shared<StringListValidator>(runOptions), "What to do at run start/end boundaries?\n" diff --git a/Framework/MDAlgorithms/src/AccumulateMD.cpp b/Framework/MDAlgorithms/src/AccumulateMD.cpp index 4346aa85058..f9ffb02a950 100644 --- a/Framework/MDAlgorithms/src/AccumulateMD.cpp +++ b/Framework/MDAlgorithms/src/AccumulateMD.cpp @@ -242,10 +242,7 @@ void AccumulateMD::init() { declareProperty(new ArrayProperty<double>("EFix", Direction::Input), "datasource energy values in meV"); - std::vector<std::string> e_mode_options; - e_mode_options.emplace_back("Elastic"); - e_mode_options.emplace_back("Direct"); - e_mode_options.emplace_back("Indirect"); + std::vector<std::string> e_mode_options{"Elastic", "Direct", "Indirect"}; declareProperty("Emode", "Direct", boost::make_shared<StringListValidator>(e_mode_options), diff --git a/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp b/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp index 497e4080cf3..7738a7b3201 100644 --- a/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp +++ b/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp @@ -130,11 +130,7 @@ void CalculateCoverageDGS::init() { Mantid::Kernel::Direction::Input), "Incident energy. If set, will override Ei in the input workspace"); - std::vector<std::string> options; - options.emplace_back("Q1"); - options.emplace_back("Q2"); - options.emplace_back("Q3"); - options.emplace_back("DeltaE"); + std::vector<std::string> options{"Q1", "Q2", "Q3", "DeltaE"}; for (int i = 1; i <= 4; i++) { std::string dim("Dimension"); diff --git a/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp b/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp index fce8886120c..9d528e7515b 100644 --- a/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/CentroidPeaksMD.cpp @@ -41,10 +41,8 @@ void CentroidPeaksMD::init() { Direction::Input), "An input MDEventWorkspace."); - std::vector<std::string> propOptions; - propOptions.emplace_back("Q (lab frame)"); - propOptions.emplace_back("Q (sample frame)"); - propOptions.emplace_back("HKL"); + std::vector<std::string> propOptions{"Q (lab frame)", "Q (sample frame)", + "HKL"}; declareProperty("CoordinatesToUse", "HKL", boost::make_shared<StringListValidator>(propOptions), "Ignored: algorithm uses the InputWorkspace's coordinates."); diff --git a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp index d2bb8762fa5..ed5a2e70bfe 100644 --- a/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWPDMDToSpectra.cpp @@ -53,10 +53,8 @@ void ConvertCWPDMDToSpectra::init() { Direction::Output), "Name of the output workspace for reduced data."); - std::vector<std::string> vecunits; - vecunits.emplace_back("2theta"); - vecunits.emplace_back("dSpacing"); - vecunits.emplace_back("Momentum Transfer (Q)"); + std::vector<std::string> vecunits{"2theta", "dSpacing", + "Momentum Transfer (Q)"}; auto unitval = boost::make_shared<ListValidator<std::string>>(vecunits); declareProperty("UnitOutput", "2theta", unitval, "Unit of the output workspace."); diff --git a/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp index 9bc146cbca2..d16f31d3870 100644 --- a/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp @@ -66,8 +66,7 @@ void ConvertCWSDMDtoHKL::init() { "OutputWorkspace", "", Direction::Output), "Name of the output MDEventWorkspace in HKL-space."); - std::vector<std::string> exts; - exts.emplace_back(".dat"); + std::vector<std::string> exts{".dat"}; declareProperty( new FileProperty("QSampleFileName", "", API::FileProperty::OptionalSave), "Name of file for sample sample."); diff --git a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp index e34b60ca8f6..335b93b4f94 100644 --- a/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp +++ b/Framework/MDAlgorithms/src/ConvertSpiceDataToRealSpace.cpp @@ -61,8 +61,7 @@ void ConvertSpiceDataToRealSpace::init() { "input RunInfoWorkspace."); /// TODO - Add HB2B as it is implemented in future - std::vector<std::string> allowedinstruments; - allowedinstruments.emplace_back("HB2A"); + std::vector<std::string> allowedinstruments{"HB2A"}; auto instrumentvalidator = boost::make_shared<ListValidator<std::string>>(allowedinstruments); declareProperty("Instrument", "HB2A", instrumentvalidator, diff --git a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp index 12de6fdb8b1..c24f457e8ec 100644 --- a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp @@ -81,10 +81,8 @@ void ConvertToDiffractionMDWorkspace::init() { "One MDEvent will be created for each histogram bin (even empty ones).\n" "Warning! This can use signficantly more memory!"); - std::vector<std::string> propOptions; - propOptions.emplace_back("Q (lab frame)"); - propOptions.emplace_back("Q (sample frame)"); - propOptions.emplace_back("HKL"); + std::vector<std::string> propOptions{"Q (lab frame)", "Q (sample frame)", + "HKL"}; declareProperty( "OutputDimensions", "Q (lab frame)", boost::make_shared<StringListValidator>(propOptions), diff --git a/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp b/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp index a2e549d522a..a3e46d9ce99 100644 --- a/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp @@ -98,10 +98,7 @@ void ConvertToMDMinMaxGlobal::init() { "dEAnalysisMode", new VisibleWhenProperty("QDimensions", IS_NOT_EQUAL_TO, "CopyToMD")); - std::vector<std::string> TargFrames; - TargFrames.emplace_back("AutoSelect"); - TargFrames.emplace_back("Q"); - TargFrames.emplace_back("HKL"); + std::vector<std::string> TargFrames{"AutoSelect", "Q", "HKL"}; declareProperty( "Q3DFrames", "AutoSelect", boost::make_shared<StringListValidator>(TargFrames), diff --git a/Framework/MDAlgorithms/src/CreateMD.cpp b/Framework/MDAlgorithms/src/CreateMD.cpp index ba491e74933..b697f1e94d7 100644 --- a/Framework/MDAlgorithms/src/CreateMD.cpp +++ b/Framework/MDAlgorithms/src/CreateMD.cpp @@ -114,10 +114,7 @@ void CreateMD::init() { declareProperty(new ArrayProperty<double>("EFix", Direction::Input), "datasource energy values in meV"); - std::vector<std::string> e_mode_options; - e_mode_options.emplace_back("Elastic"); - e_mode_options.emplace_back("Direct"); - e_mode_options.emplace_back("Indirect"); + std::vector<std::string> e_mode_options{"Elastic", "Direct", "Indirect"}; declareProperty("Emode", "Direct", boost::make_shared<StringListValidator>(e_mode_options), diff --git a/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp b/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp index e161aedfdc6..98f4d776607 100644 --- a/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp @@ -43,9 +43,7 @@ void CreateMDWorkspace::init() { declareProperty(new PropertyWithValue<int>("Dimensions", 1, Direction::Input), "Number of dimensions that the workspace will have."); - std::vector<std::string> propOptions; - propOptions.emplace_back("MDEvent"); - propOptions.emplace_back("MDLeanEvent"); + std::vector<std::string> propOptions{"MDEvent", "MDLeanEvent"}; declareProperty("EventType", "MDLeanEvent", boost::make_shared<StringListValidator>(propOptions), "Which underlying data type will event take."); diff --git a/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp b/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp index 78c79f8f6cb..a9ef4e46885 100644 --- a/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp +++ b/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp @@ -43,10 +43,7 @@ void GetSpiceDataRawCountsFromMD::init() { Direction::Output), "Name of the output MatrixWorkspace containing the raw data required."); - std::vector<std::string> vecmode; - vecmode.emplace_back("Pt."); - vecmode.emplace_back("Detector"); - vecmode.emplace_back("Sample Log"); + std::vector<std::string> vecmode{"Pt.", "Detector", "Sample Log"}; auto modevalidator = boost::make_shared<ListValidator<std::string>>(vecmode); declareProperty( "Mode", "Detector", modevalidator, diff --git a/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp b/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp index 22ef66fdc63..54e9f09d6a8 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksMD.cpp @@ -55,10 +55,8 @@ void IntegratePeaksMD::init() { Direction::Input), "An input MDEventWorkspace."); - std::vector<std::string> propOptions; - propOptions.emplace_back("Q (lab frame)"); - propOptions.emplace_back("Q (sample frame)"); - propOptions.emplace_back("HKL"); + std::vector<std::string> propOptions{"Q (lab frame)", "Q (sample frame)", + "HKL"}; declareProperty("CoordinatesToUse", "Q (lab frame)", boost::make_shared<StringListValidator>(propOptions), "Ignored: algorithm uses the InputWorkspace's coordinates."); diff --git a/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index 953fa506ccf..4a3f788c1c7 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -57,10 +57,8 @@ void IntegratePeaksMD2::init() { Direction::Input), "An input MDEventWorkspace."); - std::vector<std::string> propOptions; - propOptions.emplace_back("Q (lab frame)"); - propOptions.emplace_back("Q (sample frame)"); - propOptions.emplace_back("HKL"); + std::vector<std::string> propOptions{"Q (lab frame)", "Q (sample frame)", + "HKL"}; declareProperty( new PropertyWithValue<double>("PeakRadius", 1.0, Direction::Input), diff --git a/Framework/MDAlgorithms/src/SmoothMD.cpp b/Framework/MDAlgorithms/src/SmoothMD.cpp index 6c2df4c4447..fa68077e87b 100644 --- a/Framework/MDAlgorithms/src/SmoothMD.cpp +++ b/Framework/MDAlgorithms/src/SmoothMD.cpp @@ -48,12 +48,7 @@ namespace { * @brief functions * @return Allowed smoothing functions */ -std::vector<std::string> functions() { - std::vector<std::string> propOptions; - propOptions.emplace_back("Hat"); - // propOptions.emplace_back("Gaussian"); - return propOptions; -} +std::vector<std::string> functions() { return {"Hat"}; } /** * Maps a function name to a smoothing function diff --git a/Framework/MDAlgorithms/test/AccumulateMDTest.h b/Framework/MDAlgorithms/test/AccumulateMDTest.h index de2637dcda3..7727edad7bb 100644 --- a/Framework/MDAlgorithms/test/AccumulateMDTest.h +++ b/Framework/MDAlgorithms/test/AccumulateMDTest.h @@ -143,10 +143,7 @@ public: } void test_filter_to_new_none_new() { - std::vector<std::string> input_data; - input_data.emplace_back("test1"); - input_data.emplace_back("test2"); - input_data.emplace_back("test3"); + std::vector<std::string> input_data{"test1", "test2", "test3"}; std::vector<std::string> current_data = input_data; // Create vector for other parameters @@ -169,17 +166,9 @@ public: } void test_filter_to_new() { - std::vector<std::string> input_data; - input_data.emplace_back("test1"); - input_data.emplace_back("test2"); - input_data.emplace_back("test3"); - input_data.emplace_back("test4"); - input_data.emplace_back("test5"); - - std::vector<std::string> current_data; - current_data.emplace_back("test1"); - current_data.emplace_back("test3"); - current_data.emplace_back("test4"); + std::vector<std::string> input_data{"test1", "test2", "test3", "test4", + "test5"}; + std::vector<std::string> current_data{"test1", "test3", "test4"}; // Create vector for other parameters std::vector<double> psi(5, 0.0); diff --git a/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h b/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h index d6810283282..a0a4b44245b 100644 --- a/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h +++ b/Framework/MDAlgorithms/test/CalculateCoverageDGSTest.h @@ -43,9 +43,8 @@ public: inputWSName("CalculateCoverageDGSTest_InputWS"); MatrixWorkspace_sptr inputWorkspace = WorkspaceCreationHelper::Create2DWorkspace(1, 1); - std::vector<V3D> detectorPositions; + std::vector<V3D> detectorPositions{{1, 1, 1}}; V3D sampPos(0., 0., 0.), sourcePos(0, 0, -1.); - detectorPositions.emplace_back(1, 1, 1); WorkspaceCreationHelper::createInstrumentForWorkspaceWithDistances( inputWorkspace, sampPos, sourcePos, detectorPositions); OrientedLattice ol(2, 2, 2, 90, 90, 90); diff --git a/Framework/MDAlgorithms/test/Integrate3DEventsTest.h b/Framework/MDAlgorithms/test/Integrate3DEventsTest.h index dc3778ff12f..182b6c3a4c6 100644 --- a/Framework/MDAlgorithms/test/Integrate3DEventsTest.h +++ b/Framework/MDAlgorithms/test/Integrate3DEventsTest.h @@ -28,14 +28,13 @@ public: double sigi_some[] = {27.4590, 26.5141, 24.5561}; // synthesize three peaks - std::vector<std::pair<double, V3D>> peak_q_list; + V3D peak_1(10, 0, 0); V3D peak_2(0, 5, 0); V3D peak_3(0, 0, 4); + std::vector<std::pair<double, V3D>> peak_q_list{ + {1., peak_1}, {1., peak_2}, {1., peak_3}}; - peak_q_list.emplace_back(1., peak_1); - peak_q_list.emplace_back(1., peak_2); - peak_q_list.emplace_back(1., peak_3); // synthesize a UB-inverse to map DblMatrix UBinv(3, 3, false); // Q to h,k,l UBinv.setRow(0, V3D(.1, 0, 0)); diff --git a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp index 96f20ae9270..6c4873c9aa7 100644 --- a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp +++ b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp @@ -46,16 +46,9 @@ SCARFTomoReconstruction::SCARFTomoReconstruction() void SCARFTomoReconstruction::init() { // list of all actions - std::vector<std::string> actions; - actions.emplace_back("LogIn"); - actions.emplace_back("LogOut"); - actions.emplace_back("Ping"); - actions.emplace_back("Upload"); - actions.emplace_back("SubmitJob"); - actions.emplace_back("JobStatus"); - actions.emplace_back("JobStatusByID"); - actions.emplace_back("Download"); - actions.emplace_back("CancelJob"); + std::vector<std::string> actions{"LogIn", "LogOut", "Ping", + "Upload", "SubmitJob", "JobStatus", + "JobStatusByID", "Download", "CancelJob"}; auto listValue = boost::make_shared<StringListValidator>(actions); auto nullV = boost::make_shared<Kernel::NullValidator>(); @@ -403,10 +396,9 @@ void SCARFTomoReconstruction::doLogout(const std::string &username) { const std::string token = it->second.m_token_str; std::string httpsURL = baseURL + logoutPath; - StringToStringMap headers; - headers.emplace("Content-Type", "text/plain"); - headers.emplace("Cookie", token); - headers.emplace("Accept", m_acceptType); + StringToStringMap headers{{"Content-Type", "text/plain"}, + {"Cookie", token}, + {"Accept", m_acceptType}}; int code; std::stringstream ss; try { @@ -508,10 +500,10 @@ void SCARFTomoReconstruction::doSubmit(const std::string &username) { const std::string token = it->second.m_token_str; std::string httpsURL = baseURL + submitPath; - StringToStringMap headers; - headers.emplace("Content-Type", "multipart/mixed; boundary=" + boundary); - headers.emplace("Accept", m_acceptType); - headers.emplace("Cookie", token); + StringToStringMap headers{ + {"Content-Type", "multipart/mixed; boundary=" + boundary}, + {"Accept", m_acceptType}, + {"Cookie", token}}; int code; std::stringstream ss; try { @@ -568,11 +560,9 @@ void SCARFTomoReconstruction::doQueryStatus(const std::string &username) { const std::string token = it->second.m_token_str; std::string httpsURL = baseURL + jobStatusPath; - StringToStringMap headers; - headers.insert( - std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.emplace("Accept", m_acceptType); - headers.emplace("Cookie", token); + StringToStringMap headers{{"Content-Type", "application/xml"}, + {"Accept", m_acceptType}, + {"Cookie", token}}; int code; std::stringstream ss; try { @@ -636,11 +626,9 @@ void SCARFTomoReconstruction::doQueryStatusById(const std::string &username, const std::string token = it->second.m_token_str; std::string httpsURL = baseURL + jobIdStatusPath; - StringToStringMap headers; - headers.insert( - std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.emplace("Accept", m_acceptType); - headers.emplace("Cookie", token); + StringToStringMap headers{{"Content-Type", "application/xml"}, + {"Accept", m_acceptType}, + {"Cookie", token}}; int code; std::stringstream ss; try { @@ -695,9 +683,8 @@ bool SCARFTomoReconstruction::doPing() { const std::string baseURL = "https://portal.scarf.rl.ac.uk:8443/"; std::string httpsURL = baseURL + pingPath; - StringToStringMap headers; - headers.emplace("Content-Type", "application/xml"); - headers.emplace("Accept", m_acceptType); + StringToStringMap headers{{"Content-Type", "application/xml"}, + {"Accept", m_acceptType}}; int code; std::stringstream ss; try { @@ -759,11 +746,9 @@ void SCARFTomoReconstruction::doCancel(const std::string &username, const std::string token = it->second.m_token_str; std::string httpsURL = baseURL + killPath; - StringToStringMap headers; - headers.insert( - std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.emplace("Cookie", token); - headers.emplace("Accept", m_acceptType); + StringToStringMap headers{{"Content-Type", "application/xml"}, + {"Cookie", token}, + {"Accept", m_acceptType}}; int code; std::stringstream ss; try { @@ -833,10 +818,10 @@ void SCARFTomoReconstruction::doUploadFile(const std::string &username, InternetHelper session; std::string httpsURL = baseURL + uploadPath; - StringToStringMap headers; - headers.emplace("Content-Type", "multipart/mixed; boundary=" + boundary); - headers.emplace("Accept", m_acceptType); - headers.emplace("Cookie", token); + StringToStringMap headers{ + {"Content-Type", "multipart/mixed; boundary=" + boundary}, + {"Accept", m_acceptType}, + {"Cookie", token}}; const std::string &body = buildUploadBody(boundary, destDir, filename); int code; @@ -1359,11 +1344,9 @@ void SCARFTomoReconstruction::getOneJobFile(const std::string &jobId, std::string httpsURL = baseURL + downloadOnePath; - StringToStringMap headers; - headers.insert( - std::pair<std::string, std::string>("Content-Type", "application/xml")); - headers.emplace("Cookie", token); - headers.emplace("Accept", m_acceptType); + StringToStringMap headers{{"Content-Type", "application/xml"}, + {"Cookie", token}, + {"Accept", m_acceptType}}; std::string body = remotePath; int code; std::stringstream ss; @@ -1429,10 +1412,9 @@ void SCARFTomoReconstruction::getAllJobFiles(const std::string &jobId, const std::string token = t.m_token_str; std::string httpsURL = baseURL + downloadPath; - StringToStringMap headers; - headers.emplace("Content-Type", "application/xml"); - headers.emplace("Cookie", token); - headers.emplace("Accept", m_acceptType); + StringToStringMap headers{{"Content-Type", "application/xml"}, + {"Cookie", token}, + {"Accept", m_acceptType}}; int code; std::stringstream ss; try { -- GitLab