Import std.collections.immutable
ImmutableArray
struct
@DebugElements Public Struct ImmutableArray<T: Sendable> Implements Iterable<T>, Defaultable, Sendable
An array that never changes: each change gives a new one, which shares what it can with the old, so threads can share it.
Examples
Local first = ImmutableArray<Int>().AddAll([1, 2, 3])
Local second = first.Set(0, 10).Add(4)
Expect(first.ToArray() == [1, 2, 3])
Expect(second.ToArray() == [10, 2, 3, 4])std/collections/immutable.fb, line 41
-
An empty one.
-
One with the
values, in order, all read first. -
How many values it holds.
-
The value at
index, which panics outside it. -
A copy with
valueatindexin place of what's there. -
A copy with
valueadded at the end. -
A copy with each of the
valuesadded at the end, in order, all read first. -
A copy with
valueatindex, moving what's there and after it along, whereindexis from 0 to Count. -
A copy without the value at
index. -
Whether it holds
value. -
The values, in order, in a new array.
-
An empty one.
-
The values, in order.
Report an issue with this page or with FutureBlitz on GitHub.