65,186
社区成员




#include <cstdio>
#include <memory>
struct A {
A() { std::printf("[%s] called\r\n", __FUNCTION__); }
~A() { std::printf("[%s] called\r\n", __FUNCTION__); }
int a = 0;
};
int main() {
{
auto ptr_a = std::make_shared<A>();
auto ptr_b = ptr_a;
std::printf("before reset\r\n");
ptr_a.reset();
std::printf("after reset\r\n");
}
std::printf("wait std::getchar()\r\n");
std::getchar();
return 0;
}