How to comprare weak_ptr with shared_ptr
Hi I have tried to use smart pointer for implementation of Circular Singly Linked List as below: https://code.sololearn.com/cgIlijAT32A0 I observed that destructor for node class is not called for any of the node used in linked list. Reason is but obvious and it is circular reference due to shared_ptr used in node class. I just tried to change next member variable of node class (shared_ptr<node> next;) to weak_ptr and it fails to compile. I have two questions now as below: 1. Can I compare weak_ptr with shared_ptr any how to make line 30 [while(tmp->next != head) in void circularList::createList() method] get compiled? 2. If not, how can I create object of weak_ptr from fresh as it has to be compared with head pointer of type shared_ptr Feel free to ask for clarification. Thanks in advance..!