avoid excess string copy in auto loops

This commit is contained in:
Axel Kohlmeyer
2022-09-01 16:02:32 -04:00
parent e0e4be1872
commit 7bba3c516f
10 changed files with 13 additions and 13 deletions

View File

@ -678,7 +678,7 @@ void FixAveTime::invoke_scalar(bigint ntimestep)
if (!yaml_header || overwrite) {
yaml_header = true;
fputs("keywords: ['Step', ", fp);
for (auto k : keyword) fmt::print(fp, "'{}', ", k);
for (const auto &k : keyword) fmt::print(fp, "'{}', ", k);
fputs("]\ndata:\n", fp);
}
fmt::print(fp, " - [{}, ", ntimestep);
@ -900,7 +900,7 @@ void FixAveTime::invoke_vector(bigint ntimestep)
if (!yaml_header || overwrite) {
yaml_header = true;
fputs("keywords: [", fp);
for (auto k : keyword) fmt::print(fp, "'{}', ", k);
for (const auto &k : keyword) fmt::print(fp, "'{}', ", k);
fputs("]\ndata:\n", fp);
}
fmt::print(fp, " {}:\n", ntimestep);