O'Reilly logo

Mastering C++ Programming by Jeganathan Swaminathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Commonly used APIs in a list

The following table shows the most commonly used APIs of an STL list:

API

Description

front()

This returns the first value stored in the list

back() 

This returns the last value stored in the list

size()

This returns the count of values stored in the list

empty()

This returns true when the list is empty, and false otherwise

clear()

This clears all the values stored in the list

push_back<data_type>( value )

This adds a value at the end of the list

push_front<data_type>( value )

This adds a value at the front of the list

merge( list )

This merges two sorted lists with values of the same type

reverse()

This reverses the list

unique()

This removes duplicate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required