Skip to content

Commit

Permalink
Use assign for deserialize instead of temporary std::string (#241)
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Hyyppä <samuel.hyyppa@sandvik.com>
Co-authored-by: Samuel Hyyppä <samuel.hyyppa@sandvik.com>
  • Loading branch information
SamuelH91 and SamuelSandvik authored Dec 17, 2024
1 parent abf6c9a commit 5b8025b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/fastcdr/Cdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion include/fastcdr/FastCdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5b8025b

Please sign in to comment.