我正在尝试使用sparsepp对类型spp::sparse_hash_map
的{{3}} spp::sparse_hash_map<const std::vector<uint32_t>, uint32_t>
进行序列化和反序列化。
有关为什么我使用const
键cereal的相关问题。
但是,以下代码的编译失败:
spp::sparse_hash_map<const std::vector<uint32_t>, uint32_t> my_map;
std::ifstream file(path, std::ios::binary);
cereal::BinaryInputArchive input(file);
input(my_map);
当我从键类型中删除const时,它会编译:
spp::sparse_hash_map<std::vector<uint32_t>, uint32_t> my_map;
std::ifstream file(path, std::ios::binary);
cereal::BinaryInputArchive input(file);
input(my_map);
编译器的输出:
error: no matching function for call to ‘cereal::BinaryInputArchive::processImpl(const std::vector<unsigned int>&)’
编译器:clang版本6.0.0-1ubuntu2(标签/ RELEASE_600 / final)
有没有一种方法可以使用谷物将这种类型反义化?我想念什么?