
12 Jul
2008
12 Jul
'08
10:42 p.m.
On Jul 12, 2008, at 6:32 PM, Loïc Joly wrote:
Sid Sacek a écrit :
Isn't the 'unique_ptr<>' a replacement for the standard C++ auto_ptr<> that's going to be deprecated in the next standard?
It is both a replacement for std::auto_ptr & for boost::scoped_ptr : - It has single ownership, like scoped_ptr - It can transfert its ownership, like auto_ptr (but does so by move semantic, not by a a copy with a strange semantic). - It also has custom deleter semantic
And scoped_array functionality: unique_ptr<char[]> p(new char[3]); p[0] = 'a'; :-) Example implementation: http://home.twcny.rr.com/hinnant/cpp_extensions/unique_ptr.html -Howard