Skip to content
Snippets Groups Projects
Commit c70748e1 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by Tom Fischer
Browse files

[BL] Use std::string::replace instead of substr +

This is more efficient.
parent 0f0f3b62
No related branches found
No related tags found
No related merge requests found
......@@ -111,9 +111,10 @@ bool substituteKeyword(std::string& result, std::string& parenthesized_string,
std::string const generated_fmt_string =
"{" + precision_specification +
type_specification[std::type_index(typeid(data))] + "}";
result = result.substr(0, begin) +
fmt::vformat(generated_fmt_string, fmt::make_format_args(data)) +
result.substr(end + 1, result.length() - (end + 1));
result.replace(
begin, end - begin + 1,
fmt::vformat(generated_fmt_string, fmt::make_format_args(data)));
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment