| 作者 |
| [美]本贾尼·斯特劳斯特鲁普(Bjarne Stroustrup) |
| 丛书名 |
| 经典原版书库 |
| 出版社 |
| 机械工业出版社 |
| ISBN |
| 9787111615644 |
| 简要 |
| 简介 |
| 内容简介书籍计算机书籍 在这本中,作者把C++完整参考手册中的综述内容摘取出来,并且进行必要的扩充和提升,目的是让有经验的程序员在很短时间之内就能清晰地了解到是哪些元素构成了现代的C++语言。本书虽薄,结构却清晰完整,作者在书中介绍了C++语言的绝大多数特性以及最重要的一些标准库组件。尤其难能可贵的是,虽然受篇幅所限无法对每个知识点展开深入讲解,但依然能够帮助程序员了解语言的全貌,并给出一些关键示例,便于他们更好地学习和使用C++语言。 |
| 目录 |
| 第1章 基础知识 1 1.1 引言 1 1.2 程序 2 1.3 函数 4 1.4 类型、变量和算术运算 5 1.5 作用域和生命周期 9 1.6 常量 9 1.7 指针、数组和引用 11 1.8 测试 14 1.9 映射到硬件 16 1.10 建议 18 第2章 用户自定义类型 21 2.1 引言 21 2.2 结构 22 2.3 类 23 2.4 联合 25 2.5 枚举 26 2.6 建议 27 第3章 模块化 29 3.1 引言 29 3.2 分别编译 30 3.3 模块(C++20) 32 3.4 名字空间 34 3.5 错误处理 35 3.6 函数参数和返回值 36 3.7 建议 46 第4章 类 47 4.1 引言 47 4.2 具体类型 48 4.3 抽象类型 54 4.4 虚函数 …56 4.5 类层次 …57 4.6 建议 63 第5章 基本操作 65 5.1 引言 65 5.2 拷贝和移动 68 5.3 资源管理 72 5.4 常规操作 74 5.5 建议 77 第6章 模板 79 6.1 引言 79 6.2 参数化类型 79 6.3 参数化操作 84 6.4 模板机制 89 6.5 建议 92 第7章 概念与泛型编程 93 7.1 引言 93 7.2 概念 94 7.3 泛型编程 98 7.4 可变参数模板 100 7.5 模板编译模式 104 7.6 建议 104 第8章 标准库概览 107 8.1 介绍 107 8.2 标准库组件 108 8.3 标准库头文件和名字空间 109 8.4 建议 110 第9章 字符串和正则表达式 111 9.1 介绍 111 9.2 字符串 111 9.3 字符串视图 114 9.4 正则表达式 116 9.5 建议 122 第10章 输入输出 123 10.1 介绍 123 10.2 输出 123 10.3 输入 125 10.4 I/O状态 127 10.5 用户自定义类型的I/O 128 10.6 格式化 129 10.7 文件流 130 10.8 字符串流 130 10.9 C风格I/O 131 10.10 文件系统 132 10.11 建议 136 第11章 容器 137 11.1 介绍 137 11.2 vector 138 11.3 list 142 11.4 map 144 11.5 unordered_map 144 11.6 容器概览 146 11.7 建议 148 第12章 算法 149 12.1 介绍 149 12.2 使用迭代器 150 12.3 迭代器类型 153 12.4 流迭代器 154 12.5 谓词 155 12.6 算法概览 156 12.7 概念(C++20) 157 12.8 容器算法 160 12.9 并行算法 161 12.10 建议 161 第13章 实用工具 163 13.1 引言 163 13.2 资源管理 164 13.3 范围检查:span 168 13.4 特殊容器 170 13.5 替代选择 174 13.6 分配器 178 13.7 时间 179 13.8 函数适配 180 13.9 类型函数 181 13.10 建议 185 第14章 数值 187 14.1 引言 187 14.2 数学函数 188 14.3 数值算法 189 14.4 复数 190 14.5 随机数 191 14.6 向量算术 192 14.7 数值限制 193 14.8 建议 193 第15章 并发 195 15.1 引言 195 15.2 任务和thread 196 15.3 传递参数 197 15.4 返回结果 198 15.5 共享数据 199 15.6 等待事件 200 15.7 任务通信 202 15.8 建议 205 第16章 历史和兼容性 207 16.1 历史 207 16.2 C++特性演化 214 16.3 C/C++兼容性 218 16.4 参考文献 222 16.5 建议 225 Contents ContentsPreface 1The Basics1 1.1 Introduction........................................ 1 1.2 Programs........................................ 2 1.3 Functions........................................ 4 1.4 Types, Variables, and Arithmetic.......................... 5 1.5 Scopeand Lifetime........................................ 9 1.6 Constants........................................ 9 1.7 Pointers,Arrays, and References.......................... 11 1.8 Tests ........................................14 1.9 Mappingto Hardware ........................................16 1.10 Advice........................................ 18 2User-Defined ypes 21 2.1 Introduction..................................... 21 2.2 Structures........................................ 22 2.3 Classes........................................ 23 2.4 Unions........................................ 25 2.5 Enumerations........................................ 26 2.6 Advice........................................ 27 3Modularity 29 3.1 Introduction........................................ 29 3.2 SeparateCompilation ........................................30 3.3 Modules(C++20) ........................................32 3.4 Namespaces........................................ 34 3.5 ErrorHandling ........................................35 3.6 FunctionArguments and Return Values .....................................36 3.7 Advice........................................ 46 4Classes 47 4.1 Introduction........................................ 47 4.2 ConcreteTypes ........................................48 4.3 AbstractTypes ........................................54 4.4 Virtual Functions........................................ 56 4.5 ClassHierarchies ........................................57 4.7 Advice........................................ 63 5Essential Operations65 5.1 Introduction........................................ 65 5.2 Copyand Move ........................................ 68 5.3 ResourceManagement ........................................72 5.4 Conventional Operations....................................... 74 5.5 Advice........................................ 77 6Templates 79 6.1 Introduction........................................ 79 6.2 Parameterized Types ........................................79 6.3 Parameterized Operations..................................... 84 6.4 Template Mechanisms........................................ 89 6.5 Advice........................................ 92 7Concepts and Generic Programming 93 7.1 Introduction........................................ 93 7.2 Concepts........................................ 94 7.3 GenericProgramming ........................................98 7.4 Variadic Templates ........................................100 7.5 Template Compilation Model............................... 104 7.6 Advice........................................ 104 8Library Overview 107 8.1 Introduction........................................ 107 8.2 Standard-LibraryComponents ..............................108 8.3 Standard-LibraryHeaders and Namespace................................. 109 8.4 Advice........................................ 110 9Strings and Regular Expressions 111 9.1 Introduction........................................ 111 9.2 Strings........................................ 111 9.3 StringViews........................................ 114 9.4 Regular Expressions........................................ 116 9.5 Advice........................................ 122 10 Input and Output123 10.1 Introduction........................................ 123 10.2 Output........................................ 123 10.3 Input........................................ 125 10.4 I/OState ........................................127 10.5 I/Oof User-Defined ypes ....................................128 10.6 Formatting ........................................129 10.7 FileStreams ........................................130 10.8 StringStreams ........................................130 10.9 C-styleI/O ........................................131 10.10 FileSystem ........................................132 10.11 Advice........................................ 136 11 Containers137 11.1 Introduction........................................ 137 11.2vector........................................ 138 11.3list........................................ 142 11.4map........................................ 144 11.5unordered_map........................................ 144 11.6 ContainerOverview........................................ 146 11.7 Advice........................................ 148 12 Algorithms149 12.1 Introduction........................................ 149 12.2 Useof Iterators........................................ 150 12.3 IteratorTypes ........................................153 12.4 StreamIterators ........................................154 12.5 Predicates........................................ 155 12.6 AlgorithmOverview........................................ 156 12.7 Concepts(C++20) ........................................157 12.8 ContainerAlgorithms ........................................160 12.9 Parallel Algorithms........................................ 161 12.10 Advice........................................ 161 13 Utilities163 13.1 Introduction........................................ 163 13.2 ResourceManagement ........................................164 13.3 RangeChecking:span........................................ 168 13.4 SpecializedContainers ........................................170 13.5 Alternatives........................................ 174 13.6 Allocators........................................ 178 13.7 Time ........................................179 13.8 FunctionAdaption ........................................180 13.9 Type Functions........................................ 181 13.10 Advice........................................ 185 14 Numerics187 14.1 Introduction........................................ 187 14.2 MathematicalFunctions ........................................188 14.3 NumericalAlgorithms ........................................189 14.4 ComplexNumbers ........................................190 14.5 RandomNumbers ........................................191 14.6 Vector Arithmetic........................................ 192 14.7 NumericLimits ........................................193 14.8 Advice........................................ 193 15 Concurrency 195 15.1 Introduction........................................ 195 15.2 Tasks andthreads........................................ 196 15.3 Passing Arguments ........................................197 15.4 ReturningResults ........................................198 15.5 SharingData ........................................199 15.6 Waiting for Events ........................................200 15.7 CommunicatingTasks ........................................202 15.8 Advice........................................ 205 16 History and Compatibility207 16.1 History........................................ 207 16.2 C++Feature Evolution ........................................214 16.3 C/C++Compatibility ........................................218 16.4 Bibliography........................................ 222 16.5 Advice........................................ 225 Index 227 |