wrapper around API using reference counting logic C++
<p>I am going to use heavily some C-API in my C++ application, I have a lot of functions available that I need to call in couple. For example createFoo(void*) at the beginning and freeFoo(void*) when the job is done. </p>

<p>So, I thought to use the RAII idiom, so I created the first wrapper with copy constructor and assignment operator private and not implemented. It works fine, however I would like a richer copy semantic. I would like to use a reference counting copy semantic. I have considered to write my own version but I don't want reinvent the wheel. Also the boost::shared_ptr is already implementing pretty much the behave that I want to achieve.</p>

<p>The only difference is the pointer is not create with new and it is not release with delete. I would like to customize the source and the sink functions.</p>

<p>I have the feeling that is a good way to face the problem, however I cannot come up with a class that implement my idea.</p>

<p>Here are the questions, do you think it is a good way to solve my problem? Is there any open source code that implement something similar? Do you have any hints?</p>

<p>Thanks</p>
