Closed MitraDarja closed 3 years ago
Hi.
See last several lines of file robin_hood.h
. There are these aliases:
template <typename Key, typename T, typename Hash = hash<Key>,
typename KeyEqual = std::equal_to<Key>, size_t MaxLoadFactor100 = 80>
using unordered_flat_map = detail::Table<true, MaxLoadFactor100, Key, T, Hash, KeyEqual>;
template <typename Key, typename T, typename Hash = hash<Key>,
typename KeyEqual = std::equal_to<Key>, size_t MaxLoadFactor100 = 80>
using unordered_node_map = detail::Table<false, MaxLoadFactor100, Key, T, Hash, KeyEqual>;
You have to write serialization functions for these containers, something like this:
template <typename Archive, typename Key, typename T, typename Hash, typename KeyEqual, size_t MaxLoadFactor100>
void serialize
(
Archive& archive,
robin_hood::unordered_flat_map<Key, T, Hash, KeyEqual, MaxLoadFactor100>& map
{
// ...
}
Similar is for other containers.
You can use separate save
and load
functions. See documentation at https://uscilab.github.io/cereal/serialization_functions.html
P.S. I have never used cereal
serialization library but I think that in this case separate save
and load
functions must be defined. My intuition tells me that this problem cannot be solved by single serialize
function.
Ah okay, I got confused reading robin_hood.h. Thanks for the help! :D
Hi,
is there a way to use robin_hood::unordered_map with cereal?
I used the example from this website (https://reposhub.com/cpp/serialization/USCiLab-cereal.html) for a really simple cereal example with std::unordered_map and exchanged std::unordered_map with robin_hood::unordered_map, but run in a static assertion.
Any help or hint, how to make this work, would be highly appreciated. Thanks. :)