6.1 STL
6.1 STL
--Prof. S.N.Shelke
Syllabus- Unit 6
adapters,
Application of Container classes: vector, list,
Containers
Algorithms
Iterators
array of elements.
Algorithms in the STL are procedures that are applied to containers to process
their data, for example search for an element in an array, or sort an array.
Iterators are a generalization of the concept of pointers, they point to elements in
a container, for example you can increment an iterator to point to the next element
in an array
Containers, Iterators, Algorithms
Container Container
Iterator
Algorithm
Objects Iterator
Algorithm
Iterator Iterator
Algorithm
Containers
A container is a way to store data, either built-in data types like int and
float, or class objects
The STL provides several basic kinds of containers
<vector> : one-dimensional array
<list> : double linked list
<deque> : double-ended queue
<queue> : queue
<stack> : stack
<set> : set
<map> : associative array
Header
Container Description iterator
file
vector is a class that creates a dynamic array allowing
vector <vector> Random access
insertions and deletions at the back.
set set is an associate container for storing unique sets. <set> Bidirectional
STL containers are implemented by template classes and therefore can be easily
words each element (except for the first and last one) is preceded by
one specific element and followed by another, <vector>, <list> and
<deque> are sequential containers
In an ordinary C++ array the size is fixed and can not change during
<vector> is an expandable array that can shrink or grow in size, but still
<list> is a double linked list (each element has points to its successor