我正在尝试使用 grain 序列化和反序列化sparsepp spp::sparse_hash_map
类型。spp::sparse_hash_map<const std::vector<uint32_t>, uint32_t>
请参阅有关我为什么在此处const
使用密钥的相关问题。
但是,以下代码的编译失败:
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 (tags/RELEASE_600/final)
有没有办法使用谷物来消除这种类型?我错过了什么?