#include #include #include #include int main () { using namespace boost::interprocess; //Shared memory front-end that is able to construct objects //associated with a c-string //Open the memory segment at the specified address and initialize resources fixed_managed_shared_memory segment (open_only, "MySharedMemory", //segment name (void*)0x03000000); //mapping address //Alias an STL compatible allocator of ints that allocates ints from the segment //and that defines allocator::pointer as "int *". This allocator will be compatible //with most STL implementations. typedef allocator ShmemAllocator; //Alias a vector that uses the previous STL-like allocator typedef std::vector MyVector; //Find the vector using the c-string name MyVector *myvector = segment.find("MyVector").first; //Use vector as you want std::sort(myvector->rbegin(), myvector->rend()); // . . . //When done, destroy and delete vector segment.destroy("MyVector"); return 0; } #include