From 32715312a9f80f67bd83d85e91c5e8af241cb285 Mon Sep 17 00:00:00 2001 From: Edward Tremel Date: Thu, 1 Jul 2021 16:05:43 -0400 Subject: [PATCH] Fixed from_bytes for std::map to use from_bytes_noalloc correctly 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 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 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. --- include/derecho/mutils-serialization/SerializationSupport.hpp | 4 ++-- src/core/git_version.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/derecho/mutils-serialization/SerializationSupport.hpp b/include/derecho/mutils-serialization/SerializationSupport.hpp index 9f94de75..7c16b9b7 100644 --- a/include/derecho/mutils-serialization/SerializationSupport.hpp +++ b/include/derecho/mutils-serialization/SerializationSupport.hpp @@ -1050,9 +1050,9 @@ from_bytes(DeserializationManager* ctx, char const* buffer) { auto new_map = std::make_unique(); for(int i = 0; i < size; ++i) { - auto key = from_bytes_noalloc(ctx, buf_ptr, context_ptr{}); + auto key = from_bytes_noalloc(ctx, buf_ptr); buf_ptr += bytes_size(*key); - auto value = from_bytes_noalloc(ctx, buf_ptr, context_ptr{}); + auto value = from_bytes_noalloc(ctx, buf_ptr); buf_ptr += bytes_size(*value); new_map->emplace(*key, *value); } diff --git a/src/core/git_version.cpp b/src/core/git_version.cpp index ef143db0..0cc0ee72 100644 --- a/src/core/git_version.cpp +++ b/src/core/git_version.cpp @@ -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"; }