Skip to content

Apply Rule of Zero to remaining LREnergyContainer iterator subclasses#699

Open
lyskov-ai wants to merge 1 commit into
RosettaCommons:mainfrom
lyskov-ai:refactor/lr-energy-container-iterators-rule-of-zero
Open

Apply Rule of Zero to remaining LREnergyContainer iterator subclasses#699
lyskov-ai wants to merge 1 commit into
RosettaCommons:mainfrom
lyskov-ai:refactor/lr-energy-container-iterators-rule-of-zero

Conversation

@lyskov-ai
Copy link
Copy Markdown
Contributor

Summary

Extends the disulfide-iterator pattern from PR #689 to the four remaining ResidueNeighbor{,Const}Iterator subclasses in core/scoring/:

  • DenseNeighbor{,Const}Iterator (DenseEnergyContainer.{hh,cc})
  • OneToAllNeighbor{,Const}Iterator (OneToAllEnergyContainer.{hh,cc})
  • PolymerBondedNeighbor{,Const}Iterator (PolymerBondedEnergyContainer.{hh,cc})
  • CstResNeighb{,Const}Iterator (constraints/ConstraintEnergyContainer.{hh,cc})

For each class:

  • Remove the empty out-of-line destructor (~X() override; decl in .hh plus X::~X() = default; in .cc) — Rule of Zero suffices since the base destructor is already virtual.
  • Replace the pre-C++11 private undefined derived-derived copy-assignment (X & operator = (X const & );) with an explicit = delete and a short comment explaining that all assignment must funnel through the polymorphic operator = ( ResidueNeighbor{,Const}Iterator const & ) so derived members are downcast and copied correctly.

Together with PR #689 this exhausts the LREnergyContainer iterator family — every concrete container's iterator pair now follows the same idiom.

The bundle is smaller than the usual minimum (~77 lines) because no further sibling work exists in this hierarchy.

Extends the disulfide-iterator pattern (PR RosettaCommons#689) to the four remaining
ResidueNeighbor{,Const}Iterator subclasses:

- DenseNeighbor{,Const}Iterator
- OneToAllNeighbor{,Const}Iterator
- PolymerBondedNeighbor{,Const}Iterator
- CstResNeighb{,Const}Iterator

For each: drop the empty `= default` destructor pair (override decl in .hh,
out-of-line definition in .cc), and replace the pre-C++11 private undefined
copy-assignment with an explicit `= delete` plus a comment explaining that
all assignment must funnel through the polymorphic operator= so derived
state is downcast and copied correctly.

This exhausts the LREnergyContainer iterator family; together with PR RosettaCommons#689
all six concrete container's iterator pairs use the same idiom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants