Ive played a little around with it, and now im trying to find ways to "break" it, ie obtaining the pointer from the ref.counting pointer and copying it without the ref being counted.
So far it surprised me that i could pass a managed pointer like this to a method that took a normal pointer.
I think it may have have defined a conversion from managed pointer to normal pointer. But what is to stop the method called from doing bad things(like copying the real pointer) now that it has the pointer?
EDIT: He defines the following conversions:
/** Conversion operators */ operator T* () const { return m_ptr; } operator const T* () const { return m_ptr; }
They seem a bit unsafe to me, sure it allows me to pass a managed pointer instead of a normal one, but then the pointer is lose, and just as unsafe as before, isnt it?
EDIT END <-
I was expecting to change methods like paint(GraphicsManager* gm) to paint(ManagedPointer gm).(i would probably make a typedef)
Well, ill give you a chance to have a better look at it, so we can find out exactly how useful it is.
Personally i understand templates and operator overloading well enough, but operator overloading confuses me a litle with regards to return values.
[edited by - ziphnor on March 19, 2002 10:08:36 AM]