Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2004-02-02 09:36:00


> -----Original Message-----
> On Behalf Of Neal D. Becker
> Sent: Monday, February 02, 2004 7:58 AM
> I have some legacy C code that returns a pointer:
>
> fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags);
>
> where fftw_plan is a pointer.
>
> Can I use shared_pointer to wrap it? I guess the issue is that eventually
> delete will be called on this pointer, but it wasn't allocated with new.
> Is this a problem?

I think you could just use a custom deleter that calls free:

   shared_ptr<fftw_plan> p(make_pointer(), &::free);


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