Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualRavyne

Posted 14 February 2013 - 05:44 PM

How do you propose that you can take a copy of an object that contains a unique_ptr? You have to move (as in std::move) the unique_ptr's ownership to the copy, thus the unique_ptr in the original object no longer owns what it was pointing to, or even has its address.

The original object is not destructed, but it no longer holds that reference. Its incomplete and probably worthless.

[Edit] See my follow-up below.

#2Ravyne

Posted 03 February 2013 - 10:23 PM

How do you propose that you can take a copy of an object that contains a unique_ptr? You have to move (as in std::move) the unique_ptr's ownership to the copy, thus the unique_ptr in the original object no longer owns what it was pointing to, or even has its address.

 

The original object is not destructed, but it no longer holds that reference. Its incomplete and probably worthless.


#1Ravyne

Posted 03 February 2013 - 10:22 PM

How do you propose that you can take a copy of an object that contains a unique_ptr? You have to move (as in std::move) the unique_ptr's ownership to the copy, thus the unique_ptr in the original object no longer owns what it was pointing to, or even has its address.

 

The original object is not destructed, but it no longer holds that reference.


PARTNERS