Is there any standard delete functor?

c++, delete-operator, functor

Solution

C++0x will add `std::default_delete` to the standard library to support `std::unique_ptr`.

It has effectively the same functionality as your `delete_functor`, but is also specialized to call `delete[]` for array type objects.

Problem

I am looking for a functor that deletes its argument: ``` template<class T> struct delete_functor { void operator()(T* p) { delete p; } }; ``` Is there something like this in `std`, `tr1` or `boost`?

Original source