Javatpoint Logo
Javatpoint Logo

C++ List unique()

C++ List unique() function removes all the duplicate elements present consecutively from the list.

Syntax

Parameter

pred: It is a binary predicate that takes two values of same type. It returns true, if both the values are equal otherwise false.

Syntax of the predicate function would be:

Return value

It does not return any value.

Example 1

Let's see a simple example

Output:

java

Example 2

Let's see a simple example when predicate function is passed to the parameter.

Output:

12 ,13.1,14.7,15.5 

Next Topicresize() Function



Help Others, Please Share

facebook twitter pinterest