Commit e9398439 authored by Dominik Charousset's avatar Dominik Charousset

Merge branch 'issue/786'

parents e3591562 830cea36
......@@ -285,6 +285,7 @@ public:
template <class T>
error fill_range(T& xs, size_t num_elements) {
xs.clear();
auto insert_iter = std::inserter(xs, xs.end());
for (size_t i = 0; i < num_elements; ++i) {
typename std::remove_const<typename T::value_type>::type x;
......@@ -299,6 +300,7 @@ public:
/// Loads elements from type `U` before inserting to `xs`.
template <class U, class T>
error fill_range_c(T& xs, size_t num_elements) {
xs.clear();
auto insert_iter = std::inserter(xs, xs.end());
for (size_t i = 0; i < num_elements; ++i) {
U x;
......
......@@ -475,6 +475,15 @@ CAF_TEST(long_sequences) {
CAF_CHECK_EQUAL(n, m);
}
CAF_TEST(non-empty vector) {
CAF_MESSAGE("deserializing into a non-empty vector overrides any content");
std::vector<int> foo{1, 2, 3};
std::vector<int> bar{0};
auto buf = serialize(foo);
deserialize(buf, bar);
CAF_CHECK_EQUAL(foo, bar);
}
// -- our vector<bool> serialization packs into an uint64_t. Hence, the
// critical sizes to test are 0, 1, 63, 64, and 65.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment