Skip to content

Commit

Permalink
clear vec before push
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Sep 25, 2023
1 parent 1f6d7f9 commit 44ad3a1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/cybozu/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ void load(Container<T, Alloc>& x, InputStream& is)
{
size_t size;
load(size, is);
x.clear();
serializer_local::reserve_if_exists(x, size);
for (size_t i = 0; i < size; i++) {
x.push_back(T());
Expand Down

0 comments on commit 44ad3a1

Please sign in to comment.