Modernize pre-C++11 copy prevention to = delete across core/ and protocols/#700
Open
lyskov-ai wants to merge 1 commit into
Open
Conversation
…ocols/
Replace the pre-C++11 idiom (private undefined copy ctor / copy assignment to
prevent copies via link error) with explicit `= delete` for clearer diagnostics
and compile-time enforcement. 16 files; no behaviour change.
Two flavours:
1. Stand-alone non-copyable classes: replace the unimplemented private
declarations with `= delete`. Drops redundant comments ("deny use of the
copy constructor", "private and unimplemented", etc.) that are now
self-evident from `= delete`. Keeps explanatory comments where the *why*
is non-obvious (ScoreFunction / DockingScoreFunction / OtherContextScoreFunction:
"copying discards subclass information; use clone() instead").
2. Singleton (SymDofMoverSampler, inheriting utility::SingletonBase): drop
the redundant copy/assignment declarations entirely — the base already
`= delete`s its own copies, which transitively makes the derived
implicit copies deleted.
Files: ScoreFunction, MinScoreScoreFunction, DockingScoreFunction,
OtherContextScoreFunction, RotamerSet, RotamerSet_, RotamerSubset, RotamerSetBase,
DofPassport, ConstantLengthFragSetIterator_, FrameListIterator_,
MinimalFragSetIterator_, OrderedFragSetIterator_, FragmentPicker (QuotaDebug),
SymDofMoverSampler, FileSystemResourceLocator (FileStream).
Debug build passes clean.
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
Replace the pre-C++11 idiom (declared-but-undefined private copy ctor / copy assignment used to prevent copies via link error) with explicit
= delete. 16 files, no behaviour change — just turning latent link errors into clear compile-time errors. Same kind of work as #685 / #674 / #672 / #671 / etc.Two flavours:
Stand-alone non-copyable classes (14 files): replace the unimplemented private declarations with
= delete. Drops redundant comments ("deny use of the copy constructor","private and unimplemented") that= deletealready conveys. Keeps the explanatory rationale only where the why is non-obvious (ScoreFunction/DockingScoreFunction/OtherContextScoreFunction: copies would discard subclass information; useclone()instead).Singleton (
SymDofMoverSampler, inheritingutility::SingletonBase): drop the redundant copy/assignment declarations entirely — the base already= deletes its own copies, which transitively deletes the derived copies.Files touched
core/scoring/:ScoreFunction.hh,MinScoreScoreFunction.hh,DockingScoreFunction.hhcore/pack/rotamer_set/:RotamerSet.hh,RotamerSet_.hh,RotamerSubset.hhcore/conformation/:RotamerSetBase.hhcore/environment/:DofPassport.hhcore/fragment/:ConstantLengthFragSetIterator_.hh,FrameListIterator_.hh,MinimalFragSetIterator_.hh,OrderedFragSetIterator_.hhbasic/resource_manager/locator/:FileSystemResourceLocator.hh(the innerFileStream)protocols/flexpack/:OtherContextScoreFunction.hhprotocols/frag_picker/:FragmentPicker.hh(the innerQuotaDebug)protocols/matdes/:SymDofMoverSampler.hhDebug build passes clean.