Apply Rule of Zero across utility/ helpers#692
Open
lyskov-ai wants to merge 2 commits into
Open
Conversation
Remove user-declared destructors and trivial copy ctor/assignment
implementations whose bodies are equivalent to the compiler-generated
defaults. The implicit special members are correct in every case:
* utility/DereferenceIterator.hh: empty user dtor.
* utility/graph/ArrayPool.hh (Array0): empty dtor plus member-wise
copy ctor and self-assignment-guarded copy assignment.
* utility/graph/Graph.hh / Digraph.hh: empty dtor and = default /
member-wise copy ops on EdgeListElement, EdgeListIterator,
EdgeListConstIterator and the Directed* counterparts (non-owning
raw pointers, default copy is correct).
* utility/graph/LowMemGraph.hh (LowMemGraphBase): empty override dtor;
base utility::VirtualBase already supplies a virtual destructor.
* utility/graph/UpperEdgeGraph.hh: empty UEEdge dtor and the
~UpperEdgeGraph() override = default declaration.
* utility/options/{Boolean,File,Integer,Real}Option(.hh) and their
*VectorOption.hh counterparts: empty ~XxxOption() override {}; the
base option classes' virtual destructors are still inherited.
lyskov
approved these changes
May 8, 2026
This was referenced May 8, 2026
UpperEdgeGraph::get_vertex_ptr and ::note_edge_deleted are called from the friend class UEEdge (constructors at lines 314/315/325/326 and delete_edge at line 342), but cppcheck does not trace template friend usage and flags them as unusedPrivateFunction.
lyskov
approved these changes
May 18, 2026
roccomoretti
approved these changes
May 18, 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
Remove user-declared destructors and trivial copy ctor/assignment implementations whose bodies are equivalent to the compiler-generated defaults. The implicit special members are correct in every case (no owning raw pointers, no side effects in the removed bodies, virtual destructor inheritance preserved through base classes).
utility/graph/ — non-owning iterator/element helpers
Graph.hh:EdgeListElement,EdgeListIterator,EdgeListConstIterator— drop user dtor and the= defaultcopy ctor / assignment.Digraph.hh:DirectedEdgeListElement,DirectedEdgeListIterator,DirectedEdgeListConstIterator— drop user dtor and member-wise copy ctor / assignment.ArrayPool.hh(Array0): drop user dtor, copy ctor, and self-assignment-guarded copy assignment.LowMemGraph.hh(LowMemGraphBase): drop emptyoverridedtor (utility::VirtualBasesupplies the virtual destructor).UpperEdgeGraph.hh: drop the emptyUEEdgedtor and~UpperEdgeGraph() override = default;.LowMemNode/LowMemEdgeare intentionally left untouched — their explicit destructor declarations anchor a load-bearing comment about deliberately not making the destructor virtual.utility/
DereferenceIterator.hh(DereferenceIterator): drop empty user dtor.utility/options/ — empty overriding destructors
Drop
~XxxOption() override {}from the eight leaf scalar/vector option classes. The implicit destructor is virtual via inheritance fromOption(which declares a virtual destructor), so dynamic dispatch is preserved.BooleanOption.hh,BooleanVectorOption.hhFileOption.hh,FileVectorOption.hhIntegerOption.hh,IntegerVectorOption.hhRealOption.hh,RealVectorOption.hhThe remaining option classes with the same pattern (
PathOption,StringOption,ResidueChainVectorOption,ScalarOption,ScalarOption_T_,VectorOption,VectorOption_T_) can be addressed in a follow-up; the eight here form a coherent leaf-scalar-plus-vector subset.Test plan
cd source && python3 ./scons.py -j16 mode=debug— clean (no errors)