From 33dce6dfb60970f613f1d8c7daac54f86f902071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Hyypp=C3=A4?= Date: Thu, 10 Oct 2024 15:19:18 +0300 Subject: [PATCH] Use assign for deserialize instead of temporary std::string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Samuel Hyyppä --- include/fastcdr/Cdr.h | 2 +- include/fastcdr/FastCdr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fastcdr/Cdr.h b/include/fastcdr/Cdr.h index c3754ca8..126bf2b9 100644 --- a/include/fastcdr/Cdr.h +++ b/include/fastcdr/Cdr.h @@ -1793,7 +1793,7 @@ class Cdr { uint32_t length = 0; const char* str = read_string(length); - value = std::string(str, length); + value.assign(str, length); return *this; } diff --git a/include/fastcdr/FastCdr.h b/include/fastcdr/FastCdr.h index 1a26b9c7..4cce3920 100644 --- a/include/fastcdr/FastCdr.h +++ b/include/fastcdr/FastCdr.h @@ -1552,7 +1552,7 @@ class Cdr_DllAPI FastCdr { uint32_t length = 0; const char* str = read_string(length); - string_t = std::string(str, length); + string_t.assign(str, length); return *this; }