#include // for EXIT_SUCCESS #include // for std::shared_ptr, std::weak_ptr using std::shared_ptr; using std::weak_ptr; struct N { shared_ptr next; weak_ptr prev; }; int main(int argc, char* argv[]) { shared_ptr head(new N()); head->next = shared_ptr(new N()); head->next->prev = head; return EXIT_SUCCESS; }