node a(3); // a, will be deleted as a stack variable
a.next = new node(4); // b, will be deleted by unique_ptr of a
a.next->next = new node(5); // c, will be deleted by unique_ptr of b
// 1. deleting of b, not "tested" :) :
a.next = move(a.next->next); // is there a crash ?
// 2. then deleting of b, old style :) :
unique_ptr<node> temp = move(a.next->next);
a.next = move(temp);
PS: any pre 0x11 C++ strcture or class may have a destructor as well :
looks like it should generate some kind of type mismatch error. At the very least I think you would have to deliberately cast 'b' to something before you can assign it to a unique_ptr variable. I'm not sure about the other two errors.
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
Last Visit: 31-Dec-99 18:00 Last Update: 13-Jul-14 9:57