According to N3290, std::unique_ptr accepts a deleter argument in its constructor.
std::unique_ptr
However, I can\'t get that to work with Visual C++ 10.0 or MinGW g++
This works for me in MSVC10
int x = 5; auto del = [](int * p) { std::cout << "Deleting x, value is : " << *p; }; std::unique_ptr px(&x, del);
And on gcc 4.5, here
I'll skip going to the standard, unless you don't think that example is doing exactly what you'd expect it to do.