I feel like I'm missing something simple.
I have multiple processes that are going to use an object in shared memory.
The find_or_construct() method lets these processes get a pointer to the
object without worrying about startup order.
What about the opposite?
When a process is done with the object
in shared memory it can't destroy it because the other processes may be
using it. Is there a destroy_or_not() method that would only destroy the
object when everyone is done with it?
Normally I would solve this with a smart
pointer like shared_ptr, but I think I'm miss understanding smart_ptr and
I can't get it to work right. It seems like the shared_ptr is created in
shared memory and needs to be explicitly destroyed, which would bring me
back to the original problem, of who actually gets to destroy it.
Should I be looking at intrusive_ptr?
---
Aaron Wright