"unique" (vector::unique / dyn_*::unique)

Removes all duplicate elements in an array.

Synopsis

int vector.unique();

int vector.unique(string memberName);

int vector.unique(function_ptr memberFunc);

Parameters

Parameter Description
memberName Class member used for comparing
memberFunc Class member function used for comparing

Description

Removes all duplicate elements in an array.

memberName defines which class member is used for the comparison of the objects. Here memberName is used in a similar way as in indexListOf().

The given function can be implemented in the same way as seen in "sort", but it is just needed to return 0, when this and the other object are the same, any other value if they are not.

Here memberFunc is used in a similar way as in indexListOf().

Assignment

Vector / dyn_*