Skip to content

Commit

Permalink
WIP: deque
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickpeterse committed Sep 18, 2024
1 parent 752f038 commit 91d0730
Show file tree
Hide file tree
Showing 2 changed files with 387 additions and 6 deletions.
9 changes: 3 additions & 6 deletions std/src/std/array.inko
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,13 @@ class builtin Array[T] {
let @capacity: Int
let @buffer: Pointer[T]

# Returns a new `Array` with enough space for at least `amount` values.
#
# The actual capacity may be greater than the given value.
# Returns a new `Array` with enough space for at least `size` values.
#
# # Panics
#
# This method panics of `size` if less than zero.
fn pub static with_capacity(size: Int) -> Array[T] {
if size < 0 { panic('The capacity must be greater than or equal to zero') }
if size < 0 { panic('the capacity must be greater than or equal to zero') }

Array(size: 0, capacity: size, buffer: alloc.resize(0 as Pointer[T], size))
}
Expand Down Expand Up @@ -381,8 +379,7 @@ class builtin Array[T] {
})
}

# Returns an `Iter` that iterates over all values in `self`, returning them
# by value.
# Returns an iterator that moves the values out of `self`.
#
# # Examples
#
Expand Down
Loading

0 comments on commit 91d0730

Please sign in to comment.