Boost logo

Boost :

Subject: Re: [boost] [unique_ptr] So how is it used differently?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-12-22 21:04:39


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk