Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-02-02 09:55:50


"Neal D. Becker" <nbecker_at_[hidden]> writes:

> 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?

Custom deleters are your friend. See the shared_ptr docs for more
info.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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