// // Created by ps on 8/9/18. // #include "ShareMemoryTool.hpp" int main() { // char cc = '1'; // for (int i = 0; i < 100; i++) { // cc++; // printf("%c \n", cc); // } try { // BISTL::shared_memory_object // init // BISTL::managed_shared_memory segment(BISTL::open_only, "aaa8" ); BISTL::BiMapFeaData biMapFeaData("test"); // const BISTL::void_allocator alloc_inst (segment.get_segment_manager()); // BISTL::bi_map_Feature_Info * mymap = // segment.construct("MyMap")(std::less(),alloc_inst); // BISTL::bi_map_Feature_Info *mymap = // segment.find_or_construct("aaa8")(std::less(), alloc_inst); auto mymap = biMapFeaData.getMap(); auto size = mymap->size(); for (auto it = mymap->begin(); it != mymap->end(); it++) { // printf("%s \n", it->second.id.c_str()); // printf("%d \n", it->second.id); std::cout << "id " << it->second.m_id << std::endl; std::cout << "feature " << it->second.m_feature << std::endl; // it->second.id; } printf("\n"); // BISTL::shared_memory_object::remove("SharedMemory"); } catch (const std::exception &e) { printf("Exception:%s\n", e.what()); BISTL::shared_memory_object::remove("test"); } getchar(); BISTL::shared_memory_object::remove("test"); return 0; }