#include #include using namespace std; struct A { // выбираем один из этих вариантов и смотрим ... //shared_ptr other; weak_ptr other; ~A() { cout << "~A()\n"; } }; int main() { shared_ptr px(new A); shared_ptr py(new A); px->other = py; py->other = px; cout << px.use_count() << endl; cout << py.use_count() << endl; return 0; }