Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

add

container.expanding_array.add

create a new `expanding_array` with element i set to v. Grow the array
in case i == length.

expand is not thread-safe.

Complexity: O(1) if no allocation is required, O(length+1) otherwise.

Cumulative complexity of adding an element to an empty `expanding_array`
and repeatedly growing the result `add` by a total of `n` elements is
`O(n)`.

`add` called repeatedly on the same `expanding_array` creates copies
of the underlying array data and hence has performance in `O(length)`.
Precondition
pre
  # prevent i32-overflow in capacity
  safety: (length+1).highest_one_bit < i32.max.highest_one_bit
0.097dev (GIT hash 6a5de4939ddf29875c1d9a706508d9bfd0cd7ca9)
last changed: 2026-06-09