Associative containers, like sequence containers, are used to store data. Imagine we have objects that encapsulate the information of an employee at a company. These member functions are equivalent to the appropriate sequence container member functions. It can be constructed out of a sequence of elements specified by two iterators or another associative container.
Associative containers provide bidirectional iterators.
Now we want to store some employee data in the set. The bool value indicates whether the insertion took place. In case of an associative container supporting unique keys, the iterator points to the element with the key equal to the key of the element specified as argument, in case of an associative container supporting equal keys to the newly inserted element. Since it doesn't make sense to store more than one employee under an employee key, for the demonstration of an associative container supporting equal keys a slightly different example is used. A number of employees is stored under the same key which represents a department code.