A thing to note: Array
is a very generic collection type which should work well for many purposes.
But it’s actually quite similar to Slice
with the main difference that Array
can grow dynamically. That makes it easy to use when you don’t know in advance how much space you need and it grows to fit. The way this mechanism is implemented doesn’t really work well for large sizes, though. Reallocating a buffer in the size of gigabytes is quite costly.
So dynamic allocations that big would better use a different approach anyway. (ref Is increasing array index size in the future? - #3 by RX14).
Slice
should certainly support sizes beyond Int32::MAX
.