#include #include #include #include #include int main () { using namespace boost::interprocess; typedef std::pair MyType; //A shared memory front-end that is able to construct //objects associated with a c-string managed_shared_memory segment( open_only, "MySharedMemory"); //Find the array and object std::pair res; res = segment.find ("MyType array"); std::size_t array_len = res.second; //Length should be 10 assert(array_len == 10); //Find the array and the object res = segment.find ("MyType instance"); std::size_t len = res.second; //Length should be 1 assert(len == 1); //Use data // . . . //We're done, delete array from memory segment.destroy("MyType array"); //We're done, delete object from memory segment.destroy("MyType instance"); return 0; } #include