更新时间:2023-11-13 15:51:34
这对我在MSVC10中有效
This works for me in MSVC10
int x = 5;
auto del = [](int * p) { std::cout << "Deleting x, value is : " << *p; };
std::unique_ptr<int, decltype(del)> px(&x, del);
在gcc 4.5上,此处
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.