$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] Boost Interprocess Question
From: Brian (piptdog_at_[hidden])
Date: 2011-10-06 20:15:05
Hello
For simplicity, say I have this:
class Animal
{
int id;
};
class Dog : public Animal
{
int tag;
};
class Cat : public Animal
{
int lives;
};
offset_ptr<Dog> a = segment.construct<Dog>(anonymous_instance)();
offset_ptr<Animal> b;
b = a;
Also assume I have a correctly setup managed_shared_memory called segment.
Is there anyway I can delete the constructed object using b? I tried segment.destroy_ptr(b.get()) and segment.deallocate(b.get()) but I get assertion failures. Obviously segment.destroy_ptr(a.get()) would work but I'd like to be able to do it with a pointer to the parent class. Also casting won't work because I won't know if it's a dog or a cat when I delete it.
Thanks for any suggestions!