Skip to content

Commit d0bab40

Browse files
committed
[stdlib] Add isEmpty property to InlineArray
1 parent 428d269 commit d0bab40

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stdlib/public/core/InlineArray.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,16 @@ extension InlineArray where Element: ~Copyable {
276276
count
277277
}
278278

279+
/// A Boolean value indicating whether the array is empty.
280+
///
281+
/// - Complexity: O(1)
282+
@available(SwiftStdlib 6.2, *)
283+
@_alwaysEmitIntoClient
284+
@_transparent
285+
public var isEmpty: Bool {
286+
count == 0
287+
}
288+
279289
/// The position of the first element in a nonempty array.
280290
///
281291
/// If the array is empty, `startIndex` is equal to `endIndex`.

0 commit comments

Comments
 (0)