Skip to content

Commit ff579f0

Browse files
committed
Merge branch 'main' of github.com:parallel101/cppguidebook
2 parents a11cc39 + 176c0e4 commit ff579f0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

docs/functional.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ int main() {
500500
### 我用了 C++20 的函数参数 auto 语法糖
501501
502502
```cpp
503-
int generic_sum(std::vector<int> const &v, auto op) P
503+
int generic_sum(std::vector<int> const &v, auto op) {
504504
}
505505
```
506506

@@ -914,6 +914,7 @@ int hello(int x, int y) {
914914
}
915915
916916
int main() {
917+
auto hello2 = std::bind(hello, 2, std::placeholders::_1);
917918
fmt::println("main 调用 hello2(3) 结果:{}", hello2(3));
918919
fmt::println("main 调用 hello2(4) 结果:{}", hello2(4));
919920
fmt::println("main 调用 hello2(5) 结果:{}", hello2(5));

docs/unicode.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,19 @@ UTF-8 的构造就像一列小火车一样,不同范围内的码位会被编
240240
乘客需要被拆分成三片,例如对于“我”这个乘客,“我”的码点是 0x6211,转换成二进制是:
241241

242242
```
243-
110010000010001
243+
110001000010001
244244
```
245245

246-
把乘客切分成高 4 位、中 6 位和低 6 位:
246+
把乘客切分成高 4 位、中 6 位和低 6 位(不足时在前面补零)
247247

248248
```
249-
1100 100000 10001
249+
0110 001000 010001
250250
```
251251

252252
加上 `1110``10``10` 前缀后,形成一列火车:
253253

254254
```
255-
11100110 10000010 10000001
255+
11100110 10001000 10010001
256256
```
257257

258258
这样,我们就把“我”这个字符,编码成了三节列车,塞进字节流的网络隧道里了。

0 commit comments

Comments
 (0)