$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2006-11-29 10:51:38
On Nov 29, 2006, at 10:33 AM, Richard Hadsell wrote:
> David Klein wrote:
>
>> so are there any objections about adding this feature to scoped_ptr?
>>
>>
> I'm sure I have seen this discussion before.  I believe the issue was
> the size of scoped_ptr itself.  It is supposed to be a lightweight
> object, no bigger than the pointer it holds.  Any added overhead is
> unacceptable.  If you can implement the feature without adding any  
> data
> members, fine.  Otherwise, please create a new class.
<nod> This comes up now and then.
Fwiw, anyone/everyone is welcome to my emulation of the proposed C+ 
+0X unique_ptr:
http://home.twcny.rr.com/hinnant/cpp_extensions/unique_ptr_03.html
Sorry, it isn't documented.  Here's the best documentation I  
currently have:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/ 
n1856.html#Addition%20-%20Class%20template%20unqiue_ptr
The (non)copyright at the top means you can do whatever you want with  
the code, including stripping my name out of it.
In a nutshell:
*  It has a deleter.
*  If the deleter is an empty class, sizeof(unique_ptr<T, D>) ==  
sizeof(T*).
*  It has unique ownership semantics like auto_ptr/scoped_ptr.
*  It does not transfer ownership with copy syntax (modulo a bug  
mentioned in the source code).
*  It has cute syntax to safely handle arrays: unique_ptr<T[]>.
*  You can also customize the storage type (defaults to T*) by giving  
your deleter an optional D::pointer type.
*  The deleter can be a reference to a deleter.  The sizeof the  
unique_ptr swells by a word when you do this, but it does come in  
handy when you want to reference some other deleter instead of copy  
it in to the unique_ptr.
*  The deleter can be a function pointer.  sizeof swells here too.
*  It has been proposed for standardization.
-Howard