実例.
#include <memory> #include <iostream> struct hoge { hoge() { std::cout << "hoge::hoge()\n"; } ~hoge() { std::cout << "hoge::~hoge()\n"; } std::shared_ptr<int> p; }; int main() { auto p = std::make_shared<hoge>(); p->p.reset(new int(), [p](int*){ (void)p; }); }