Standard C++ Library Class Reference
Associative Containers
In addition to the requirements for a container, the following requirements hold for associative
containers:
For an associative container iterator and const_iterator must be bidirectional iterators.
Associative containers are inherently sorted. Their iterators proceed through the container
in the non-descending order of keys (where non-descending order is defined by the
comparison object that was used to construct the container).
●
An associative container provides the following types:
X::key_type the type of the Key
X::key_compare the type of the comparison to use to put the keys in order
X::value_compare the type of the comparison used on values
●
The default constructor and copy constructor for associative containers use the template
parameter comparison class.
●
An associative container provides the following additional constructors:
X(c) Construct an empty container using c as the comparision object
X(i,j,c) Constructs a container with elements from the range [i,j) and the comparison
object c.
X(i, j) Constructs a container with elements from the range [i,j) using the template
parameter comparison object.
●
An associative container provides the following member functions:
key_comp() Returns the comparison object used in constructing the associative
container.
value_comp() Returns the value comparison object used in constructing the
associative container.
insert(t) Inserts t if and only if there is no element in the container with key
equal to the key of t. Returns a pair<iterator,bool>. The bool
component of the returned pair indicates the success or failure of the
operation and the iterator component points to the element with key
equal to key of t.
●