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?
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.
Boost.Lambda has delete_ptr and delete_array
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With