Skip to content

Apply Rule of Zero to BitSet and BitVector#690

Open
lyskov-ai wants to merge 1 commit intoRosettaCommons:mainfrom
lyskov-ai:refactor/bitset-bitvector-rule-of-zero
Open

Apply Rule of Zero to BitSet and BitVector#690
lyskov-ai wants to merge 1 commit intoRosettaCommons:mainfrom
lyskov-ai:refactor/bitset-bitvector-rule-of-zero

Conversation

@lyskov-ai
Copy link
Copy Markdown
Contributor

Summary

  • utility::BitSet<B> and utility::BitVector<B> each had only a single value-type member (std::set<B> and std::vector<bool> respectively), no user-declared copy/move/assignment operators, and an explicit empty destructor.
  • The empty ~BitSet() {} / ~BitVector() {} did nothing the compiler-generated destructor wouldn't have done, and they suppressed the implicit move constructor and move assignment.
  • Remove the empty destructors so both class templates follow the Rule of Zero and gain implicit move support.

Test plan

  • python3 ./scons.py -j16 mode=release bin builds cleanly.
  • CI: 90 standard tests.

Both class templates have a single value-type member (std::set / std::vector)
and no user-declared copy/move/assignment operators, so the explicit empty
destructors did nothing the compiler-generated ones wouldn't. They were also
suppressing the implicit move constructor and move assignment.

Remove the empty `~BitSet() {}` and `~BitVector() {}` declarations so the
classes follow the Rule of Zero and gain implicit move support.
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.

1 participant