Skip to content

Apply Rule of Zero across utility/options/ empty destructors#693

Open
lyskov-ai wants to merge 1 commit into
RosettaCommons:mainfrom
lyskov-ai:refactor/utility-options-empty-dtors
Open

Apply Rule of Zero across utility/options/ empty destructors#693
lyskov-ai wants to merge 1 commit into
RosettaCommons:mainfrom
lyskov-ai:refactor/utility-options-empty-dtors

Conversation

@lyskov-ai
Copy link
Copy Markdown
Contributor

Summary

Drop user-declared empty destructors from the utility/options/ and utility/options/keys/ class hierarchies. The implicit destructor preserves virtual dispatch in every case via inherited virtual destructors:

  • All option classes inherit (transitively) from utility::options::Option, which declares virtual ~Option().
  • All option-key classes inherit (transitively) from utility::keys::Key, which declares virtual ~Key().

No class touched here owns a raw resource, declares a non-trivial destructor body, or has a user-declared copy/move that would suppress the implicit destructor.

utility/options/ — abstract bases and remaining leaf option classes

  • Abstract / templated bases: ScalarOption, ScalarOption_T_, VectorOption, VectorOption_T_, AnyOption, AnyVectorOption.
  • Leaf options: PathOption, PathVectorOption, StringOption, StringVectorOption, ResidueChainVectorOption.

AnyOption / AnyVectorOption used the virtual keyword on the empty body; the rest used override {}. Both forms are equivalent to the implicit virtual destructor here.

utility/options/keys/ — base + 16 leaf key types

  • Base: OptionKey.
  • Leaves: AnyOptionKey, AnyVectorOptionKey, BooleanOptionKey, BooleanVectorOptionKey, FileOptionKey, FileVectorOptionKey, IntegerOptionKey, IntegerVectorOptionKey, PathOptionKey, PathVectorOptionKey, RealOptionKey, RealVectorOptionKey, ResidueChainVectorOptionKey, ScalarOptionKey, StringOptionKey, StringVectorOptionKey, VectorOptionKey.

This is the natural follow-up to #692, which intentionally deferred this batch. With this PR, the entire utility/options* empty-virtual-destructor pattern is cleaned up.

29 files, 156 deletions, 0 additions. Debug build clean.

Drop user-declared empty destructors from option and option-key classes.
The implicit destructor preserves virtual dispatch through inherited
virtual destructors (Option::~Option() and Key::~Key()).

utility/options/ — abstract bases and remaining leaf options:
  AnyOption, AnyVectorOption, ScalarOption, ScalarOption_T_,
  VectorOption, VectorOption_T_, PathOption, PathVectorOption,
  StringOption, StringVectorOption, ResidueChainVectorOption.

utility/options/keys/ — base OptionKey plus 16 leaf key types:
  Any/AnyVector, Boolean/BooleanVector, File/FileVector,
  Integer/IntegerVector, Path/PathVector, Real/RealVector,
  ResidueChainVector, Scalar, String/StringVector, Vector.

Follow-up to PR RosettaCommons#692, which left these classes for a second batch.
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