[Heap] Convert min() and max() to properties

This commit is contained in:
Karoy Lorentey committed 2023-11-14 18:52:27 -08:00
1 parent 5fab05b1ea
commit e10396bb20
2 files changed
+48 -48

No files matched your search

+2 -2
View File
@@ -117,7 +117,7 @@ extension Heap {
///
/// - Complexity: O(1)
@inlinable
public func min() -> Element? {
public var min: Element? {
_storage.first
}
@@ -125,7 +125,7 @@ extension Heap {
///
/// - Complexity: O(1)
@inlinable
public func max() -> Element? {
public var max: Element? {
_storage.withUnsafeBufferPointer { buffer in
guard buffer.count > 2 else {
// If count is 0, `last` will return `nil`