Skip to content

Commit f0804bd

Browse files
committed
book: complete and register Appendix 3 (feature index)
Turn the orphan zh-only appendix3 into a complete, version-grouped feature index (C++11/14, C++17, C++20, C++23, C++26) mapping each feature to its chapter; add the English version; register it in website/filter.py and both toc.md; fix the order collision (now 15); and fix a pre-existing broken appendix2 nav link (./11-appendix1.md -> ./appendix1.md). Referenced by the new 'How to read this book' section.
1 parent 6ba0b45 commit f0804bd

7 files changed

Lines changed: 183 additions & 33 deletions

File tree

book/en-us/appendix2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A consistent style makes a codebase far easier to read and maintain:
5555
- Prefer the standard library over platform-specific APIs (e.g. `<filesystem>`, `<thread>`, `<chrono>`) so the same code builds across platforms.
5656
- When byte order matters, query it explicitly (`std::endian` in C++20) rather than assuming little- or big-endian.
5757

58-
[Table of Content](./toc.md) | [Previous Chapter](./appendix1.md)
58+
[Table of Content](./toc.md) | [Previous Chapter](./appendix1.md) | [Next Chapter: Modern C++ Feature Index](./appendix3.md)
5959

6060
## Licenses
6161

book/en-us/appendix3.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
title: "Appendix 3: Modern C++ Feature Index"
3+
type: book-en-us
4+
order: 15
5+
---
6+
7+
# Appendix 3: Modern C++ Feature Index
8+
9+
This appendix groups the main features covered in this book by standard version and notes the chapter where each appears, so you can browse "by version" or quickly locate a feature later. If you are already familiar with the content of a given version, feel free to jump straight to the section you need.
10+
11+
## C++11 / C++14
12+
13+
| Feature | Chapter |
14+
|:--------|:--------|
15+
| `nullptr` | Chapter 2 |
16+
| `constexpr` (relaxed in C++14) | Chapter 2 |
17+
| Initializer lists (`std::initializer_list`) | Chapter 2 |
18+
| `auto` type deduction | Chapter 2 |
19+
| `decltype` / `decltype(auto)` (C++14) | Chapter 2 |
20+
| Tail return type | Chapter 2 |
21+
| Range-based for loop | Chapter 2 |
22+
| External / alias / default / variadic templates | Chapter 2 |
23+
| Delegating and inheriting constructors | Chapter 2 |
24+
| Explicit `override` / `final` | Chapter 2 |
25+
| Explicit `= default` / `= delete` | Chapter 2 |
26+
| Strongly-typed enums (`enum class`) | Chapter 2 |
27+
| SFINAE and `std::enable_if` | Chapter 2 |
28+
| Lambda expressions, generic lambdas (C++14) | Chapter 3 |
29+
| `std::function`, `std::bind` | Chapter 3 |
30+
| Rvalue references, move semantics, perfect forwarding | Chapter 3 |
31+
| `std::array`, `std::forward_list`, unordered containers, `std::tuple` | Chapter 4 |
32+
| Smart pointers `shared_ptr` / `unique_ptr` / `weak_ptr`, `make_unique` (C++14) | Chapter 5 |
33+
| Regular expressions (`std::regex`) | Chapter 6 |
34+
| Threads, mutexes, futures, condition variables, atomics & memory model | Chapter 7 |
35+
| `long long`, `noexcept`, raw/user-defined literals, memory alignment | Chapter 9 |
36+
37+
## C++17
38+
39+
| Feature | Chapter |
40+
|:--------|:--------|
41+
| Structured bindings | Chapter 2 |
42+
| `if` / `switch` init-statements | Chapter 2 |
43+
| `if constexpr` | Chapter 2 |
44+
| Fold expressions, `auto` non-type template parameters | Chapter 2 |
45+
| Inline variables, nested namespaces, `constexpr` lambda | Chapter 2 |
46+
| Single-argument `static_assert`, new aggregate rules | Chapter 2 |
47+
| Boolean logic metafunctions, `__has_include` | Chapter 2 |
48+
| Guaranteed copy elision | Chapter 3 |
49+
| `std::string_view`, `std::byte` | Chapter 4 |
50+
| Associative container improvements (`try_emplace` / `merge` …), `std::pmr` | Chapter 4 |
51+
| `std::filesystem` | Chapter 8 |
52+
| `new` for over-aligned types | Chapter 9 |
53+
| Mathematical special functions | Chapter 9 |
54+
55+
## C++20
56+
57+
| Feature | Chapter |
58+
|:--------|:--------|
59+
| Concepts and constraints | Chapter 10 |
60+
| Modules | Chapter 10 |
61+
| Ranges | Chapter 10 |
62+
| Coroutines | Chapter 10 |
63+
| `std::bit_cast` | Chapter 9 |
64+
65+
## C++23
66+
67+
| Feature | Chapter |
68+
|:--------|:--------|
69+
| Deducing `this` (explicit object parameter) | Chapter 11 |
70+
| `if consteval`, multidimensional subscript | Chapter 11 |
71+
| `auto(x)`, static `operator()`, `[[assume]]` | Chapter 11 |
72+
| `std::expected` | Chapter 11 |
73+
| `std::print` / `std::println` | Chapter 11 |
74+
| `std::mdspan`, `std::flat_map` / `std::flat_set` | Chapter 11 |
75+
| Ranges additions (`zip` …), `string::contains`, `std::byteswap` | Chapter 11 |
76+
77+
## C++26 (outlook)
78+
79+
| Feature | Chapter |
80+
|:--------|:--------|
81+
| Static reflection | Chapter 12 |
82+
| Contracts | Chapter 12 |
83+
| Pack indexing, `= delete` with a reason, the placeholder `_` | Chapter 12 |
84+
| `std::execution` (senders / receivers) | Chapter 12 |
85+
| Saturation arithmetic | Chapter 12 |
86+
87+
[Table of Content](./toc.md) | [Previous Chapter](./appendix2.md)
88+
89+
## Licenses
90+
91+
<a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This work was written by [Ou Changkun](https://changkun.de) and licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>. The code of this repository is open sourced under the [MIT license](../../LICENSE).

book/en-us/toc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
- Other library facilities
128128
- [**Appendix 1: Further Study Materials**](./appendix1.md)
129129
- [**Appendix 2: Modern C++ Best Practices**](./appendix2.md)
130+
- [**Appendix 3: Modern C++ Feature Index**](./appendix3.md)
130131

131132
Table of Content | Last Chapter | [Next Chapter: Preface](./00-preface.md)
132133

book/zh-cn/appendix2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ order: 14
5555
- 优先使用标准库而非平台特定的 API(例如 `<filesystem>``<thread>``<chrono>`),让同一份代码可以跨平台构建。
5656
- 当字节序很重要时,显式地查询它(C++20 的 `std::endian`),而不是假设是小端或大端。
5757

58-
[返回目录](./toc.md) | [上一章](./11-appendix1.md)
58+
[返回目录](./toc.md) | [上一章](./appendix1.md) | [下一章 现代 C++ 特性索引](./appendix3.md)
5959

6060
## 许可
6161

book/zh-cn/appendix3.md

Lines changed: 87 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,93 @@
11
---
22
title: 附录 3:现代 C++ 特性索引
33
type: book-zh-cn
4-
order: 13
4+
order: 15
55
---
66

7-
# 附录 3:现代 C++ 特性索引表
8-
9-
| 特性概述 | 首次出现章节 | 首次出现版本 |
10-
|:--------|:-----------|:----------|
11-
| 概念(Concept) | 第二章 | C++20 |
12-
| 模板参数推导 | | C++17 |
13-
| 非类型模板参数的 auto 推导 | | C++17 |
14-
| 折叠表达式 | | C++17 |
15-
| 花括号初始化列表的 auto 推导 | | C++17 |
16-
| constexpr lambda | | C++17 |
17-
| lambda 表达式的 this 值捕获 | | C++17 |
18-
| 内联变量 | | C++17 |
19-
| 嵌套 namespace | | C++17 |
20-
| 结构化绑定 | | C++17 |
21-
| 带初始值的 switch 语句 | | C++17 |
22-
| constexpr if | | C++17 |
23-
| UTF-8 字符字面量 | | C++17 |
24-
| 枚举的直接初始化列表 | | C++17 |
25-
| attributes | | C++17 |
26-
| `std::variant` | | C++17 |
27-
| `std::optional` | | C++17 |
28-
| `std::any` | | C++17 |
29-
| `std::string_view` | | C++17 |
30-
| `std::invoke` | | C++17 |
31-
| `std::apply` | | C++17 |
32-
| `std::filesystem` | | C++17 |
33-
| `std::byte` | | C++17 |
34-
| map 和 set 的拼接 | | C++17 |
35-
| 并行算法 | | C++17 |
7+
# 附录 3:现代 C++ 特性索引
368

9+
本附录按标准版本归纳了本书介绍的主要特性,并标注了它们所在的章节,便于你「按版本查阅」或日后快速定位某个特性。如果你已经熟悉某个版本之前的内容,可以直接跳到对应的小节。
10+
11+
## C++11 / C++14
12+
13+
| 特性 | 所在章节 |
14+
|:----|:--------|
15+
| `nullptr` | 第 2 章 |
16+
| `constexpr`(C++14 放宽) | 第 2 章 |
17+
| 初始化列表 `std::initializer_list` | 第 2 章 |
18+
| `auto` 类型推导 | 第 2 章 |
19+
| `decltype` / `decltype(auto)`(C++14) | 第 2 章 |
20+
| 尾返回类型 | 第 2 章 |
21+
| 基于范围的 for 循环 | 第 2 章 |
22+
| 外部模板、别名模板、默认模板参数、变长参数模板 | 第 2 章 |
23+
| 委托构造、继承构造 | 第 2 章 |
24+
| 显式 `override` / `final` | 第 2 章 |
25+
| 显式 `= default` / `= delete` | 第 2 章 |
26+
| 强类型枚举 `enum class` | 第 2 章 |
27+
| SFINAE 与 `std::enable_if` | 第 2 章 |
28+
| Lambda 表达式、泛型 Lambda(C++14) | 第 3 章 |
29+
| `std::function``std::bind` | 第 3 章 |
30+
| 右值引用、移动语义、完美转发 | 第 3 章 |
31+
| `std::array``std::forward_list`、无序容器、`std::tuple` | 第 4 章 |
32+
| 智能指针 `shared_ptr` / `unique_ptr` / `weak_ptr``make_unique`(C++14) | 第 5 章 |
33+
| 正则表达式 `std::regex` | 第 6 章 |
34+
| 线程、互斥量、期物、条件变量、原子与内存模型 | 第 7 章 |
35+
| `long long``noexcept`、原始/自定义字面量、内存对齐 | 第 9 章 |
36+
37+
## C++17
38+
39+
| 特性 | 所在章节 |
40+
|:----|:--------|
41+
| 结构化绑定 | 第 2 章 |
42+
| `if` / `switch` 初始化语句 | 第 2 章 |
43+
| `if constexpr` | 第 2 章 |
44+
| 折叠表达式、非类型模板参数的 `auto` 推导 | 第 2 章 |
45+
| 内联变量、嵌套命名空间、`constexpr` lambda | 第 2 章 |
46+
| 单参数 `static_assert`、新的聚合规则 | 第 2 章 |
47+
| 布尔逻辑元函数、`__has_include` | 第 2 章 |
48+
| 强制复制消除 | 第 3 章 |
49+
| `std::string_view``std::byte` | 第 4 章 |
50+
| 关联容器的改进(`try_emplace` / `merge` 等)、多态分配器 `std::pmr` | 第 4 章 |
51+
| `std::filesystem` | 第 8 章 |
52+
| 过对齐类型的 `new` | 第 9 章 |
53+
| 数学特殊函数 | 第 9 章 |
54+
55+
## C++20
56+
57+
| 特性 | 所在章节 |
58+
|:----|:--------|
59+
| 概念与约束(Concepts) | 第 10 章 |
60+
| 模块(Modules) | 第 10 章 |
61+
| 范围(Ranges) | 第 10 章 |
62+
| 协程(Coroutines) | 第 10 章 |
63+
| `std::bit_cast` | 第 9 章 |
64+
65+
## C++23
66+
67+
| 特性 | 所在章节 |
68+
|:----|:--------|
69+
| 显式对象形参(Deducing this) | 第 11 章 |
70+
| `if consteval`、多维下标运算符 | 第 11 章 |
71+
| `auto(x)`、静态 `operator()``[[assume]]` | 第 11 章 |
72+
| `std::expected` | 第 11 章 |
73+
| `std::print` / `std::println` | 第 11 章 |
74+
| `std::mdspan``std::flat_map` / `std::flat_set` | 第 11 章 |
75+
| 范围库的增强(`zip` 等)、`string::contains``std::byteswap` | 第 11 章 |
76+
77+
## C++26(展望)
78+
79+
| 特性 | 所在章节 |
80+
|:----|:--------|
81+
| 静态反射(Reflection) | 第 12 章 |
82+
| 契约(Contracts) | 第 12 章 |
83+
| 形参包索引、带原因的 `= delete`、占位符 `_` | 第 12 章 |
84+
| `std::execution`(发送者 / 接收者) | 第 12 章 |
85+
| 饱和算术 | 第 12 章 |
86+
87+
[返回目录](./toc.md) | [上一章](./appendix2.md)
88+
89+
## 许可
90+
91+
<a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/80x15.png" /></a>
92+
93+
本教程由[欧长坤](https://github.com/changkun)撰写,采用[知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议](https://creativecommons.org/licenses/by-nc-nd/4.0/)许可。项目中代码使用 MIT 协议开源,参见[许可](../../LICENSE)

book/zh-cn/toc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
- 其他库设施
128128
- [**附录 1:进一步阅读的学习材料**](./appendix1.md)
129129
- [**附录 2:现代 C++ 的最佳实践**](./appendix2.md)
130+
- [**附录 3:现代 C++ 特性索引**](./appendix3.md)
130131

131132
返回目录 | 上一章 | [下一章:序言](./00-preface.md)
132133

website/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'./src/modern-cpp/en-us/'
1414
]
1515

16-
chapters = ['00-preface.md', '01-intro.md', '02-usability.md', '03-runtime.md', '04-containers.md', '05-pointers.md', '06-regex.md', '07-thread.md', '08-filesystem.md', '09-others.md', '10-cpp20.md', '11-cpp23.md', '12-cpp26.md', 'appendix1.md', 'appendix2.md']
16+
chapters = ['00-preface.md', '01-intro.md', '02-usability.md', '03-runtime.md', '04-containers.md', '05-pointers.md', '06-regex.md', '07-thread.md', '08-filesystem.md', '09-others.md', '10-cpp20.md', '11-cpp23.md', '12-cpp26.md', 'appendix1.md', 'appendix2.md', 'appendix3.md']
1717

1818
ignores = ['TOC', '返回目录', '许可', 'license', 'Table of Content', 'License']
1919

0 commit comments

Comments
 (0)