
Hopefully someone will correct me, but I don't think that shared_ptr can have a custom allocator to allocate the reference count in the shared memory.
If you want to store the reference count and the shared_ptr itself in the shared memory so that the shared_ptr is a shared_ptr between *processes*, I'm working on a boost::shmem::shared_ptr so that you can store a shared_ptr in shared memory (and construct containers of shared_ptr). The reference count would be allocated also in the same segment. Obviously, since in shared memory I have some problems(the deleter should be a template parameter, since we can't use virtual functions, we need a parameter to know from where to allocate the reference count, etc...) the interface will be a bit different. But you will need to wait a bit ;-) Regards, Ion