uniqInPlace

Returns array uniqified in-place.

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

Examples

1 auto arr = [1, 2, 2, 2, 3, 3, 4];
2 
3 assert(uniqInPlace(arr) == [1, 2, 3, 4]);
4 // The input array gets modified.
5 assert(arr == [1, 2, 3, 4]);
6 
7 // Can be called with non-lvalues
8 assert(uniqInPlace([1, 2, 2, 2, 3, 3, 4]) == [1, 2, 3, 4]);

Meta