Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Array type with deterministic control of memory. The memory allocated
for the array is reclaimed as soon as possible; there is no reliance
on the garbage collector. Array uses malloc, realloc and free
for managing its own memory.
structArray(T)
if(!is(immutable(T) == immutable(bool)));
This means that pointers to elements of an Array will become
dangling as soon as the element is removed from the Array. On the other hand
the memory allocated by an Array will be scanned by the GC and
GC managed objects referenced from an Array will be kept alive.
Sets the number of elements in the array to newLength. If newLength
is greater than length, the new elements are added to the end of the
array and initialized with T.init.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to T or a range of objects convertible
to T. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to T or a range of objects convertible
to T. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Removes the last element from the array and returns it.
Both stable and non-stable versions behave the same and guarantee
that ranges iterating over the array are never invalidated.
Removes the value from the back of the array. Both stable and non-stable
versions behave the same and guarantee that ranges iterating over the
array are never invalidated.
Removes howMany values from the back of the array.
Unlike the unparameterized versions above, these functions
do not throw if they could not remove howMany elements. Instead,
if howMany> n, all elements are removed. The returned value is
the effective number of elements removed. Both stable and non-stable
versions behave the same and guarantee that ranges iterating over
the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to T or a range of objects convertible
to T. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to T or a range of objects convertible
to T. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Removes the last element from the array and returns it.
Both stable and non-stable versions behave the same and guarantee
that ranges iterating over the array are never invalidated.
Removes the value from the back of the array. Both stable and non-stable
versions behave the same and guarantee that ranges iterating over the
array are never invalidated.
Removes howMany values from the back of the array.
Unlike the unparameterized versions above, these functions
do not throw if they could not remove howMany elements. Instead,
if howMany > n, all elements are removed. The returned value is
the effective number of elements removed. Both stable and non-stable
versions behave the same and guarantee that ranges iterating over
the array are never invalidated.
Note
When using Array with range-based functions like those in std.algorithm,
Array must be sliced to get a range (for example, use array[].map!
instead of array.map!). The container itself is not a range.
Struct Array
Array specialized for bool. Packs together values efficiently by
allocating one bit per element.
Sets the number of elements in the array to newLength. If newLength
is greater than length, the new elements are added to the end of the
array and initialized with false.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to bool or a range of objects convertible
to bool. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to bool or a range of objects convertible
to bool. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Removes the last element from the array and returns it.
Both stable and non-stable versions behave the same and guarantee
that ranges iterating over the array are never invalidated.
Removes the value from the back of the array. Both stable and non-stable
versions behave the same and guarantee that ranges iterating over the
array are never invalidated.
Removes howMany values from the back of the array. Unlike the
unparameterized versions above, these functions do not throw if
they could not remove howMany elements. Instead, if howMany> n,
all elements are removed. The returned value is the effective number
of elements removed. Both stable and non-stable versions behave the same
and guarantee that ranges iterating over the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to bool or a range of objects convertible
to bool. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to bool or a range of objects convertible
to bool. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to bool or a range of objects convertible
to bool. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.
Removes the last element from the array and returns it.
Both stable and non-stable versions behave the same and guarantee
that ranges iterating over the array are never invalidated.
Removes the value from the back of the array. Both stable and non-stable
versions behave the same and guarantee that ranges iterating over the
array are never invalidated.
Removes howMany values from the back of the array. Unlike the
unparameterized versions above, these functions do not throw if
they could not remove howMany elements. Instead, if howMany > n,
all elements are removed. The returned value is the effective number
of elements removed. Both stable and non-stable versions behave the same
and guarantee that ranges iterating over the array are never invalidated.
Inserts stuff before, after, or instead range r, which must
be a valid range previously extracted from this array. stuff
can be a value convertible to bool or a range of objects convertible
to bool. Both stable and non-stable version behave the same and
guarantee that ranges iterating over the array are never invalidated.