From cbfad751c824dcb3edce6527fc409f75884127b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Wed, 13 Dec 2023 16:29:46 +0100 Subject: [PATCH] Remove some unnecessary temporary std::string allocation Automatically detected by clang-tidy using performance-inefficient-string-concatenation check. Several of the detected cases are left unattended, because the syntax is more elegant as it is, and they are not performance-critical. --- src/ModelTree.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ModelTree.cc b/src/ModelTree.cc index bcd7de8b..41bed024 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -1169,7 +1169,7 @@ ModelTree::fixNestedParenthesis(ostringstream& output, map& tmp_ if (auto it = tmp_paren_vars.find(val); it == tmp_paren_vars.end()) { varname = "paren32_tmp_var_" + to_string(i1++); - repstr = repstr + varname + " = " + val + ";\n"; + repstr += varname + " = " + val + ";\n"; tmp_paren_vars[val] = varname; } else @@ -1182,7 +1182,7 @@ ModelTree::fixNestedParenthesis(ostringstream& output, map& tmp_ if (auto it = tmp_paren_vars.find(str1); it == tmp_paren_vars.end()) { varname = "paren32_tmp_var_" + to_string(i1++); - repstr = repstr + varname + " = " + str1 + ";\n"; + repstr += varname + " = " + str1 + ";\n"; } else varname = it->second;