C++ Standard Library => C++标准库
Standerd Template Library => STL => 标准模板库
C++标准库 包含 STL
标准库以 Header File 形式呈现
#include <vector>#include <cmath>#include <stdio.h>namespace stdnamespace std 中#include <string>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
不推荐在项目中直接使用
using namespace std这样会失去名空间的作用
STL六大部件
#include <vector>
#include <algorithm>
#include <iostream>
#include <functional>
using namespace std;
int main() {
int ia[6] = {-1, 5, 6, 1, 2, 3};
// vector 容器
// allocator 分配器
vector<int, allocator<int>> vi(ia, ia+6);
// count_if 属于 algorithm 算法模块
// vi.end() 和 vi.begin() 属于 iterator 迭代器
// bind2nd 属于 function adapter 函数适配器
// less<int>() 仿函数
// not1 function adapter 函数适配器
// 输出 等于等于 4 的数的个数
cout << count_if(vi.begin(), vi.end(), not1(bind2nd(less<int>(), 4)));
return 0;
}