「view this page in B3 βῆτα server」

Revisions №60570

branch: master 「№60570」
Commited by: Rocco Moretti
GitHub commit link: 「6b183247c2f2d613」 「№3712」
Difference from previous tested commit:  code diff
Commit date: 2019-01-04 18:16:18

Merge pull request #3712 from RosettaCommons/roccomoretti/deep_copy_util Add a deep copy utility class. Having a member variable with deep-copy semantics makes things more complicated than it should. Having just one member variable that needs special treatment means that you can't use the implicit copy/assignment operators, necessitating manual copying of the 100 other member variables in the class, and all the attendant issues with forgetting one, or having someone add one and forget to copy it over, etc. Instead, it would be nice to have a wrapper class which just "does the right thing". That's what the new utility::pointer::DeepCopyOP class in this PR intends to do. By using a DeepCopyOP class (instead of a straight OP) as a member variable in your class, you should get automatic deep-copy semantics from the implicit copy/assignment operators, but the member variable should work identically to an OP. The only little "wart" on the implementation is that permit use of forward headers, you need to declare (in the forward header) a (non-class) deep_copy() function in the header, and then define it with the appropriate semantics (usually just calling clone() on the object). I've done some test conversions on MainchainScoreTable and AnchoredGraftMover, and things seem to be working. There may be edge cases where the DeepCopyOP is not 100% convertible with a regular OP, but I think it will be possible to extend the DeepCopyOP class for those cases.

...