2. Introduction to the STL:
The STL contains several kinds of entities. The three most
important are containers, algorithms, and iterators.
• A container is a way that stored data is organized in
memory. E.g. stacks, linked lists, array etc.
• Sequence - vector, list, and deque uses keys
• Associative - set, multiset, map, multi-map uses tree and
key –value pair to access the values
• Derived Sequence Containers - stack, queue, and priority
queue
• Algorithms in the STL are procedures that are applied to
containers to process their data in various ways e.g.
sort, copy, search and merge data.
• Iterators are a generalization of the concept of
pointers: they point to elements in a container.
6. Iterators:
• Iterators are pointer-like entities that are used to
access individual data items called elements.
• They are used to move sequentially from element
to element, a process called iterating through the
container. Incrimination in the iterators is done
with the ++ operator to point to the next element
and dereference it with the * operator to obtain
the value of the element they point to.
• There are three major classes of iterators:
forward using ++ operators, bidirectional using ++
and -- Operators and random access to jump to
any location.
• Two specialized kinds of iterators are also used
• An input iterator to read sequential data items into
a container from an input device.
• An output iterator can “point to” an output device
and write elements from a container to the device.