uniq

Sorts array and removes all value duplicates.

Template params: T = type of array element sort = true: do array.sort first; false: array is already sorted

T[]
uniq
(
T
bool sort = true
)
(
T[] array
)

Parameters

array T[]

array to clean from duplicate values

Return Value

Type: T[]

result

Examples

int[] arr = [ 42, 43, 43, 42, 2 ];
auto slice = uniq(arr);
test!("==")(slice, [ 2, 42, 43 ]);
test!("==")(arr, [ 2, 42, 43, 43, 43 ]);

Meta