replace std::vector::push_back with emplace_back

This commit is contained in:
Bernd Amend 2021-05-22 13:16:44 +02:00
parent 964a36bdcd
commit 52a9fa47c1
2 changed files with 8 additions and 8 deletions

View File

@ -282,19 +282,19 @@ int main(int argc, char *argv[])
#endif
std::vector<std::string> usepaths;
usepaths.push_back("");
usepaths.emplace_back("");
if (usepath != nullptr)
{
usepaths.push_back(usepath);
usepaths.emplace_back(usepath);
}
std::vector<std::string> modulepaths;
std::vector<std::string> searchpaths = default_search_paths();
modulepaths.insert(modulepaths.end(), searchpaths.begin(), searchpaths.end());
modulepaths.push_back("");
modulepaths.emplace_back("");
if (modulepath != nullptr)
{
modulepaths.push_back(modulepath);
modulepaths.emplace_back(modulepath);
}
chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(),create_chaiscript_parser(),modulepaths,usepaths);

View File

@ -53,10 +53,10 @@ int main()
#endif
std::vector<std::string> usepaths;
usepaths.push_back("");
usepaths.emplace_back("");
if (usepath)
{
usepaths.push_back(usepath);
usepaths.emplace_back(usepath);
}
std::vector<std::string> modulepaths;
@ -64,10 +64,10 @@ int main()
#ifdef CHAISCRIPT_NO_DYNLOAD
chaiscript::ChaiScript chai(/* unused */modulepaths, usepaths);
#else
modulepaths.push_back("");
modulepaths.emplace_back("");
if (modulepath)
{
modulepaths.push_back(modulepath);
modulepaths.emplace_back(modulepath);
}
// For this test we are going to load the dynamic stdlib