Que*_*ueg 5 c++ boost shared-memory boost-interprocess
假设我有课Base和Derived : public Base.我使用boost :: interprocess库构建了一个共享内存段.是否可以使用与此类似的代码:
Base* b = new Derived();
write(b); //one app writes
Base* b2 = read(b); //second app reads
//b equals b2 (bitwise, not the ptr location)
Run Code Online (Sandbox Code Playgroud)
我在这里看到的问题是,例如,派生的Base类所需的空间是未知的(因此要分配多少shmem?)
问:如何通过应用程序之间的指针传递对象?