List Functions

Suman Barik
0

C++ List Functions, Along With Their Use:

Method

Description

insert()

Inserts a new element before the specified position as pointed by the iterator.

push_back()

Adds a new element at the end of the vector.

push_front()

Adds a new element at the front-end of the vector

pop_back()

Deletes the last element.

pop_front()

Deletes the first element.

empty()

Checks if the list is empty.

size()

Finds and returns the number of elements present in the list.

max_size()

Finds and returns the maximum size of the list.

front()

Returns the first element of the list.

back()

Returns the last element of the list.

swap()

swaps two lists when both lists are the same.

reverse()

Reverses the list’s elements.

sort()

Sorts the elements in increasing order.

merge()

Merges two sorted lists.

splice()

Inserts a new list into the list that invokes

unique()

Removes all duplicate elements from the list.

resize()

Changes the size of the list container.

assign()

Assigns a new element to the list container.

emplace()

Inserts a new element at the specified position.

emplace_back()

Inserts a new element at the end of the vector.

emplace_front()

Inserts a new element at the list’s beginning

Tags

Post a Comment

0Comments
Post a Comment (0)