Functional Correctness and Operator Impl - #7
Merged
Conversation
…ommon anti-patterns
…fiend blackbox scenarios for helper functions and rbt correctness
…mentation to a different module
…nitializer_list conf and custom comparator
…revent invalid memor handling
…ve semantics to TreeSet
…while maintaining o(m+n) merge
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.
Implements set-theoretic operations on the red-black tree TreeSet, adds move semantics, expands test coverage from 0 to 139 tests, and restructures the codebase into a hybrid header-only layout with a public comp() accessor replacing friend-coupled operations.
What Changed
Set operations (include/TreeSetOps.hpp + include/detail/TreeSetOps.tpp)
O(n+m) in-order merge implementations for:
Move semantics (TreeSet.hpp / TreeSet.tpp)
Move constructor and move assignment transfer tree ownership while leaving the source in a valid empty state (fresh sentinel node).
Public comp() accessor (TreeSet.hpp / TreeSet.tpp)
Exposes the comparator via comp(), analogous to std::set::key_comp(). This allowed removing all friend declarations for the set operations — they now compose purely through the public API (cbegin, cend, insert, comp).
Hybrid header-only layout (include/detail/*.tpp)
Template implementations split into .tpp files included at the bottom of .hpp headers. Separates interface from implementation while preserving header-only compilation.
Test suite (test/unittest.cpp: 971 → 1,419 lines)
48 new tests across 5 groups: move semantics (5), named set operations (28), operator overloads (6), Cartesian product (7), large-set stress tests (5). All 139 tests passing.