UEC++ From Basics to Advanced | M06-006: TSet Sorting, Operators, and Slack

This video covers three topics in TSet. Sorting is performed via Sort (unstable) and StableSort, using a binary predicate for custom comparison logic. Sorting order becomes invalid after any modification to the container. The copy operator creates a deep copy with independent value semantics -- modifying the copy does not affect the original set, and vice versa for pointer types. Slack management mirrors TMap: Reserve pre-allocates capacity, Remove creates slack holes in the element array, Compact fills those holes without preserving order, CompactStable fills holes while maintaining element order, and Shrink releases excess capacity at the end of the array. The debugger is used to inspect Num versus Max values and visualize how elements shift during compression. The lesson recommends treating TSet as unordered to avoid reliance on unstable internal ordering.