From 358acfe94442765f9cb4aed4aac6278fdf678ae3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 21 Oct 2019 01:37:04 -0400 Subject: [PATCH] Console: Use std::move within vreport() Avoids redundant copies when emplacing into the log container. --- hecl/lib/Console.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hecl/lib/Console.cpp b/hecl/lib/Console.cpp index af978911d..30bfeaa0e 100644 --- a/hecl/lib/Console.cpp +++ b/hecl/lib/Console.cpp @@ -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) { std::string tmp = fmt::vformat(fmt, args); std::vector lines = athena::utility::split(tmp, '\n'); - for (const std::string& line : lines) - m_log.emplace_back(line, level); + for (std::string& line : lines) { + m_log.emplace_back(std::move(line), level); + } fmt::print(fmt("{}\n"), tmp); }