Reserve known vector size

Allocate the required memory at once.
This commit is contained in:
bad code
2024-09-22 16:43:36 +02:00
committed by Steffen
parent 124ff839f0
commit 46d160e91a

View File

@@ -694,7 +694,8 @@ namespace Config {
std::ifstream cread(conf_file);
if (cread.good()) {
vector<string> valid_names;
for (auto &n : descriptions)
valid_names.reserve(descriptions.size());
for (const auto &n : descriptions)
valid_names.push_back(n[0]);
if (string v_string; cread.peek() != '#' or (getline(cread, v_string, '\n') and not s_contains(v_string, Global::Version)))
write_new = true;