
Rene Rivera wrote:
I think we all have to keep in mind the scope of this utility. It not meant to solve all the pointer uses.
I understand your concern, still, in my eyes COW is just another application of the handle/body pattern and thus not /that/ far away from the scope of this submission.
There's another utility that people keep asking for, the traits pointer.
Whether a single policy-based can-do-whatever-pointer is really what we want is a different story.
It seems like you assume that two pimpl_ptr instances can hold the same pointer. This is _not_ the case.
Why not?
From my experience, you don't because at that point you would use some other kind of pointer. Most likely a reference counted pointer that can travel across DLL boundaries.
<cite> However, it's implementation can be tricky, and with many pitfalls (especially regarding memory management). </cite> template<typename T> void dispose_func(void* ptr) { delete static_cast<T*>(ptr); } // use void(*)(void*) to this thing for freeing the shared context // and the instance Regards, Tobias