Boost logo

Boost :

From: Ken Shaw (ken_at_[hidden])
Date: 2002-03-25 15:02:46


----- Original Message -----
From: "E. Gladyshev" <egladysh_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, March 25, 2002 11:11 AM
Subject: Re: [boost] plain pointers and shared_ptr

>
> >
> > Yes it will. foo() doesn't need to know anything
> > about the deleter, as long
> > as it takes a shared_ptr.
> >
>
> No, it won't :) foo() dosn't take a shared_ptr.
> It is the topic of this discussion that foo()
> takes plain pointers not shared_ptr<>, see the
> subject.
> Unfortunately the other guy decided
> that foo() interface must support C as well
> and we cannot change it.
>

Then don't worry about destroying it. If the C code is any good it doesn't
expect the pointer to get destroyed by foo(). Normally the code that
malloc()'s a pointer is responsible for free()'ing it. Anyway if you don't
know whether new or malloc was used to create the pointer you cannot safely
and portably get rid of it.

Ken Shaw


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