Skip to content

Commit

Permalink
Fixed from_bytes for std::map to use from_bytes_noalloc correctly
Browse files Browse the repository at this point in the history
The compile error identified in issue #203 turned out to originate in
SerializationSupport.hpp's implementation of from_bytes for maps: It
called the from_bytes_noalloc function with three parameters, even
though the third parameter always has a default value and doesn't need
to be specified. Since it explicitly used a context_ptr<value_t> as the
third parameter, this meant the compiler couldn't match the "const"
version of the fron_bytes_noalloc function, which has a
context_ptr<const T> as the third parameter, even though buf_ptr is a
const char*. Removing the context_ptr parameter entirely allowed the
compiler to select the correct from_bytes_noalloc version.

This closes #203.
  • Loading branch information
etremel committed Jul 1, 2021
1 parent fa399dd commit 3271531
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/derecho/mutils-serialization/SerializationSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,9 +1050,9 @@ from_bytes(DeserializationManager* ctx, char const* buffer) {

auto new_map = std::make_unique<T>();
for(int i = 0; i < size; ++i) {
auto key = from_bytes_noalloc<key_t>(ctx, buf_ptr, context_ptr<key_t>{});
auto key = from_bytes_noalloc<key_t>(ctx, buf_ptr);
buf_ptr += bytes_size(*key);
auto value = from_bytes_noalloc<value_t>(ctx, buf_ptr, context_ptr<value_t>{});
auto value = from_bytes_noalloc<value_t>(ctx, buf_ptr);
buf_ptr += bytes_size(*value);
new_map->emplace(*key, *value);
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/git_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace derecho {
const int MAJOR_VERSION = 2;
const int MINOR_VERSION = 1;
const int PATCH_VERSION = 0;
const int COMMITS_AHEAD_OF_VERSION = 131;
const int COMMITS_AHEAD_OF_VERSION = 132;
const char* VERSION_STRING = "2.1.0";
const char* VERSION_STRING_PLUS_COMMITS = "2.1.0+131";
const char* VERSION_STRING_PLUS_COMMITS = "2.1.0+132";

}

0 comments on commit 3271531

Please sign in to comment.