Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-18 08:03:05


From: "Craig Henderson" <yg-boost-users_at_[hidden]>
> My existing solution uses a unary functor, as below, but this met with
> critism on the Boost Developers' list. What would be the 'boost' solution
to
> this problem?
>
> template<typename T>
> class free_heap_ptr : public std::unary_function<T, void>
> {
> public:
> free_heap_ptr() { }
> ~free_heap_ptr() { }
> void operator() (T p)
> {
> delete p;
> }
> };

I see nothing wrong with your solution (except the redundant constructor and
destructor.)

On a slightly higher level, the "boost" solution is to not keep raw pointers
in a list, but I'm sure you know that.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net