Console: Use std::move within vreport()

Avoids redundant copies when emplacing into the log container.
This commit is contained in:
Lioncash 2019-10-21 01:37:04 -04:00
parent c8eab43489
commit 358acfe944
1 changed files with 3 additions and 2 deletions

View File

@ -177,8 +177,9 @@ bool Console::commandExists(std::string_view cmd) const {
void Console::vreport(Level level, fmt::string_view fmt, fmt::format_args args) { void Console::vreport(Level level, fmt::string_view fmt, fmt::format_args args) {
std::string tmp = fmt::vformat(fmt, args); std::string tmp = fmt::vformat(fmt, args);
std::vector<std::string> lines = athena::utility::split(tmp, '\n'); std::vector<std::string> lines = athena::utility::split(tmp, '\n');
for (const std::string& line : lines) for (std::string& line : lines) {
m_log.emplace_back(line, level); m_log.emplace_back(std::move(line), level);
}
fmt::print(fmt("{}\n"), tmp); fmt::print(fmt("{}\n"), tmp);
} }