C++ Maps

C++ Maps are sorted associative containers that contain unique key/value pairs. Maps are sorted by their keys.

For example, you could create a map that associates a string with an integer, and then use that map to associate the number of days in each month with the name of each month.

Header file#include <map>
Map Constructors & Destructorsdefault methods to allocate, copy, and deallocate maps
Map operatorsassign, compare and access elements of a map
Map typedefstypedefs of a map
beginreturns an iterator to the beginning of the map
clearremoves all elements from the map
countreturns the number of elements matching a certain key
emptytrue if the map has no elements
endreturns an iterator just past the last element of a map
equal_rangereturns iterators to the first and just past the last elements matching a specific key
eraseremoves elements from a map
findreturns an iterator to specific elements
insertinsert items into a map
key_compreturns the function that compares keys
lower_boundreturns an iterator to the first element greater than or equal to a certain value
max_sizereturns the maximum number of elements that the map can hold
rbeginreturns a reverse_iterator to the end of the map
rendreturns a reverse_iterator to the beginning of the map
sizereturns the number of items in the map
swapswap the contents of this map with another
upper_boundreturns an iterator to the first element greater than a certain value
value_compreturns the function that compares values