17 Jan
2006
17 Jan
'06
2:38 p.m.
Pierre THIERRY wrote:
Le Mon, 16 Jan 2006 20:16:14 -0500, me22 a écrit :
There's always "shared_ptr<Foo> ptr_foo( new Foo );", which is less typing than either anyways.
But only possible at the construction. In any other place, you have to use reset. And the problem is, I have to modify deeply my code to use shared_ptr, and change it back if I stop using them.
With the operator=(T*), it would need no more than a modified typedef for the entire code to switch to or from shared_ptr (or from any other type of pointer that supports this operator).
Just replacing shared_ptr<T> with T* seems to require much more than just a typedef. If the goal is to replace boost::shared_ptr<T> with foo::shared_ptr<T>, you might look into traits. -Thorsten