Apply Rule of Zero to core signal event hierarchies#688
Open
lyskov-ai wants to merge 1 commit intoRosettaCommons:mainfrom
Open
Apply Rule of Zero to core signal event hierarchies#688lyskov-ai wants to merge 1 commit intoRosettaCommons:mainfrom
lyskov-ai wants to merge 1 commit intoRosettaCommons:mainfrom
Conversation
The signal event classes in core/conformation/signals/ and core/pose/signals/ each had hand-written copy constructor, copy assignment, and empty destructor that did nothing the compiler-generated versions wouldn't do. Remove the boilerplate and let the compiler generate the copy operations; keep the destructor declared (defaulted) where the class is a polymorphic base. Touched: GeneralEvent, ConnectionEvent, IdentityEvent, XYZEvent (conformation); GeneralEvent, DestructionEvent, ConformationEvent, EnergyEvent (pose). LengthEvent is intentionally left alone -- its copy constructor and copy assignment invoke check_consistency() in debug builds, so they have semantic content beyond member-wise copy.
lyskov
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Each of the simple polymorphic signal-event classes in
core/conformation/signals/andcore/pose/signals/had a hand-written copy constructor, copy assignment, and empty destructor that all just did what the compiler-generated versions would do. Removing the boilerplate brings them in line with the Rule of Zero while preserving the polymorphic base destructors as= default.Touched:
core/conformation/signals/:GeneralEvent,ConnectionEvent,IdentityEvent,XYZEventcore/pose/signals/:GeneralEvent,DestructionEvent,ConformationEvent,EnergyEventLengthEventis intentionally left alone — its copy constructor and copy assignment invokecheck_consistency()in debug builds, so they have real semantic content beyond member-wise copy.Net diff: 8 files changed, 4 insertions(+), 188 deletions(-).
Test plan
mode=debugbuild passes (clean,-Werror)mode=release binbuild passes