4. STL (Standard Template Library) Algorithms Container Classes A library of class and function templates based on work in generic programming done by Alex Stepanov and Meng Lee of the Hewlett Packard Laboratories in the early 1990s. vector sort() begin() end() Iterates
5.
6.
7.
8. STL's Containers In 1994, STL was adopted as a standard part of C++. There are some containers in STL: Kind of Container STL Containers Sequential: deque , list , vector Associative: map , multimap , multiset , set Adapters: priority_queue , queue , stack Non-STL: bitset , valarray , string
9.
10. Sequence Containers Ex. vector<int> v1; vector<int>iterator iter; Random Quick random access, slow insertion/deletion in middle, size can not be changed at runtime array Iterator Description Container Random Double ended queue, direct access, slow insert/delete in middle, fast at beg/ end deque Bidir. Doubly link list, fast insert/delete anywhere, slow random access list Random Dynamic array, quick random access, slow insertion/deletion in middle, fast at back vector
12. Derived Containers/Container Adapters Ex. stack <deque<int> > s1; Iterator Description Container None Element of highest priority popped. Create from vector or dequeue Priority -queue None FIFO. Create from list or dequeue Queue None LIFO. Create from vector, list or dequeue Stack