What is the STL in C++?
The STL has three main parts:
- Containers:
vector,list,map,set,unordered_map,stack,queue. - Iterators: objects which point to the items of a container.
- Algorithms:
sort,find,count,transform,accumulateand many more.
#include <algorithm>
#include <iostream>
#include <vector>
int main() {
std::vector<int> v = {4, 1, 3};
std::sort(v.begin(), v.end());
for (int x : v) std::cout << x << ' ';
std::cout << '\n';
}
Output
1 3 4
See STL Containers and Algorithms.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |