Apply Rule of Zero to empty destructors across core/#706
Open
lyskov-ai wants to merge 1 commit into
Open
Conversation
Move trivially empty or `= default;`-bodied destructors from .cc files to
header declarations using `= default`, then remove the now-redundant .cc
implementations. Where a destructor was declared `~X() {}` inline in a
header, switch it to `~X() = default;` for the same reason.
Affected sibling groups:
- core/conformation/membrane/* and membrane_geometry/* (8 classes)
- core/conformation/parametric/*ValuedParameter (5 classes)
- core/io/silent/SilentFileData iterator and const_iterator
- core/pack/interaction_graph/RotamerDots family (4 classes)
- core/scoring/etable/EtableEvaluator hierarchy (3 classes)
- core/scoring/hbonds/graph/HBondInfo (2 classes)
- core/scoring/nmr/NMRDummySpinlabelVoxelGrid family (4 classes)
- core/scoring/sc/MolecularSurfaceCalculator::Atom
- core/energy_methods/SAXSEnergy
lyskov
approved these changes
May 15, 2026
lyskov
approved these changes
May 18, 2026
roccomoretti
approved these changes
May 18, 2026
Member
roccomoretti
left a comment
There was a problem hiding this comment.
Fine as far as it goes, but putting ~Class() override = default is unnecessary, as the only benefit of declaring a default destructor is being able to label it virtual. (Which it already has to be with the override.)
IIRC, the "unlocks the implicit move-special-members" isn't quite correct -- explicitly defaulting the destructor still counts as "user defined" for the purposes of suppressing the implicit move functions. (Which is why just leaving it off is typically preferred.)
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
Move trivially empty (
~X() {}) or= default;-bodied destructors from.ccfiles to header declarations using= default, and remove the now-redundant.ccimplementations. Where a destructor was declared~X() {}inline in a header, switch it to~X() = default;for the same reason.This unlocks the implicit move-special-members the user-declared destructors were suppressing and removes pure-noise boilerplate.
Affected sibling groups
core/conformation/membrane/{AqueousPoreParameters, ImplicitLipidInfo, MembraneGeometry, MembraneInfo}andmembrane_geometry/{Bicelle, DoubleVesicle, Slab, Vesicle}— 8 classescore/conformation/parametric/{Boolean, Real, RealVector, Size, SizeVector}ValuedParameter— 5 classescore/io/silent/SilentFileData::{iterator, const_iterator}— inline empty dtors removedcore/pack/interaction_graph/RotamerDots.{hh,cc}—DotSphere,RotamerDots,RotamerDotsCache,InvRotamerDotscore/scoring/etable/EtableEnergy.{hh,cc}—EtableEvaluator,AnalyticEtableEvaluator,TableLookupEvaluatorcore/scoring/hbonds/graph/HBondInfo.hh—LKHBondInfo,HBondInfo(also removed an unused user-defined empty copy ctor onLKHBondInfo)core/scoring/nmr/NMRDummySpinlabelVoxelGrid.{hh,cc}—VoxelGridPoint,NMRDummySpinlabelAtom,VoxelGridPoint_AA,NMRDummySpinlabelVoxelGridcore/scoring/sc/MolecularSurfaceCalculator::Atomcore/energy_methods/SAXSEnergyNo behavior changes — pure code-style refactor.