#include typedef boost::interprocess::managed_shared_memory msm_t; class Abcd { }; class Dummy { public: Dummy(Abcd& abcd); }; Dummy* test() { msm_t msm(boost::interprocess::open_or_create,"segname",1024); const char* abcd = "test"; Abcd x; Dummy* d=msm.find_or_construct(abcd)(x); return d; }