STL 6 大组件
6 大组件以及之间的关系
- 容器 containers: 存放元素的容器
- 分配器 allocators :为容器分配内存
- 算法 algorithms : 通过迭代器来操作容器中的元素
- 迭代器 iterators :泛化的指针,pointer-like-class ,类似C中的指针
- 适配器 adapters :对容器,仿函数,迭代器做转换
- 仿函数 functors : C++中使用函数对象,c中使用函数指针
eg 1. application
#include <vector>
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
int main()
{
int arr[6]