From f41d989bf07b5bc2f6a1c127eb07c5f77895e7f8 Mon Sep 17 00:00:00 2001 From: gabime Date: Tue, 2 Dec 2014 02:15:42 +0200 Subject: [PATCH] fix in move log_msg --- include/spdlog/details/log_msg.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h index b9038cda..30ff129b 100644 --- a/include/spdlog/details/log_msg.h +++ b/include/spdlog/details/log_msg.h @@ -48,9 +48,7 @@ struct log_msg level(other.level), time(other.time), tm_time(other.tm_time) - - { - //fmt::MemoryWriter does not allow copy ctor} + { raw.write(other.raw.data(), other.raw.size()); formatted.write(other.formatted.data(), other.formatted.size()); } @@ -63,6 +61,7 @@ struct log_msg raw(std::move(other.raw)), formatted(std::move(other.formatted)) { + other.clear(); } log_msg& operator=(log_msg&& other) @@ -76,6 +75,7 @@ struct log_msg tm_time = other.tm_time; raw = std::move(other.raw); formatted = std::move(other.formatted); + other.clear(); return *this; } @@ -83,6 +83,7 @@ struct log_msg void clear() { + level = level::OFF; raw.clear(); formatted.clear(); }