mirror of https://github.com/deavmi/niknaks
Compare commits
2 Commits
a5f7e9fc95
...
bf0d9569c6
Author | SHA1 | Date |
---|---|---|
Tristan B. Velloza Kildaire | bf0d9569c6 | |
Tristan B. Velloza Kildaire | c7825c5821 |
|
@ -469,4 +469,17 @@ unittest
|
||||||
public T[] removeResize(T)(T[] array, size_t position)
|
public T[] removeResize(T)(T[] array, size_t position)
|
||||||
{
|
{
|
||||||
return array.shiftInto(position, false, true);
|
return array.shiftInto(position, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests removing an element from an array
|
||||||
|
*/
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
int[] numbas = [1, 5, 2];
|
||||||
|
numbas = numbas.removeResize(1);
|
||||||
|
|
||||||
|
// should now be [1, 2]
|
||||||
|
writeln(numbas);
|
||||||
|
assert(numbas == [1, 2]);
|
||||||
}
|
}
|
Loading…
Reference in New Issue