Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-01-21 13:08:36


"Larry Evans" <cppljevans_at_[hidden]> wrote in message
news:bumcp2$gqu$1_at_sea.gmane.org...
> On 01/21/2004 04:01 AM, Bronek Kozicki wrote:
> > On Tue, 20 Jan 2004 22:05:33 -0500, Howard Hinnant wrote:
> [snip]
> >
> > Ahhh, clause 5.3.5/3 : "In the second alternative (delete array)
if the
> > dynamic type of the object to be deleted differs from its static
type,
> > the behavior is undefined". Hm. I missed it [1].
> >
> > However I still think that my example (from
> > http://b.kozicki.pl/cpp/T192.cpp ) :
> > auto_ptr<Base> source6 ()
> > {
> > printf("returning pointer to table\n");
> > return auto_ptr<Derived>(new Derived[3], del_array());
> > }
> >
> > is valid. This is not really useful application of custom
deleter, but
> > does not intruduce undefined behaviour, nor unexpected behaviour,
thus
> > (being quite useless) it's still valid. Please note that deleter
will
> > always receive static-type == dynamic-type, when used properly
(ie.
> > smart pointer intialized directly with raw pointer).
> [snip]
>
> I BRIEFLY looked at T192.cpp and T191.hpp. T191.hpp shows the
> auto_ptr contains 3 pointers:
>
> typedef void (* _free_t_) (const volatile void *);
>
> X* ptr_;
> const volatile void* ptv_;
> _free_t_ del_; // pointer to deleter function
>
> I believe, at the same memory cost and a restriction of the
"initial"
> CTOR arguments, auto_new (as the initial CTOR argument) with a 2
> template argument auto_ptr, can achieve the same results. The
> auto_new I'm referring to is in:
>
> http://groups.yahoo.com/group/boost/files/shared_cyclic_ptr/
> auto_smart_ptr.zip
>

Hi Larry,
    I'm working on this issue right now, so I'd like to look at your
code. Unfortunately, I can't seem to download it from yaho. Could you
send me a zip?
   I am working on several versions which will eliminate one of the
pointers in Bronek's implementation. What exactly is the storage
overhead in your implementation?

Regards,
Jonathan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk