Boost logo

Boost Users :

From: Pierre THIERRY (nowhere.man_at_[hidden])
Date: 2006-01-16 18:53:37


I use more and more BOOST smart pointers instead of plain pointers in my
C++ code, and it is incredible how it saves time and prevent bugs!

But I was wondering why one couldn't just change the type of a pointer a
keep all code as it is, instead of having to change affectation to
reset(), for example.

E.g., the following code:

Foo* ptr_foo;
ptr_foo = new Foo;

Has now to be changed to:

shared_ptr<Foo> ptr_foo;
ptr_foo.reset(new Foo);

But I'd like it to be:

shared_ptr<Foo> ptr_foo;
ptr_foo = new Foo;

Is there a problem to have shared_ptr<T>::operator=(T*)?

Curiously,
Nowhere man

-- 
nowhere.man_at_[hidden]
OpenPGP 0xD9D50D8A

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net