#include #include #include using boost::interprocess::offset_ptr; /* * Note: this example does not necessarily need to make * much sense. It is meant only to show the problem, * the reasons why this is needed would be a bit * long to explain, but they have to do with virtuality * being forbidden in shared memory. */ struct B {}; struct D : public B {}; struct Deleter { typedef offset_ptr pointer; // e.g. requirement of boost::interprocess::shared_ptr void operator() (offset_ptr p) { // Destroy via custom allocator. } }; int main() { boost::movelib::unique_ptr ptr (new D); offset_ptr d = ptr.get(); // <- fails to compile }