Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
»

add

container.expanding_array.add

(v container.expanding_array.T)
 => 
container.this.expanding_array container.expanding_array.T
[Contains abstract features]
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)`.
0.094dev (2025-06-18 15:08:51 GIT hash 89cffc23ae669b0898a5564fefbf793fcb8e5ca7 built by fridi@fzen)