C++Primer第四版中文版(电子版)
这是文字完整版的 内容可以粘贴复制,绝对不是扫描的图片书 这是我第一次在网上分享资源,希望对大家有用.呵呵 可以节约几十元钱哦 目录 前言..................................................................................................................................................1 第四版的改动...........................................................................................................................2 本书结构...................................................................................................................................3 致谢..................................... ......................................................................................................4 第一章 快速入门...........................................................................................................................17 1.1. 编写简单的 C++ 程序..........................................................................................17 调用 GNU 或微软编译器....................................................................................................20 Exercises Section 1.1.1 ...........................................................................................................21 1.2. 初窥输入/输出........................................................................................................21 关键概念:已初始化变量和未初始化变量.........................................................................26 Exercises Section 1.2.2 ...........................................................................................................27 1.3. 关于注释.................................................................................................................27 Exercises Section 1.3 ......................................................................................................29 1.4. 控制结构.................................................................................................................29 关键概念:C++ 程序的缩排和格式....................................................................................31 再谈编译.................................................................................................................................34 Exercises Section 1.4.2 ...........................................................................................................35 Exercises Section 1.4.3 ...........................................................................................................37 从键盘输入文件结束符.........................................................................................................39 Exercises Section 1.4.4 ...........................................................................................................39 1.5. 类的简介.................................................................................................................39 关键概念:类定义行为.........................................................................................................42 Exercises Section 1.5.1 ...........................................................................................................43 Exercises Section 1.5.2 ...........................................................................................................45 1.6. C++ 程序................................................................................................................45 Exercises Section 1.6 ..............................................................................................................47 小结.................................................................................................................................47 术语.................................................................................................................................47 第一部分 基本语言.......................................................................................................................54 第二章 变量和基本类型.......................................................................................................55 2.1. 基本内置类型.........................................................................................................55 内置类型的机器级表示.........................................................................................................57 建议:使用内置算术类型.....................................................................................................60 Exercises Section 2.1.2 ...........................................................................................................61 2.2. 字面值常量.............................................................................................................61 建议:不要依赖未定义行为.................................................................................................66 Exercises Section 2.2 ..............................................................................................................67 2.3. 变量.........................................................................................................................67 Exercises Section 2.3 ..............................................................................................................68 关键概念:强静态类型.........................................................................................................69 Exercises Section 2.3.1 ...........................................................................................................70 6 术语:什么是对象?.............................................................................................................71 Exercises Section 2.3.2 ...........................................................................................................73 Exercises Section 2.3.3 ...........................................................................................................77 警告:未初始化的变量引起运行问题.................................................................................78 Exercises Section 2.3.4 ...........................................................................................................79 Exercises Section 2.3.5 ...........................................................................................................81 Exercises Section 2.3.6 ...........................................................................................................84 2.4. const 限定符...........................................................................................................84 Exercises Section 2.4 ..............................................................................................................87 2.5. 引用.........................................................................................................................87 术语:const 引用是指向 const 的引用...........................................................................89 Exercises Section 2.5 ..............................................................................................................90 2.6. typedef 名字............................................................................................................90 2.7. 枚举.........................................................................................................................91 2.8. 类类型.....................................................................................................................93 Exercises Section 2.8 ..............................................................................................................97 2.9. 编写自己的头文件.................................................................................................97 编译和链接多个源文件.........................................................................................................99 Exercises Section 2.9.1 .........................................................................................................102 小结...............................................................................................................................104 术语...............................................................................................................................105 第三章 标准库类型.............................................................................................................112 3.1. 命名空间的 using 声明........................................................................................112 Exercises Section 3.1 ............................................................................................................115 3.2. 标准库 string 类型................................................................................................115 警告:标准库 string 类型和字符串字面值.....................................................................116 Exercises Section 3.2.1 .........................................................................................................116 Exercises Section 3.2.2 .........................................................................................................119 建议:采用 C 标准库头文件的 C++ 版本.........................................................................127 Exercises Section 3.2.4 .........................................................................................................127 3.3. 标准库 vector 类型.............................................................................................127 关键概念:vector 对象动态增长.....................................................................................130 Exercises Section 3.3.1 .........................................................................................................131 关键概念:安全的泛型编程...............................................................................................134 警告:仅能对确知已存在的元素进行下标操作...............................................................135 Exercises Section 3.3.2 .........................................................................................................136 3.4. 迭代器简介...........................................................................................................136 术语:迭代器和迭代器类型...............................................................................................137 Exercises Section 3.4 ............................................................................................................142 Exercises Section 3.4.1 .........................................................................................................143 3.5. 标准库 bitset .........................................................................................................143 Exercises Section 3.5.2 .........................................................................................................150 小结...............................................................................................................................150 术语...............................................................................................................................150 7 第四章 数组和指针.............................................................................................................155 4.1. 数组.......................................................................................................................155 警告:数组的长度是固定的...............................................................................................159 Exercises Section 4.1.1 .........................................................................................................160 Exercises Section 4.1.2 .........................................................................................................162 4.2. 指针的引入...........................................................................................................162 建议:尽量避免使用指针和数组.......................................................................................163 Exercises Section 4.2.2 .........................................................................................................169 关键概念:给指针赋值或通过指针进行赋值...................................................................170 Exercises Section 4.2.3 .........................................................................................................172 Exercises Section 4.2.4 .........................................................................................................177 建议:理解复杂的 const 类型的声明.............................................................................180 Exercises Section 4.3 ............................................................................................................182 4.3. C 风格字符串.......................................................................................................182 Exercises Section 4.3 ............................................................................................................188 C 风格字符串与 C++ 的标准库类型 string 的比较...................................................192 Exercises Section 4.3.1 .........................................................................................................194 Exercises Section 4.3.2 .........................................................................................................196 4.4. 多维数组...............................................................................................................196 Exercises Section 4.4.1 .........................................................................................................200 小结...............................................................................................................................200 术语...............................................................................................................................200 第五章 表达式.....................................................................................................................204 5.1. 算术操作符...........................................................................................................205 警告:溢出和其他算术异常...............................................................................................207 Exercises Section 5.1 ............................................................................................................209 5.2. 关系操作符和逻辑操作符...................................................................................209 Exercises Section 5.2 ............................................................................................................213 5.3. 位操作符...............................................................................................................213 Exercises Section 5.3.1 .........................................................................................................217 5.4. 赋值操作符...........................................................................................................218 Exercises Section 5.4.2 .........................................................................................................221 Exercises Section 5.4.3 .........................................................................................................222 5.5. 自增和自减操作符...............................................................................................222 建议:只有在必要时才使用后置操作符...........................................................................223 建议:简洁即是美...............................................................................................................224 Exercises Section 5.5 ............................................................................................................225 5.6. 箭头操作符...........................................................................................................225 Exercises Section 5.6 ............................................................................................................226 5.7. 条件操作符...........................................................................................................226 Exercises Section 5.7 ............................................................................................................228 5.8. sizeof 操作符........................................................................................................228 Exercises Section 5.8 ............................................................................................................229 5.9. 逗号操作符...........................................................................................................229 8 Exercises Section 5.9 ............................................................................................................230 5.10. 复合表达式的求值.............................................................................................230 Exercises Section 5.10.2 .......................................................................................................236 建议:复合表达式的处理...................................................................................................238 Exercises Section 5.10.3 .......................................................................................................239 5.11. new 和 delete 表达式........................................................................................239 警告:动态内存的管理容易出错.......................................................................................243 Exercises Section 5.11 ..........................................................................................................244 5.12. 类型转换.............................................................................................................244 Exercises Section 5.12.3 .......................................................................................................250 建议:避免使用强制类型转换...........................................................................................253 Exercises Section 5.12.7 .......................................................................................................255 小结...............................................................................................................................255 术语...............................................................................................................................256 第六章 语句.........................................................................................................................261 6.1. 简单语句...............................................................................................................261 6.2. 声明语句...............................................................................................................262 6.3. 复合语句(块)...................................................................................................263 Exercises Section 6.3 ............................................................................................................264 6.4. 语句作用域.........................................................................................................264 6.5. if 语句...................................................................................................................265 Exercises Section 6.5.1 .........................................................................................................270 6.6. switch 语句...........................................................................................................270 Exercises Section 6.6.5 .........................................................................................................278 Code for Exercises in Section 6.6.5 ......................................................................................278 6.7. while 语句.............................................................................................................279 Exercises Section 6.7 ............................................................................................................282 6.8. for 循环语句.........................................................................................................282 Exercises Section 6.8.2 .........................................................................................................286 6.9. do while 语句........................................................................................................286 Exercises Section 6.9 ............................................................................................................289 6.10. break 语句...........................................................................................................289 Exercises Section 6.10 ..........................................................................................................291 6.11. continue 语句......................................................................................................291 Exercises Section 6.11 ..........................................................................................................292 6.12. goto 语句.............................................................................................................292 Exercises Section 6.12 ..........................................................................................................293 6.13. try 块和异常处理...............................................................................................293 Exercises Section 6.13.2 .......................................................................................................297 6.14. 使用预处理器进行调试.....................................................................................299 Exercises Section 6.14 ..........................................................................................................301 小结...............................................................................................................................301 术语...............................................................................................................................302 第七章 函数.........................................................................................................................306 9 7.1. 函数的定义...........................................................................................................306 Exercises Section 7.1.2 .........................................................................................................311 7.2. 参数传递...............................................................................................................311 Exercises Section 7.2.1 .........................................................................................................314 Exercises Section 7.2.2 .........................................................................................................321 Exercises Section 7.2.5 .........................................................................................................328 Exercises Section 7.2.6 .........................................................................................................329 7.3. return 语句............................................................................................................330 Exercises Section 7.3.2 .........................................................................................................337 Exercises Section 7.3.3 .........................................................................................................339 7.4. 函数声明...............................................................................................................339 Exercises Section 7.4 ............................................................................................................341 Exercises Section 7.4.1 .........................................................................................................344 7.5. 局部对象...............................................................................................................344 Exercises Section 7.5.2 .........................................................................................................346 7.6. 内联函数...............................................................................................................346 Exercises Section 7.6 ............................................................................................................348 7.7. 类的成员函数.......................................................................................................348 Exercises Section 7.7.4 .........................................................................................................356 7.8. 重载函数...............................................................................................................356 建议:何时不重载函数名...................................................................................................359 Exercises Section 7.8.1 .........................................................................................................362 Exercises Section 7.8.3 .........................................................................................................366 Exercises Section 7.8.4 .........................................................................................................370 7.9. 指向函数的指针...................................................................................................370 小结...............................................................................................................................374 术语...............................................................................................................................375 第八章 标准 IO 库............................................................................................................379 8.1. 面向对象的标准库...............................................................................................379 Exercises Section 8.1 ............................................................................................................383 8.2. 条件状态...............................................................................................................383 Exercises Section 8.2 ............................................................................................................387 8.3. 输出缓冲区的管理...............................................................................................387 警告:如果程序崩溃了,则不会刷新缓冲区...................................................................388 8.4. 文件的输入和输出...............................................................................................389 警告:C++ 中的文件名......................................................................................................391 Exercises Section 8.4.1 .........................................................................................................394 Exercises Section 8.4.3 .........................................................................................................398 8.5. 字符串流...............................................................................................................398 Exercises Section 8.5 ............................................................................................................401 小结...............................................................................................................................401 术语...............................................................................................................................401 第二部分:容器和算法...............................................................................................................403 第九章. 顺序容器................................................................................................................404 10 9.1. 顺序容器的定义...................................................................................................405 Exercises Section 9.1.1 .........................................................................................................409 Exercises Section 9.1.2 .........................................................................................................411 9.2. 迭代器和迭代器范围...........................................................................................411 Exercises Section 9.2 ............................................................................................................414 对形成迭代器范围的迭代器的要求...................................................................................415 Exercises Section 9.2.1 .........................................................................................................417 9.3. 每种顺序容器都提供了一组有用的类型定义以及以下操作:.......................418 Exercises Section 9.3.1 .........................................................................................................419 关键概念:容器元素都是副本...........................................................................................421 Exercises Section 9.3.3 .........................................................................................................425 Exercises Section 9.3.4 .........................................................................................................427 Exercises Section 9.3.5 .........................................................................................................429 Exercises Section 9.3.6 .........................................................................................................431 Exercises Section 9.3.7 .........................................................................................................434 Exercises Section 9.3.8 .........................................................................................................437 9.4. vector 容器的自增长............................................................................................437 Exercises Section 9.4.1 .........................................................................................................441 9.5. 容器的选用...........................................................................................................441 Exercises Section 9.5 ............................................................................................................444 9.6. 再谈 string 类型.............................................................................................444 Exercises Section 9.6 ....................................................................................................446 Exercises Section 9.6.4 ................................................................................................456 9.7. 容器适配器.........................................................................................................459 Exercises Section 9.7.2 ................................................................................................463 小结...............................................................................................................................463 术语...............................................................................................................................463 第十章 关联容器.................................................................................................................466 10.1. 引言:pair 类型.............................................................................................466 Exercises Section 10.1 ..................................................................................................469 10.2. 关联容器...........................................................................................................469 Exercises Section 10.2 ..................................................................................................470 10.3. map 类型...........................................................................................................470 Exercises Section 10.3.1 ..............................................................................................472 Exercises Section 10.3.2 ..............................................................................................473 Exercises Section 10.3.4 ..............................................................................................475 Exercises Section 10.3.5 ..............................................................................................479 Exercises Section 10.3.6 ..............................................................................................480 Exercises Section 10.3.9 ..............................................................................................485 10.4. set 类型...........................................................................................................485 Exercises Section 10.4 ..................................................................................................486 Exercises Section 10.4.2 ..............................................................................................489 10.5. multimap 和 multiset 类型........................................................................490 Exercises Section 10.5.2 ..............................................................................................494 11 10.6. 容器的综合应用:文本查询程序...................................................................495 Exercises Section 10.6.2 ..............................................................................................498 Exercises Section 10.6.3 ..............................................................................................501 Exercises Section 10.6.4 ..............................................................................................503 小结...............................................................................................................................503 术语...............................................................................................................................504 第十一章 泛型算法.............................................................................................................506 11.1. 概述...................................................................................................................506 Exercises Section 11.1 ..................................................................................................509 关键概念:算法永不执行容器提供的操作.......................................................................509 11.2. 初窥算法...........................................................................................................510 关键概念:迭代器实参类型...............................................................................................512 Exercises Section 11.2.1 ..............................................................................................512 Exercises Section 11.2.2 ..............................................................................................515 Exercises Section 11.2.3 ..............................................................................................521 11.3. 再谈迭代器.......................................................................................................521 Exercises Section 11.3.1 ..............................................................................................523 Exercises Section 11.3.2 ..............................................................................................529 Exercises Section 11.3.3 ..............................................................................................532 关键概念:关联容器与算法...............................................................................................534 Exercises Section 11.3.5 ..............................................................................................535 11.4. 泛型算法的结构...............................................................................................536 Exercises Section 11.4.2 ..............................................................................................539 11.5. 容器特有的算法...............................................................................................539 Exercises Section 11.5 ..................................................................................................541 小结...............................................................................................................................541 术语...............................................................................................................................542 第三部分:类和数据抽象...........................................................................................................545 第十二章 类.........................................................................................................................546 12.1. 类的定义和声明...............................................................................................546 Exercises Section 12.1.1 ..............................................................................................548 建议:具体类型和抽象类型...............................................................................................549 关键概念:数据抽象和封装的好处...................................................................................551 Exercises Section 12.1.2 ..............................................................................................551 Exercises Section 12.1.3 ..............................................................................................555 Exercises Section 12.1.4 ..............................................................................................557 12.2. 隐含的 this 指针...........................................................................................558 建议:用于公共代码的私有实用函数...............................................................................562 Exercises Section 12.2 ..................................................................................................563 12.3. 类作用域...........................................................................................................563 Exercises Section 12.3 ..................................................................................................566 Exercises Section 12.3.1 ..............................................................................................571 12.4. 构造函数...........................................................................................................571 Exercises Section 12.4 ..................................................................................................573 12 建议:使用构造函数初始化列表.......................................................................................577 Exercises Section 12.4.1 ..............................................................................................579 Exercises Section 12.4.2 ..............................................................................................580 Exercises Section 12.4.3 ..............................................................................................583 Exercises Section 12.4.4 ..............................................................................................586 Exercises Section 12.4.5 ..............................................................................................588 12.5. 友元...................................................................................................................588 Exercises Section 12.5 ..................................................................................................591 12.6. static 类成员................................................................................................591 Exercises Section 12.6 ..................................................................................................593 Exercises Section 12.6.1 ..............................................................................................594 Exercises Section 12.6.2 ..............................................................................................597 小结...............................................................................................................................597 术语...............................................................................................................................598 第十三章 复制控制.............................................................................................................601 13.1. 复制构造函数...................................................................................................602 Exercises Section 13.1 ..................................................................................................604 Exercises Section 13.1.2 ..............................................................................................607 13.2. 赋值操作符.......................................................................................................608 Exercises Section 13.2 ..................................................................................................610 13.3. 析构函数...........................................................................................................611 Exercises Section 13.3 ..................................................................................................613 13.4. 消息处理示例...................................................................................................614 Exercises Section 13.4 ..................................................................................................620 13.5. 管理指针成员...................................................................................................620 Exercises Section 13.5 ..................................................................................................623 建议:管理指针成员...........................................................................................................628 Exercises Section 13.5.1 ..............................................................................................629 Exercises Section 13.5.2 ..............................................................................................631 小结...............................................................................................................................632 术语...............................................................................................................................632 第十四章 重载操作符与转换.............................................................................................635 14.1. 重载操作符的定义.............................................................................................635 习题 14.1..............................................................................................................................640 警告:审慎使用操作符重载...............................................................................................642 Exercises Section 14.1.1 .......................................................................................................643 14.2. 输入和输出操作符.............................................................................................643 Exercises Section 14.2.1 .......................................................................................................646 Exercises Section 14.2.2 ..............................................................................................649 14.3. 算术操作符和关系操作符.................................................................................649 Exercises Section 14.3 ..........................................................................................................651 14.4. 赋值操作符.........................................................................................................652 Exercises Section 14.4 ..........................................................................................................654 14.5. 下标操作符.........................................................................................................654 13 Exercises Section 14.5 ..........................................................................................................656 14.6. 成员访问操作符.................................................................................................656 Exercises Section 14.6 ..........................................................................................................660 14.7. 自增操作符和自减操作符.................................................................................660 Exercises Section 14.7 ..........................................................................................................665 14.8. 调用操作符和函数对象.....................................................................................665 Exercises Section 14.8 ..........................................................................................................666 Exercises Section 14.8.1 .......................................................................................................669 Exercises Section 14.8.3 ..............................................................................................672 14.9. 转换与类类型.....................................................................................................673 Exercises Section 14.9.2 .......................................................................................................679 警告:避免转换函数的过度使用.......................................................................................684 Exercises Section 14.9.4 .......................................................................................................688 警告:转换和操作符...........................................................................................................690 Exercises Section 14.9.5 .......................................................................................................692 小结...............................................................................................................................692 术语...............................................................................................................................693 第四部分:面向对象编程与泛型编程.......................................................................................695 第十五章. 面向对象编程...................................................................................................696 15.1. 面向对象编程:概述.........................................................................................696 15.2. 定义基类和派生类.............................................................................................698 Exercises Section 15.2.1 .......................................................................................................701 关键概念:类设计与受保护成员.......................................................................................702 Exercises Section 15.2.3 .......................................................................................................707 关键概念:C++ 中的多态性..............................................................................................710 Exercises Section 15.2.4 .......................................................................................................713 关键概念:继承与组合.......................................................................................................716 Exercises Section 15.2.5 .......................................................................................................719 Exercises Section 15.2.7 .......................................................................................................721 15.3. 转换与继承.........................................................................................................721 15.4. 构造函数和复制控制.........................................................................................725 关键概念:重构...................................................................................................................729 关键概念:尊重基类接口...................................................................................................730 Exercises Section 15.4.2 .......................................................................................................731 Exercises Section 15.4.4 .......................................................................................................736 15.5. 继承情况下的类作用域.....................................................................................737 Exercises Section 15.5.1 .......................................................................................................738 Exercises Section 15.5.2 .......................................................................................................740 关键概念:名字查找与继承...............................................................................................743 Exercises Section 15.5.4 ..............................................................................................744 15.6. 纯虚函数.............................................................................................................745 Exercises Section 15.6 ..........................................................................................................746 15.7. 容器与继承.........................................................................................................746 Exercises Section 15.7 ..........................................................................................................747 14 15.8. 句柄类与继承.....................................................................................................747 Exercises Section 15.8.2 .......................................................................................................753 Exercises Section 15.8.3 .......................................................................................................758 15.9. 再谈文本查询示例.............................................................................................758 Exercises Section 15.9.2 .......................................................................................................764 Exercises Section 15.9.5 .......................................................................................................772 Exercises Section 15.9.6 .......................................................................................................774 小结...............................................................................................................................774 术语...............................................................................................................................775 第十六章 模板和泛型编程.................................................................................................778 16.1. 模板定义.............................................................................................................778 Exercises Section 16.1.1 .......................................................................................................781 Exercises Section 16.1.2 .......................................................................................................783 Exercises Section 16.1.3 .......................................................................................................786 Exercises Section 16.1.4 .......................................................................................................789 Exercises Section 16.1.5 .......................................................................................................790 Exercises Section 16.1.6 .......................................................................................................792 警告:链接时的编译时错误...............................................................................................793 16.2. 实例化.................................................................................................................793 Exercises Section 16.2.1 .......................................................................................................801 Exercises Section 16.2.2 ..............................................................................................804 16.3. 模板编译模型.....................................................................................................804 Exercises Section 16.3 ..........................................................................................................807 警告:类模板中的名字查找...............................................................................................808 16.4. 类模板成员.........................................................................................................808 Exercises Section 16.4 ..........................................................................................................813 Exercises Section 16.4.1 .......................................................................................................818 Exercises Section 16.4.2 .......................................................................................................820 Exercises Section 16.4.4 .......................................................................................................826 Exercises Section 16.4.6 .......................................................................................................832 16.5. 一个泛型句柄类.................................................................................................833 Exercises Section 16.5.1 .......................................................................................................836 Exercises Section 16.5.2 .......................................................................................................839 16.6. 模板特化.............................................................................................................839 Exercises Section 16.6.1 .......................................................................................................843 Exercises Section 16.6.2 .......................................................................................................846 Exercises Section 16.6.3 .......................................................................................................848 16.7. 重载与函数模板.................................................................................................849 Exercises Section 16.7 ..........................................................................................................853 小结...............................................................................................................................853 术语...............................................................................................................................854 第五部分 高级主题...................................................................................................................857 第十七章 用于大型程序的工具.......................................................................................858 17.1. 异常处理.............................................................................................................858 15 Exercises Section 17.1.1 .......................................................................................................862 Exercises Section 17.1.3 .......................................................................................................866 Exercises Section 17.1.5 .......................................................................................................869 Exercises Section 17.1.8 .......................................................................................................874 Exercises Section 17.1.9 .......................................................................................................881 警告:Auto_ptr 缺陷.........................................................................................................882 Exercises Section 17.1.11......................................................................................................888 17.2. 命名空间...........................................................................................................888 Exercises Section 17.2.1 ..............................................................................................894 Exercises Section 17.2.2 ..............................................................................................895 未命名的命名空间取代文件中的静态声明.......................................................................897 Exercises Section 17.2.3 ..............................................................................................897 Exercises Section 17.2.4 ..............................................................................................902 警告:避免 Using 指示.....................................................................................................903 Exercises Section 17.2.6 ..............................................................................................910 17.3. 多重继承与虚继承...........................................................................................911 Exercises Section 17.3.1 ..............................................................................................913 Exercises Section 17.3.2 ..............................................................................................915 Exercises Section 17.3.2 ..............................................................................................917 本节习题的代码...................................................................................................................920 Exercises Section 17.3.4 ..............................................................................................921 Exercises Section 17.3.6 ..............................................................................................926 Exercises Section 17.3.7 ..............................................................................................929 小结...............................................................................................................................930 术语...............................................................................................................................931 第十八章 特殊工具与技术.................................................................................................936 18.1. 优化内存分配...................................................................................................936 Exercises Section 18.1.2 ..............................................................................................942 术语对比:new 表达式与 operator new 函数..............................................................942 Exercises Section 18.1.4 ..............................................................................................945 Exercises Section 18.1.5 ..............................................................................................946 Exercises Section 18.1.6 ..............................................................................................949 Exercises Section 18.1.7 ..............................................................................................955 18.2. 运行时类型识别...............................................................................................956 Exercises Section 18.2.1 ..............................................................................................959 Exercises Section 18.2.2 ..............................................................................................961 Exercises Section 18.2.4 ..............................................................................................966 18.3. 类成员的指针...................................................................................................966 Exercises Section 18.3.1 ..............................................................................................969 Exercises Section 18.3.2 ..............................................................................................973 18.4. 嵌套类...............................................................................................................973 Exercises Section 18.4.2 ..............................................................................................979 18.5. 联合:节省空间的类.......................................................................................980 18.6. 局部类...............................................................................................................983 16 18.7. 固有的不可移植的特征...................................................................................985 对链接到 C 的预处理器支持.............................................................................................992 Exercises Section 18.7.3 ..............................................................................................994 小结...............................................................................................................................994 术语...............................................................................................................................995 附录 A. 标准库..........................................................................................................................999 A.1. 标准库名字和头文件................................................................................................1000 A.2. 算法简介..................................................................................................................1003 A.2.1. 查找对象的算法...........................................................................................1003 A.2.2. 其他只读算法...............................................................................................1005 A.2.3. 二分查找算法...............................................................................................1006 A.2.4. 写容器元素的算法.......................................................................................1006 A.2.5. 划分与排序算法...........................................................................................1008 A.2.
用户评论