According to guide on Boost docs
It is possible to create named vectors of some type (for instance double)
using namespace boost::interprocess;
typedef allocator<int, managed_shared_memory::segment_manager> ShmemAllocator;
managed_shared_memory segment(create_only, "MySharedMemory", 65536);
//Initialize shared memory STL-compatible allocator
const ShmemAllocator alloc_inst (segment.get_segment_manager());
//Construct a vector named "values_A" in shared memory with argument alloc_inst
MyVector *vA= segment.construct<MyVector>("values_A")(alloc_inst);
MyVector *vB= segment.construct<MyVector>("values_B")(alloc_inst);
for(int i = 0; i < 100; ++i) //Insert data in the vector
vA->push_back(i);
And then if client process knows the names of shared objects ("values_A" and "values_B") it is easy to access them.
managed_shared_memory segment(open_only, "MySharedMemory");
MyVector *vA_client = segment.find<MyVector>("values_A").first;
MyVector *vB_client = segment.find<MyVector>("values_B").first;
//Use vector in reverse order
std::sort(vA_client->rbegin(), vA_client->rend());
But if client doesn't know the names of those objects?
How to get list of those objects? {"values_A" , "values_B"}.
If there was some objects of other type ("MyVector2") registered (named "intA", "intB") - How would you filter only those, whose type is MyVector?
I have a suspicion that it has to do with method named_begin and named_end but I don't know how to use it.
Thank You for your help :)