isn't this a special case of a smart pointer? Microsoft's COM/DCOM/ATL implementation (ATL::CComPtr<T>) comes to mind. If you are un-familiar with this class it simple a smart pointer that does reference counting and executes the conained destructor when the reference count goes to zero. I'm not sure what you mean by "number of shares for read-only" though.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the context of copy on write was what the reference count meant. This is not wholly related to Smart Pointers. See Smart Pointer, Bridge, GoF, std::string, etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We need a class that contains a class that reference counts the number of shares for read-only.
isn't this a special case of a smart pointer? Microsoft's COM/DCOM/ATL implementation (ATL::CComPtr<T>) comes to mind. If you are un-familiar with this class it simple a smart pointer that does reference counting and executes the conained destructor when the reference count goes to zero. I'm not sure what you mean by "number of shares for read-only" though.
In the context of copy on write was what the reference count meant. This is not wholly related to Smart Pointers. See Smart Pointer, Bridge, GoF, std::string, etc.
This might be of some use:
http://sourceforge.net/snippet/detail.php?type=snippet&id=100260
I'm not as concerned about the implementation specifics as to whether it has a place in the core, or it is a framework construct.
BTW: The snippet you noted is not multi-thread safe.