Let's say I want to use a custom deleter with an unique_ptr:
void custom_deleter(int* obj)
{
delete obj;
}
Why do I have to write this:
std::unique_ptr<int, void(*)(int*)> x(new int, custom_deleter);
instead of this:
std::unique_ptr<int> x(new int, custom_deleter); //does not compile
?
Can't the type of the deleter be inferred?