From: Kevin Atkinson (kevinatk_at_[hidden])
Date: 2000-03-06 07:50:23
Dave Abrahams wrote:
> on 3/6/00 7:10 AM, Kevin Atkinson at kevinatk_at_[hidden] wrote:
> > Great. How about looking at my ClonePtr which does the same thing but
> > works when the template type is an Abstract Base Class.
> Okay, you asked for it:
> The idea seems fine to me in principle
> I have a hard time reading code that uses recapitalized or otherwise
> distorted keywords (like Class and ths)
> I don't think it is worth using RTTI to check for the special case where the
> types match during assignment.
Well it all depends on the cost of a delete which potently involves
going through several virtual destructors, then a clone which also will
potentially involve going through several function calls. Plus both the
destructor and the clone may involve freeing several blocks of memory
and then allocating the same blocks right back. while the assign method
only involves going through the layer of functions once and will
generally involve no deallocation or allocation of memory. However if
the cost of the typeid function is not cheap than it may not be worth
> For uniformity with auto_ptr, del() should be merged with assign() and
> should be called reset().
I will consider it but reset seams a bit misleading.
> Implicit conversion to bool is a terrifying idea, since bools can be
> promoted to any integer type.
Well pointers have an explicit conversion to bool.....
-- Kevin Atkinson kevinatk_at_[hidden] http://metalab.unc.edu/kevina/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk