add
container.expanding_array.add
Precondition
pre # prevent i32-overflow in capacity safety: (length+1).highest_one_bit < i32.max.highest_one_bit.as_i64
0.099dev (GIT hash a1331a3dc7ff37424401d3c7d0dba5be1302516f)
pre # prevent i32-overflow in capacity safety: (length+1).highest_one_bit < i32.max.highest_one_bit.as_i64
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)`.