Commit 8bbd2ea7 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Use emplace_back on string literals.

parent 7d219fbc
......@@ -213,7 +213,7 @@ const std::vector<std::string> Algorithm::categories() const {
const DeprecatedAlgorithm *depo =
dynamic_cast<const DeprecatedAlgorithm *>(this);
if (depo != NULL) {
res.push_back("Deprecated");
res.emplace_back("Deprecated");
}
return res;
}
......
......@@ -318,7 +318,7 @@ const std::vector<std::string> AlgorithmProxy::categories() const {
const DeprecatedAlgorithm *depo =
dynamic_cast<const DeprecatedAlgorithm *>(this);
if (depo != NULL) {
res.push_back("Deprecated");
res.emplace_back("Deprecated");
}
return res;
}
......
......@@ -164,9 +164,9 @@ NotebookBuilder::buildPropertyString(PropertyHistory_const_sptr propHistory) {
// Create a vector of all non workspace property type names
std::vector<std::string> nonWorkspaceTypes;
nonWorkspaceTypes.push_back("number");
nonWorkspaceTypes.push_back("boolean");
nonWorkspaceTypes.push_back("string");
nonWorkspaceTypes.emplace_back("number");
nonWorkspaceTypes.emplace_back("boolean");
nonWorkspaceTypes.emplace_back("string");
std::string prop = "";
// No need to specify value for default properties
......
......@@ -191,9 +191,9 @@ ScriptBuilder::buildPropertyString(PropertyHistory_const_sptr propHistory) {
// Create a vector of all non workspace property type names
std::vector<std::string> nonWorkspaceTypes;
nonWorkspaceTypes.push_back("number");
nonWorkspaceTypes.push_back("boolean");
nonWorkspaceTypes.push_back("string");
nonWorkspaceTypes.emplace_back("number");
nonWorkspaceTypes.emplace_back("boolean");
nonWorkspaceTypes.emplace_back("string");
std::string prop = "";
// No need to specify value for default properties
......
......@@ -141,8 +141,8 @@ public:
TS_ASSERT_EQUALS(alg->version(), 1);
TS_ASSERT_EQUALS(alg->category(), "ProxyCat;ProxyLeopard");
std::vector<std::string> result;
result.push_back("ProxyCat");
result.push_back("ProxyLeopard");
result.emplace_back("ProxyCat");
result.emplace_back("ProxyLeopard");
TS_ASSERT_EQUALS(alg->categories(), result);
TS_ASSERT_EQUALS(alg->alias(), "Dog");
TS_ASSERT(alg->isInitialized());
......
......@@ -191,10 +191,10 @@ public:
void testCategories() {
std::vector<std::string> result;
result.push_back("Cat");
result.emplace_back("Cat");
TS_ASSERT_EQUALS(alg.categories(), result);
result.push_back("Leopard");
result.push_back("Mink");
result.emplace_back("Leopard");
result.emplace_back("Mink");
TS_ASSERT_EQUALS(algv2.categories(), result);
TS_ASSERT_EQUALS(algv3.categories(), result);
}
......
......@@ -129,8 +129,8 @@ public:
void testOperators() {
std::vector<std::string> ops;
ops.push_back(",");
ops.push_back("=");
ops.emplace_back(",");
ops.emplace_back("=");
Expression expr(ops);
TS_ASSERT_THROWS_NOTHING(expr.parse("x=-1\"(2)\",y=2a+b*(x+y) "));
......@@ -175,7 +175,7 @@ public:
TS_ASSERT_EQUALS(e4[1].name(), "+");
std::vector<std::string> bin_ops;
bin_ops.push_back("=");
bin_ops.emplace_back("=");
std::set<std::string> un_ops;
un_ops.insert("!");
un_ops.insert("%%");
......@@ -213,7 +213,7 @@ public:
TS_ASSERT_EQUALS(e8[1].name(), "%%");
std::vector<std::string> bin_ops1;
bin_ops1.push_back("==");
bin_ops1.emplace_back("==");
std::set<std::string> un_ops1;
un_ops1.insert("!");
un_ops1.insert("%%");
......@@ -257,8 +257,8 @@ public:
TS_ASSERT_THROWS(e14.parse("x==%% "), std::runtime_error);
std::vector<std::string> bin_ops2;
bin_ops2.push_back("-");
bin_ops2.push_back("--");
bin_ops2.emplace_back("-");
bin_ops2.emplace_back("--");
std::set<std::string> un_ops2;
un_ops2.insert("-");
un_ops2.insert("--");
......
......@@ -245,9 +245,9 @@ public:
void testGetExtension() {
std::vector<std::string> exts;
exts.push_back("_event.nxs");
exts.push_back(".nxs.h5");
exts.push_back(".n*");
exts.emplace_back("_event.nxs");
exts.emplace_back(".nxs.h5");
exts.emplace_back(".n*");
TS_ASSERT_EQUALS(FileFinder::Instance().getExtension("", exts), "");
TS_ASSERT_EQUALS(FileFinder::Instance().getExtension("PG31234", exts), "");
......
......@@ -105,8 +105,8 @@ public:
m_tempDirs.insert(m_dummyFilesDir);
m_tempDirs.insert(m_dirWithWhitespace);
m_exts.push_back(".raw");
m_exts.push_back(".nxs");
m_exts.emplace_back(".raw");
m_exts.emplace_back(".nxs");
std::set<std::string> dummyFilenames = boost::assign::list_of
// Standard raw file runs.
......
......@@ -64,8 +64,8 @@ void AbsorptionCorrection::init() {
"calculated (default: all points)");
std::vector<std::string> exp_options;
exp_options.push_back("Normal");
exp_options.push_back("FastApprox");
exp_options.emplace_back("Normal");
exp_options.emplace_back("FastApprox");
declareProperty(
"ExpMethod", "Normal",
boost::make_shared<StringListValidator>(exp_options),
......@@ -73,9 +73,9 @@ void AbsorptionCorrection::init() {
"fast approximation (default: Normal)");
std::vector<std::string> propOptions;
propOptions.push_back("Elastic");
propOptions.push_back("Direct");
propOptions.push_back("Indirect");
propOptions.emplace_back("Elastic");
propOptions.emplace_back("Direct");
propOptions.emplace_back("Indirect");
declareProperty("EMode", "Elastic",
boost::make_shared<StringListValidator>(propOptions),
"The energy mode (default: elastic)");
......
......@@ -29,10 +29,10 @@ BinaryOperateMasks::~BinaryOperateMasks() {
void BinaryOperateMasks::init() {
std::vector<std::string> operators;
operators.push_back("AND");
operators.push_back("OR");
operators.push_back("XOR");
operators.push_back("NOT");
operators.emplace_back("AND");
operators.emplace_back("OR");
operators.emplace_back("XOR");
operators.emplace_back("NOT");
declareProperty(new WorkspaceProperty<DataObjects::MaskWorkspace>(
"InputWorkspace1", "", Direction::Input),
......
......@@ -47,8 +47,8 @@ void CalculateFlatBackground::init() {
"Indices of the spectra that will have their background removed\n"
"default: modify all spectra");
std::vector<std::string> modeOptions;
modeOptions.push_back("Linear Fit");
modeOptions.push_back("Mean");
modeOptions.emplace_back("Linear Fit");
modeOptions.emplace_back("Mean");
declareProperty("Mode", "Linear Fit",
boost::make_shared<StringListValidator>(modeOptions),
"The background count rate is estimated either by taking a "
......@@ -57,8 +57,8 @@ void CalculateFlatBackground::init() {
// Property to determine whether we subtract the background or just return the
// background.
std::vector<std::string> outputOptions;
outputOptions.push_back("Subtract Background");
outputOptions.push_back("Return Background");
outputOptions.emplace_back("Subtract Background");
outputOptions.emplace_back("Return Background");
declareProperty("OutputMode", "Subtract Background",
boost::make_shared<StringListValidator>(outputOptions),
"Once the background has been determined it can either be "
......
......@@ -51,8 +51,8 @@ void ConvertAxisByFormula::init() {
"Name of the output workspace");
std::vector<std::string> axisOptions;
axisOptions.push_back("X");
axisOptions.push_back("Y");
axisOptions.emplace_back("X");
axisOptions.emplace_back("Y");
declareProperty("Axis", "X",
boost::make_shared<StringListValidator>(axisOptions),
"The axis to modify");
......
......@@ -40,16 +40,16 @@ void ConvertSpectrumAxis::init() {
"The name to use for the output workspace.");
std::vector<std::string> targetOptions =
Mantid::Kernel::UnitFactory::Instance().getKeys();
targetOptions.push_back("theta");
targetOptions.push_back("signed_theta");
targetOptions.emplace_back("theta");
targetOptions.emplace_back("signed_theta");
declareProperty("Target", "",
boost::make_shared<StringListValidator>(targetOptions),
"The unit to which the spectrum axis should be converted. "
"This can be either \"theta\" (for <math>\\theta</math> "
"degrees), or any of the IDs known to the [[Unit Factory]].");
std::vector<std::string> eModeOptions;
eModeOptions.push_back("Direct");
eModeOptions.push_back("Indirect");
eModeOptions.emplace_back("Direct");
eModeOptions.emplace_back("Indirect");
declareProperty("EMode", "Direct",
boost::make_shared<StringListValidator>(eModeOptions),
"Some unit conversions require this value to be set "
......
......@@ -56,8 +56,8 @@ void ConvertSpectrumAxis2::init() {
"Note that 'theta' and 'signed_theta' are there for compatibility "
"purposes; they are the same as 'Theta' and 'SignedTheta' respectively");
std::vector<std::string> eModeOptions;
eModeOptions.push_back("Direct");
eModeOptions.push_back("Indirect");
eModeOptions.emplace_back("Direct");
eModeOptions.emplace_back("Indirect");
declareProperty("EMode", "Direct",
boost::make_shared<StringListValidator>(eModeOptions),
"Some unit conversions require this value to be set "
......
......@@ -61,9 +61,9 @@ void ConvertUnits::init() {
"registered in\n"
"the Unit Factory)");
std::vector<std::string> propOptions;
propOptions.push_back("Elastic");
propOptions.push_back("Direct");
propOptions.push_back("Indirect");
propOptions.emplace_back("Elastic");
propOptions.emplace_back("Direct");
propOptions.emplace_back("Indirect");
declareProperty("EMode", "Elastic",
boost::make_shared<StringListValidator>(propOptions),
"The energy mode (default: elastic)");
......
......@@ -46,9 +46,9 @@ void CopyLogs::init() {
// options for the type of strategy to take
std::vector<std::string> strategies;
strategies.push_back("WipeExisting");
strategies.push_back("MergeKeepExisting");
strategies.push_back("MergeReplaceExisting");
strategies.emplace_back("WipeExisting");
strategies.emplace_back("MergeKeepExisting");
strategies.emplace_back("MergeReplaceExisting");
auto strategiesValidator =
boost::make_shared<StringListValidator>(strategies);
......
......@@ -41,8 +41,8 @@ void CorrectKiKf::init() {
"Name of the output workspace, can be the same as the input");
std::vector<std::string> propOptions;
propOptions.push_back("Direct");
propOptions.push_back("Indirect");
propOptions.emplace_back("Direct");
propOptions.emplace_back("Indirect");
this->declareProperty("EMode", "Direct",
boost::make_shared<StringListValidator>(propOptions),
"The energy mode (default: Direct)");
......
......@@ -25,14 +25,14 @@ void CorrectToFile::init() {
std::vector<std::string> propOptions =
Kernel::UnitFactory::Instance().getKeys();
propOptions.push_back("SpectrumNumber");
propOptions.emplace_back("SpectrumNumber");
declareProperty("FirstColumnValue", "Wavelength",
boost::make_shared<Kernel::StringListValidator>(propOptions),
"The units of the first column of the correction file "
"(default wavelength)");
std::vector<std::string> operations(1, std::string("Divide"));
operations.push_back("Multiply");
operations.emplace_back("Multiply");
declareProperty("WorkspaceOperation", "Divide",
boost::make_shared<Kernel::StringListValidator>(operations),
"Allowed values: Divide, Multiply (default is divide)");
......
......@@ -81,11 +81,11 @@ void CreateGroupingWorkspace::init() {
"If empty, then an empty GroupingWorkspace will be created.");
std::vector<std::string> grouping;
grouping.push_back("");
grouping.push_back("All");
grouping.push_back("Group");
grouping.push_back("Column");
grouping.push_back("bank");
grouping.emplace_back("");
grouping.emplace_back("All");
grouping.emplace_back("Group");
grouping.emplace_back("Column");
grouping.emplace_back("bank");
declareProperty(
"GroupDetectorsBy", "", boost::make_shared<StringListValidator>(grouping),
"Only used if GroupNames is empty: All detectors as one group, Groups "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment