This is an example of how to use a multi-level STL container with Metall.
#include <iostream>
#include <functional>
#include <boost/container/scoped_allocator.hpp>
#include <boost/container/vector.hpp>
#include <boost/unordered_map.hpp>
using vector_type = vector<char, metall::manager::allocator_type<char>>;
uint64_t, vector_type, std::hash<uint64_t>, std::equal_to<uint64_t>,
using map_type =
unordered_map<unsigned int, multimap_type, std::hash<unsigned int>,
std::equal_to<unsigned int>, map_allocator_type>;
{
map_type* pmap =
vector_type vec1(
manager.get_allocator());
vec1.push_back('a');
(*pmap)[30].emplace(20, vec1);
manager.snapshot(
"/tmp/datastore_snapshot");
}
{
map_type* pmap =
manager.find<map_type>(
"map").first;
auto& mmap = (*pmap)[30];
auto& vec = mmap.find(20)->second;
std::cout << vec[0] << std::endl;
}
return 0;
}
int main()
Definition: jgraph.cpp:24