sainadth
c9286ec384
[Heap] Make _checkInvariants() public in internal checks builds
...
`Heap._checkInvariants()` was `internal` when COLLECTIONS_INTERNAL_CHECKS
is defined but `public` otherwise, so code outside `HeapModule` compiled
normally and then failed in an internal checks build.
Make both declarations `public`, matching `OrderedSet`,
`OrderedDictionary`, `BitSet` and `BitArray`, and add a test that calls it
through a plain `import HeapModule`.
Fixes #813
2026-11-04 13:10:43 -06:00
Karoy Lorentey
24339ad6a3
CMake: Remove obsolete references to source variables
2026-10-12 12:24:03 -07:00
Karoy Lorentey
d07dc32dfa
Sources: Add unsafe keywords where needed
2026-10-01 11:14:29 -07:00
Sorin Cioban
bdd6b79403
Use package access for heap test helper
2026-06-04 10:18:09 +01:00
Sorin Cioban
49887191bb
Run heap node tests in release
2026-05-31 23:10:33 +01:00
Karoy Lorentey and Claude Sonnet 4.6
67afae1edd
[HeapModule] Heap.insert(contentsOf:): Use wrapping multiply in Floyd heuristic
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-01 15:14:00 -07:00
Karoy Lorentey and Claude Sonnet 4.6
9e2f57eddf
[HeapModule] Heap._UnsafeHandle.swapAt(_:with:): Add missing bounds assertion
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-01 15:13:59 -07:00
Karoy Lorentey
1c69635852
Add SPDX-License-Identifier tags
2026-03-05 19:39:24 -08:00
Karoy Lorentey
d9b09ecde8
Update copyright dates
2026-03-05 19:39:20 -08:00
AZero13
7f8a32c5a9
Change useFloyd heuristic to match comment
...
Comment says exceed, but this checks if it is less than the limit.
2025-12-06 12:58:07 -05:00
Tony Parker
c883a1729a
Add support for embedded Swift mode
...
Remove calls to `debugPrint` (which does not exist), and ifdef out support for `Codable` and `Reflection`.
2025-07-17 16:36:56 -07:00
Karoy Lorentey
dbc2866bb5
[Heap] removeAll(where:): Fix exception safety
2025-05-15 21:39:55 -07:00
Dakshin Devanand
c7c38028cd
Add Heap.removeAll(where:)
2025-05-15 21:39:50 -07:00
Karoy Lorentey
225159599d
[Heap] Fix remaining tie break inconsistency in popMax
2025-05-15 17:34:16 -07:00
Karoy Lorentey
d93a6ab8a1
[Heap] Follow the spelling of stdlib’s min/max; add note explaining expectations
...
The existing expressions had the same effect, but they used different operators (`<=` instead of `<` and `>` instead of `>=`). The distinction is usually irrelevant, but there is no reason not to just follow what the stdlib is doing exactly.
2025-05-15 17:30:25 -07:00
Dakshin Devanand
5edd1be23c
Make Heap._UnsafeHandle min/maxValue tie-breaker consistent with Swift.min/max
2025-03-08 10:08:39 -06:00
Jeremy Schonfeld
3e120b48bb
[CMake] Reduce path lengths in single-module build ( #392 )
...
* Eliminate relative paths from the cmake single-module build
* Attempt to reduce length of paths in single module build
2024-06-26 08:39:11 -07:00
Jeremy Schonfeld
ee97538f5b
Add Single Module Build Mode to CMake for Foundation ( #385 )
...
* Add new single-module and foundation-toolchain-module modes to CMake build
* Fix allowable client flag syntax
2024-06-03 16:15:50 -07:00
Karoy Lorentey
35d5746117
Rename _CollectionsUtilities to InternalCollectionsUtilities
...
We are forced to do this due to an Xcode issue (#364 ) with underscored module names.
This module remains unstable, despite the removal of the underscore. Directly importing it from outside the package remains unsupported. This module and/or its entire contents may go away or change in incompatible ways in any future swift-collections release.
2024-05-29 14:00:13 -07:00
Karoy Lorentey
540348f147
[Heap] Update copyright notices
2024-02-02 16:20:21 -08:00
Karoy Lorentey
3c99c84286
[Heap] Clean up description
...
- Don’t print the type name
- Include some information identifying the heap instance
2024-02-02 16:20:21 -08:00
Karoy Lorentey
37e66d0e49
[Heap] Modernize generic declaration syntax
2024-02-02 16:20:21 -08:00
Karoy Lorentey
50f6307501
[Heap] Also add an init(minimumCapacity:) initializer
2024-01-29 17:57:14 -08:00
Karoy Lorentey
9022cbd153
[Heap] Add reserveCapacity
2024-01-29 17:51:00 -08:00
Karoy Lorentey
a52457d6fc
[Heap] Mark removeMin/removeMax @discardableResult
2024-01-29 17:50:44 -08:00
Karoy Lorentey
53831b3a22
[Heap] Update docs
2023-11-14 19:10:35 -08:00
Karoy Lorentey
e10396bb20
[Heap] Convert min() and max() to properties
2023-11-14 18:52:27 -08:00
Karoy Lorentey
c44d56f4c8
Merge pull request #327 from lorentey/heap-better-bulk-insert
...
[Heap] insert(contentsOf:) Switch to Floyd’s if we’re inserting too many items
2023-11-14 17:56:22 -08:00
Karoy Lorentey and Stephen Canon
19ec155f60
Update Sources/HeapModule/Heap.swift
...
Co-authored-by: Stephen Canon <stephentyrone@gmail.com >
2023-11-14 11:06:05 -08:00
Karoy Lorentey
069dd4e5df
[Heap] insert(contentsOf:) Switch to Floyd’s if we’re inserting too many items
2023-11-13 21:28:24 -08:00
Karoy Lorentey
7686af1555
[Heap] Improve type-level doc comment
2023-11-13 18:33:43 -08:00
Karoy Lorentey
a8dad62bc9
Remove obsolete swift(>=5.5)/swift(>=5.6) checks
2023-04-10 18:33:52 -07:00
Karoy Lorentey
cbab9e3737
Introduce COLLECTIONS_SINGLE_MODULE condition
2023-03-21 18:42:33 -07:00
Karoy Lorentey
cc181a3bce
HeapModule: _Node → _HeapNode
...
This makes this name unique throughout the package, allowing this code to be built as a single, huge module.
2023-03-21 16:39:03 -07:00
Karoy Lorentey
5e80c92941
Merge pull request #230 from lorentey/update-cmake
...
Update CMake build configuration
2022-10-28 18:20:21 -07:00
Karoy Lorentey
d19fb14c46
[CMake] Update CMake configuration
2022-10-28 18:18:39 -07:00
Karoy Lorentey
b2f254384d
[doc] Add some flesh to DocC structure
...
# Conflicts:
# Sources/BitCollections/BitCollections.docc/Extensions/BitArray.md
# Sources/BitCollections/BitCollections.docc/Extensions/BitSet.Counted.md
# Sources/BitCollections/BitCollections.docc/Extensions/BitSet.md
# Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.UnorderedView.md
# Sources/OrderedCollections/OrderedCollections.docc/Extensions/OrderedSet.md
2022-10-28 12:34:14 -07:00
Karoy Lorentey
86bce28835
[docs] Start working on DocC support
2022-10-28 12:34:14 -07:00
Karoy Lorentey
c12b454da1
[Heap] Add missing Custom[Debug]StringConvertable conformances, review existing ones
...
Add `Custom[Debug]StringConvertible` conformance on `Heap`.
2022-10-20 17:14:52 -07:00
Karoy Lorentey
f76630db8e
[Internals] Add missing internal checking predicates & docs for all
2022-10-18 22:13:19 -07:00
Karoy Lorentey
fc8092d044
[Heap] Small preparation for improving insert(contentsOf:)
2022-10-14 10:34:58 -07:00
Karoy Lorentey
dc01b52a21
[Heap] Fix stray character in COLLECTION_INTERNAL_CHECKS condition
2022-10-13 14:51:04 -07:00
Karoy Lorentey
fbebb69a1b
[Heap] Doc updates
2022-10-13 14:50:18 -07:00
Karoy Lorentey
1228e9c162
[Heap] Update docs for replaceMin/replaceMax
2022-10-12 16:01:48 -07:00
Karoy Lorentey
7138144f37
[Heap] Remove unnecessary testing APIs
...
We do not need a _raw initializer in the Heap implementation. The
heapify algorithm will not modify storage if it’s already in the
expected shape, so we can simply define one locally that double checks
that the order remains unchanged.
2022-10-12 16:01:23 -07:00
Karoy Lorentey
92d808d179
Merge branch 'heap-replace-extrema' into release/1.1
2022-10-12 15:23:17 -07:00
Karoy Lorentey
5aed92655d
[CMake] Update CMake build configuration
2022-10-11 13:11:37 -07:00
Karoy Lorentey
33b759b842
[Heap] PriorityQueueModule → HeapModule
2022-10-09 15:44:44 -07:00