Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Huh, you really need to elaborate on both points.

As far as I remember from my 'active' C++ time, a move operator does a 'flat copy' of all 'top level items' in an object, and then puts the source object into a state where the destructor can safely be called on it without destroying any of the previously owned resources (which means for instance setting any owning pointers to zero so that the destructor doesn't free the memory that was owned by those pointers, because ownership of this memory has moved to the destination object). It gets a bit more non-obvious if any of those items are complex C++ objects themselves, but in the end it's always "copy all the bits, and then clear any owning pointers without freeing the underlying memory".

Did I miss something?



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: