use emplace_back() instead of push_back()
This commit is contained in:
@ -637,7 +637,7 @@ int FixBocs::read_F_table( char *filename, int p_basis_type )
|
||||
char line[MAX_F_TABLE_LINE_LENGTH];
|
||||
std::vector<std::string> inputLines;
|
||||
while (fgets(line, MAX_F_TABLE_LINE_LENGTH, fpi)) {
|
||||
inputLines.push_back(std::string(line));
|
||||
inputLines.emplace_back(line);
|
||||
}
|
||||
fclose(fpi);
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ void PairMEAM::coeff(int narg, char **arg)
|
||||
"'maxelt' in meam.h and recompile.", maxelt);
|
||||
|
||||
for (int i = 0; i < nlibelements; i++) {
|
||||
libelements.push_back(arg[i+3]);
|
||||
libelements.emplace_back(arg[i+3]);
|
||||
mass.push_back(0.0);
|
||||
}
|
||||
|
||||
|
||||
@ -432,7 +432,7 @@ void PairRANN::read_atom_types(std::vector<std::string> line,char *filename,int
|
||||
int nwords = line.size();
|
||||
if (nwords < 1) error->one(filename,linenum,"Incorrect syntax for atom types");
|
||||
nelements = nwords;
|
||||
line.push_back("all");
|
||||
line.emplace_back("all");
|
||||
allocate(line);
|
||||
}
|
||||
|
||||
|
||||
@ -563,24 +563,24 @@ static void init_commands()
|
||||
// store internal commands
|
||||
int ncmds = sizeof(cmdlist) / sizeof(const char *);
|
||||
for (int i = 0; i < ncmds; ++i)
|
||||
commands.push_back(cmdlist[i]);
|
||||
commands.emplace_back(cmdlist[i]);
|
||||
|
||||
// store optional commands from command styles
|
||||
ncmds = lammps_style_count(lmp, "command");
|
||||
for (int i = 0; i < ncmds; ++i) {
|
||||
if (lammps_style_name(lmp, "command", i, buf, BUFLEN)) commands.push_back(buf);
|
||||
if (lammps_style_name(lmp, "command", i, buf, BUFLEN)) commands.emplace_back(buf);
|
||||
}
|
||||
|
||||
// store LAMMPS shell specific command names
|
||||
commands.push_back("help");
|
||||
commands.push_back("exit");
|
||||
commands.push_back("pwd");
|
||||
commands.push_back("cd");
|
||||
commands.push_back("mem");
|
||||
commands.push_back("source");
|
||||
commands.push_back("history");
|
||||
commands.push_back("clear_history");
|
||||
commands.push_back("save_history");
|
||||
commands.emplace_back("help");
|
||||
commands.emplace_back("exit");
|
||||
commands.emplace_back("pwd");
|
||||
commands.emplace_back("cd");
|
||||
commands.emplace_back("mem");
|
||||
commands.emplace_back("source");
|
||||
commands.emplace_back("history");
|
||||
commands.emplace_back("clear_history");
|
||||
commands.emplace_back("save_history");
|
||||
|
||||
// set name so there can be specific entries in ~/.inputrc
|
||||
rl_readline_name = "lammps-shell";
|
||||
|
||||
@ -86,7 +86,7 @@ void TestConfigReader::prerequisites(const yaml_event_t &event)
|
||||
while (1) {
|
||||
data >> key >> value;
|
||||
if (data.eof()) break;
|
||||
config.prerequisites.push_back(std::make_pair(key, value));
|
||||
config.prerequisites.emplace_back(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ void TestConfigReader::extract(const yaml_event_t &event)
|
||||
while (1) {
|
||||
data >> name >> value;
|
||||
if (data.eof()) break;
|
||||
config.extract.push_back(make_pair(name, value));
|
||||
config.extract.emplace_back(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1252,7 +1252,7 @@ TEST(PairStyle, single)
|
||||
int argc = sizeof(args) / sizeof(char *);
|
||||
|
||||
// need to add this dependency
|
||||
test_config.prerequisites.push_back(std::make_pair("atom", "full"));
|
||||
test_config.prerequisites.emplace_back("atom", "full");
|
||||
|
||||
// create a LAMMPS instance with standard settings to detect the number of atom types
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
|
||||
Reference in New Issue
Block a user