Boost logo

Boost :

From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-07-16 05:51:48


Howard Hinnant wrote:
> The use of function-pointer-deleters allows for a nifty "poor-man's
> dynamic deleter". A hybrid if you will between the typical unique_ptr
> and shared_ptr use cases and overhead:
>
> unique_ptr<int, void(*)(void*)> p1(std::malloc(sizeof(int)), std::free);
> unique_ptr<FILE, int(*)(FILE*)> p2(std::fopen("test.dat", "w"),
> std::fclose);

What about boost::function<void*>?
How is that less powerful than a dynamic deleter?

I personally don't see the point in dynamic deleters, they're only
specializations of dynamic ones.


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