fix: optimization: PVS-Studio warning V831
Replaced 'at()' method with 'operator[]' to improve performance. The 'at()' method performs bounds checking, which can introduce overhead. Using 'operator[]' bypasses this check and can improve performance when you are certain that the index is within bounds. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
committed by
MihailRis
parent
97a0bb5776
commit
8c5e5559ec
@@ -7,7 +7,7 @@ std::string util::to_string(const std::vector<std::string>& vec) {
|
||||
std::stringstream ss;
|
||||
ss << "[";
|
||||
for (size_t i = 0; i < vec.size(); i++) {
|
||||
ss << util::quote(vec.at(i));
|
||||
ss << util::quote(vec[1]);
|
||||
if (i < vec.size()-1) {
|
||||
ss << ", ";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user