侯捷-STL与泛型编程(GP)笔记

1.stl体系结构基础介绍
侯捷-STL与泛型编程(GP)笔记
分配器(allocator):主管分配内存
适配器(adaptor):进行一个转换,与另一个对象绑定

#include<iostream>
#include<algorithm>//算法
#include<functional>//仿函数
#include<vector>//container:向量
using namespace std;
int main()
{
	int ia[6] = { 27,210,12,47,109,83 };
	vector<int, allocator<int>> vi(ia, ia + 6);//容器,分配器
	cout << count_if(vi.begin(), vi.end(),//算法,迭代器,
		not1(bind2nd(less<int>(), 40)));//仿函数适配器,仿函数,
	system("pause");
	return 0;
}

侯捷-STL与泛型编程(GP)笔记
侯捷-STL与泛型编程(GP)笔记

int main()
{
	for (int i : {2, 3, 4, 5, 6, 9, 7})//for(decl:coll)
	{                                 //{     statement      }
		cout << i << endl;
	}
	system("pause");
	return 0;
}

侯捷-STL与泛型编程(GP)笔记