The Standard Template Library (STL) is a collection of C++ template classes that provide common data structures and functions in programs, such as lists, stacks, and arrays. It is a container class library including algorithms and iterators. Because it is a generic library, its components are parameterized. Working with STL requires a working knowledge of template classes.
There are 4 types of components:
- Algorithms
- Containers
- Functions
- Iterators
Algorithms
The header algorithm specifies a set of functions that are specifically designed to be applied to a
variety of items. Algorithms act on containers and provide mechanisms for various actions on their contents.
Algorithm
- Sorting
- Searching
- Important STL Algorithms
- Useful Array algorithms
Containers
A container is a containing object that contains a group of other objects (its elements). They are structured as class templates, that provide a considerable deal of flexibility in the types that can be used as elements.
Sequence Containers:
- vector
- list
- deque
- arrays
- forward_list
Container Adaptors:
- queue
- priority_queue
- stack
Associative Containers:
- set
- multiset
- map
- multimap
Unordered Associative Containers:
- unordered_set
- unordered_multiset
- unordered_map
- unordered_multimap
Functions
The STL offers classes that provide function call operator overloading. Functional objects or orders for us to proceed are instances of such classes. Functors allow the associated function's action to be modified by passing parameters.
- Functors
Iterators
Iterators, as the names indicate, are used to work on a series of values. They are the main feature of STL which allows for universality.
0 Comments