object destruction from heap | linked list using smart pointer
Hello I tried to implement linked list using raw pointer as below: https://code.sololearn.com/ca2293A13a14/#cpp Run the code and observe that object destruction is in reverse order of their construction. i.e. first all node class destructor and at last firstly created linked list class destructor This is what we generally expect and I am getting same behavior. Please correct me if something is wrong. Now, refer below code where link list is implemented using smart pointer. https://code.sololearn.com/c551A229A2A1/#cpp Why destructor call is not same as what it is like normal case of first constructed is destroyed last and last constructed first?