fix: optimization: PVS-Studio warning V823

Replaced 'push_back' with 'emplace_back' for better performance in containers.

Reported by: PVS-Studio

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-03 17:44:51 +03:00
committed by MihailRis
parent 35ef339b0c
commit a20ffee7cb
2 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -214,7 +214,7 @@ std::vector<std::string> ResPaths::listdirRaw(const std::string& folderName) con
continue;
for (const auto& entry : fs::directory_iterator(folder)) {
auto name = entry.path().filename().u8string();
entries.push_back(root.name+":"+folderName+"/"+name);
entries.emplace_back(root.name+":"+folderName+"/"+name);
}
}
{
@@ -223,7 +223,7 @@ std::vector<std::string> ResPaths::listdirRaw(const std::string& folderName) con
return entries;
for (const auto& entry : fs::directory_iterator(folder)) {
auto name = entry.path().filename().u8string();
entries.push_back("core:"+folderName+"/"+name);
entries.emplace_back("core:"+folderName+"/"+name);
}
}
return entries;