Unlike a vector, a list doesn't provide random access to its elements. So, the member functions begin, end, rbegin and rend return bidirectional iterators. In addition to the member functions push_back and pop_back, list provides push_front and pop_front to add and remove an element at its beginning, because these operations can be done in constant time.
The container list provides special mutative operations. It is possible to splice two lists into one (member function: splice), that is to insert the content of one list before an iterator position of another. Two lists can be merged (merge) into one using operator< or a compare function object, a list can be reversed (reverse) and sorted (sort). It is also possible to remove all but first element from every consecutive group of equal elements (unique).
For an exact description of all these member functions read , 8.1.2.
Continue with section 5.4
Back to index
Johannes Weidl (J.Weidl@infosys.tuwien.ac.at) - Apr 16, 1996