
23 Dec
2008
23 Dec
'08
2:04 a.m.
Sid Sacek wrote:
1) When would I choose unique_ptr<> over auto_ptr<> ?
Always. auto_ptr is deprecated and is dangerous. unique_ptr, for example, perfectly works with containers.
2) When would I choose unique_ptr<> over scoped_ptr<> ?
Whenever you need the ability to move. You can choose to always use it instead of scoped_ptr, that's perfectly safe and doesn't add any overhead.