M
Markus Dehmann
The main difference between std::auto_ptr and boost::shared_ptr is that
auto_ptr has the transfer-of-ownership semantic. That makes it impossible
to store auto_ptrs in STL containers because the containers use the copy
constructor when you store or get an element.
So, is it recommended to use shared_ptr instead? Are there any
disadvantages of shared_ptr? Is shared_ptr slower maybe?
It seems for shared_ptr you only need the boost headers, not the libraries.
Is that true?
Thanks!
auto_ptr has the transfer-of-ownership semantic. That makes it impossible
to store auto_ptrs in STL containers because the containers use the copy
constructor when you store or get an element.
So, is it recommended to use shared_ptr instead? Are there any
disadvantages of shared_ptr? Is shared_ptr slower maybe?
It seems for shared_ptr you only need the boost headers, not the libraries.
Is that true?
Thanks!