#include #include #include #include using namespace boost::interprocess; class Foo { public: Foo() { m_shm = new managed_shared_memory( open_or_create, "/testSM", 4096000 ); const ShmAlloc allocator( m_shm->get_segment_manager() ); m_connections = m_shm->find_or_construct(unique_instance)(std::less(), allocator); delete m_shm; } private: typedef boost::interprocess::pair MyPair; typedef boost::interprocess::allocator ShmAlloc; typedef boost::interprocess::map, ShmAlloc> ShmMap; boost::interprocess::offset_ptr m_connections; boost::interprocess::managed_shared_memory* m_shm; }; int main( void ) { Foo(); return(0); }