Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
8bbd2ea7
Commit
8bbd2ea7
authored
Jan 26, 2016
by
Hahn, Steven
Browse files
Use emplace_back on string literals.
parent
7d219fbc
Changes
199
Hide whitespace changes
Inline
Side-by-side
Framework/API/src/Algorithm.cpp
View file @
8bbd2ea7
...
...
@@ -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
;
}
...
...
Framework/API/src/AlgorithmProxy.cpp
View file @
8bbd2ea7
...
...
@@ -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
;
}
...
...
Framework/API/src/NotebookBuilder.cpp
View file @
8bbd2ea7
...
...
@@ -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
...
...
Framework/API/src/ScriptBuilder.cpp
View file @
8bbd2ea7
...
...
@@ -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
...
...
Framework/API/test/AlgorithmProxyTest.h
View file @
8bbd2ea7
...
...
@@ -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
());
...
...
Framework/API/test/AlgorithmTest.h
View file @
8bbd2ea7
...
...
@@ -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
);
}
...
...
Framework/API/test/ExpressionTest.h
View file @
8bbd2ea7
...
...
@@ -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
(
"--"
);
...
...
Framework/API/test/FileFinderTest.h
View file @
8bbd2ea7
...
...
@@ -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
),
""
);
...
...
Framework/API/test/MultipleFilePropertyTest.h
View file @
8bbd2ea7
...
...
@@ -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.
...
...
Framework/Algorithms/src/AbsorptionCorrection.cpp
View file @
8bbd2ea7
...
...
@@ -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)"
);
...
...
Framework/Algorithms/src/BinaryOperateMasks.cpp
View file @
8bbd2ea7
...
...
@@ -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
),
...
...
Framework/Algorithms/src/CalculateFlatBackground.cpp
View file @
8bbd2ea7
...
...
@@ -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 "
...
...
Framework/Algorithms/src/ConvertAxisByFormula.cpp
View file @
8bbd2ea7
...
...
@@ -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"
);
...
...
Framework/Algorithms/src/ConvertSpectrumAxis.cpp
View file @
8bbd2ea7
...
...
@@ -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 "
...
...
Framework/Algorithms/src/ConvertSpectrumAxis2.cpp
View file @
8bbd2ea7
...
...
@@ -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 "
...
...
Framework/Algorithms/src/ConvertUnits.cpp
View file @
8bbd2ea7
...
...
@@ -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)"
);
...
...
Framework/Algorithms/src/CopyLogs.cpp
View file @
8bbd2ea7
...
...
@@ -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
);
...
...
Framework/Algorithms/src/CorrectKiKf.cpp
View file @
8bbd2ea7
...
...
@@ -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)"
);
...
...
Framework/Algorithms/src/CorrectToFile.cpp
View file @
8bbd2ea7
...
...
@@ -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)"
);
...
...
Framework/Algorithms/src/CreateGroupingWorkspace.cpp
View file @
8bbd2ea7
...
...
@@ -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 "
...
...
Prev
1
2
3
4
5
…
10
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment