Skip to content

Commit 3afaa72

Browse files
committed
Fix the reserve call and add another reserve call
1 parent 6ab4b74 commit 3afaa72

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/msgpack23/msgpack23.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ namespace msgpack23 {
151151

152152
template<std::integral T>
153153
void emplace_combined(FormatConstants const &constant, T const &value) {
154-
data_.reserve(1 + sizeof(T));
154+
data_.reserve(data_.size() + 1 + sizeof(T));
155155
emplace_constant(constant);
156156
emplace_integral<T>(value);
157157
}
@@ -245,6 +245,7 @@ namespace msgpack23 {
245245
throw std::length_error("Variant is too long to be serialized.");
246246
}
247247
emplace_integral(index);
248+
data_.resize(data.size() + data.size());
248249
data_.insert(data_.end(), data.begin(), data.end());
249250
}
250251

0 commit comments

Comments
 (0)