Skip to content

Functional Correctness and Operator Impl - #7

Merged
adeeconometrics merged 13 commits into
mainfrom
dev/assertions
Jul 13, 2026
Merged

Functional Correctness and Operator Impl#7
adeeconometrics merged 13 commits into
mainfrom
dev/assertions

Conversation

@adeeconometrics

Copy link
Copy Markdown
Owner

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:

  • symmetric_diff, set_union, intersection, asymmetric_diff
  • set_or, set_and (delegate wrappers)
  • product (Cartesian product → TreeSet<pair<T,T>>)
  • Operator overloads: operator-, operator||, operator&&, operator*

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.

@adeeconometrics adeeconometrics self-assigned this Jul 13, 2026
@adeeconometrics
adeeconometrics merged commit 2d0e275 into main Jul 13, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant