Simple refactor in read_argv

use argc to reserve space in the args vector
remove explicit constructor used in `push_back` vs `emplace_back`
This commit is contained in:
Andrei BENCSIK 2022-11-16 10:31:03 +02:00 committed by Steve Cotton
parent 22c304f336
commit 03a70c5a2d

View file

@ -86,8 +86,9 @@ std::vector<std::string> read_argv([[maybe_unused]] int argc, [[maybe_unused]] c
return win32_read_argv(flat_cmdline);
#else
std::vector<std::string> args;
args.reserve(argc);
for(int i = 0; i < argc; ++i) {
args.push_back(std::string(argv[i]));
args.emplace_back(argv[i]);
}
return args;
#endif