mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
[Heap] Convert min() and max() to properties
This commit is contained in:
2 files changed
+48
-48
No files matched your search
@@ -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`
|
||||
|
||||
Reference in new issue
Block a user