niknaks.arrays

- Added this
This commit is contained in:
Tristan B. Velloza Kildaire 2024-04-27 15:46:28 +02:00
parent 45a6ca0f67
commit 930fa1ace5
1 changed files with 11 additions and 0 deletions

View File

@ -455,6 +455,17 @@ unittest
assert(numbas == [1, 2]);
}
/**
* Removes the element at the
* provided position in the
* given array
*
* Params:
* array = the array
* position = position of
* element to remove
* Returns: the array
*/
public T[] removeResize(T)(T[] array, size_t position)
{
return array.shiftInto(position, false, true);