filterInPlace

Returns array filtered in-place.

ref
Array
filterInPlace
(
alias pred = "a"
Array
)
(
auto ref Array array
)
if (
isDynamicArray!Array
)

Examples

alias isEven = n => n % 2 == 0;
auto arr = [1, 2, 2, 2, 3, 3, 4];

assert(filterInPlace!isEven(arr) == [2, 2, 2, 4]);
// The input array gets modified.
assert(arr == [2, 2, 2, 4]);

// Can be called with non-lvalues
assert(filterInPlace!isEven([1, 2, 2, 2, 3, 3, 4]) == [2, 2, 2, 4]);

Meta