《目录》
目 录
Generic Programming.........................................................................................................................I
第 1 讲 初识 STL...............................................................................................................................1
§1.1 什么是泛型程序设计........................................................................................................1
§1.2 什么是 STL........................................................................................................................1
§1.3 STL 的核心组件................................................................................................................2
§1.3.1 容器(container) 3
§1.3.2 算法(algorithm) 4
§1.3.3 迭代器(Iterrator) 5
§1.3.4 函数对象(function object) 5
§1.3.5 容器、迭代器、算法和函数对象之间的关系 8
§1.4 建立 STL 程序的方法.......................................................................................................8
第 2 讲 STL 容器.............................................................................................................................11
§2.1 序列式容器......................................................................................................................11
§2.1.1 Vectors 11
§2.1.2 Deques 20
§2.1.3 Lists 24
§2.2 关联式容器......................................................................................................................30
§2.2.1 操作 Set 和 Multisets 的成员函数及算法 31
§2.2.2 Set 和 Multisets 应用实例 32
§2.2.3 操作 Maps 和 Multimaps 的成员函数 33
§2.2.4 Maps 和 Multimaps 应用实例 35
§2.3 特殊容器——顺序容器配接器......................................................................................39
§2.3.1 Stack(栈) 39
§2.3.2 Queue(队列) 40
§2.3.3 Priority Queues(优先级队列) 42
§2.4 Strings 可以视为一种 STL 容器.....................................................................................43
第 3 讲 STL 迭代器.........................................................................................................................46
§3.1 迭代器..............................................................................................................................46
§3.2 迭代器的分类(Iterator Categorise).................................................................................48
§3.3 迭代器的算术操作..........................................................................................................49
§3.4 迭代器的区间..................................................................................................................50
§3.5 迭代器的辅助函数..........................................................................................................51
§3.5.1 函数 advance(p, n) 51
§3.5.2 函数 distance(first, last) 52
§3.5.3 函数 Iter_swap(p1,p2) 53
§3.6 迭代器适配器(Iterator Adapters)....................................................................................54
§3.6.1 Insert Iterators(安插型迭代器) 54
§3.6.2 Stream Iterators(流迭代器) 56
§3.6.3 Reverse Iterators(逆向迭代器) 58
第 4 讲 STL 函数对象.....................................................................................................................60
- I -