Skip to content

Commit

Permalink
Also freeze Heap types
Browse files Browse the repository at this point in the history
  • Loading branch information
lorentey committed Aug 30, 2021
1 parent 0e9e7f1 commit 837a273
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/PriorityQueueModule/Heap+OrderedViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
extension Heap {
/// A view of a `Heap`'s elements, as a `Sequence` from the smallest to
/// largest element.
@frozen
public struct AscendingView: Sequence, IteratorProtocol {
@usableFromInline
internal var _base: Heap
Expand All @@ -30,6 +31,7 @@ extension Heap {

/// A view of a `Heap`'s elements, as a `Sequence` from the largest to
/// smallest element.
@frozen
public struct DescendingView: Sequence, IteratorProtocol {
@usableFromInline
internal var _base: Heap
Expand Down
1 change: 1 addition & 0 deletions Sources/PriorityQueueModule/Heap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/// "Min-Max Heaps and Generalized Priority Queues."
/// *Communications of the ACM*, vol. 29, no. 10, Oct. 1986., pp. 996-1000,
/// doi:[10.1145/6617.6621](https://doi.org/10.1145/6617.6621)
@frozen
public struct Heap<Element: Comparable> {
@usableFromInline
internal var _storage: ContiguousArray<Element>
Expand Down

0 comments on commit 837a273

Please sign in to comment.