uniqInPlace

Returns array uniqified in-place.

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

Examples

auto arr = [1, 2, 2, 2, 3, 3, 4];

assert(uniqInPlace(arr) == [1, 2, 3, 4]);
// The input array gets modified.
assert(arr == [1, 2, 3, 4]);

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

Meta