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; }