
26 Feb
2009
26 Feb
'09
12:17 p.m.
I'm sorry if I'm a bit lame, but if you mean the boost::interprocess::unique_ptr; the deleter is not optional and if you mean std::unique_ptr... I can't find an implementation of it in boost. I don't know if it's supported in gcc yet... How am I to use it then?
unique_ptr offers exactly that set too, along with:
- possible to move pointers. - ability to use custom deleter if you want (I don't know if scoped_ptr offers that.. it is zero overhead if you don't use it).
The only reasons to use scoped_ptr over unique_ptr, once it is present, will be if you don't want to be able to move things around. Probably the nicest feature of unique_ptr of scoped_ptr is that it can be returned from functions.
Chris