|
Boost : |
From: Lee Brown (lee_at_[hidden])
Date: 2002-01-26 19:45:54
On Saturday 26 January 2002 11:34, you wrote:
Thanks Andrei, for taking the time.
> 1. Class pointer_base is inherited from but doesn't protect against
> wrongful deletion.
Yeah. That was bad. Like I said, off the top of my head :-(
> 2. copy_ptr is as susceptible to be wrongful to be useless. It silently
> slices polymorphic objects.
Mmm. Kind of. The copy and the original share the same creation policy,
therefore the same pointee. I believe slicing is only a problem when the user
has preallocated the memory and then gives a pointer to the constructor.
get() retturning pointer_type& was a problem. It should be pointer_type.
I believe slicing comes when you have:
smart_ptr<Base> b = new Derived; //derived is preallocated,
this particular version has:
smart_ptr<Base> b; /// b allocates itself
Perhaps this is lame. But look ma, no clone().
I suppose one could make a clone_ptr.
> 3. auto_ptr is wrong, it should use the Colvin-Gibbons trick for proper
> copy construction.
std::auto_ptr seems to remove const from the copy constructor, instead.
Thats life I think. I see in Loki that
const T& operator() const
was commented out. So I am not sure there is much difference in the end.
I don't see it. Someone will have to hit me over the head I guess.
> 4. The customization of "Index" and maybe ICP in refcount_ptr are
> questionable and risk to complicate a full-fledged smart pointer definition
> quite some. I understand the intent is to keep things manageable. An
> unsigned int for Index would work quite fine I think. (Anyway, that should
> be the default option for Index.) Then, use_count uses a cast to int
> instead of using the Index type.
Yes. int or unsigned int, whatever. The reason for the Index is threadsafety
issues. Somebody might want to use atomic_type. PITA that it is, the
default is straightforward enough. The cast to int just means that whatever
the counter may be, in the end, we need a number.
Like I said. Thanks a lot. You are on my good guy list. You are never sure
of what you've got until it is scrutinized by the world. If they hate it,
they you can write off the reasons as absurd ;-) , if they like it... of
course they do !
lee
Lee
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk