
On Wednesday 30 July 2008 16:03 pm, Alexander Gutenev wrote:
I want to use intrusive_ptr as a smart pointer to have reference counting without shared_ptr overhead.
I'm curious, could you be more specific about how your implementation has less overhead than shared_ptr? Do you mean it uses less memory? Compiles faster? Runs faster?
There's several ways to allocate reference counter: 1. In separate object allocated separately - this is shared_ptr 2. In the same buffer with object but not as a part of object - this is shifted_ptr 3. In the pointed object as a part of object - this is intrusive_ptr the way i'm trying to use it. The posted code is an implementation of what goes to the object. It actually not even necessary for a shared pointer to use an integer reference counting.