Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86d84d2 commit 811c5efCopy full SHA for 811c5ef
book/zh-cn/02-usability.md
@@ -722,8 +722,6 @@ void printf2(T0 t0, T... t) {
722
723
**3. 初始化列表展开**
724
725
-> 这个方法需要之后介绍的知识,读者可以简单阅读一下,将这个代码段保存,在后面的内容了解过了之后再回过头来阅读此处方法会大有收获。
726
-
727
递归模板函数是一种标准的做法,但缺点显而易见的在于必须定义一个终止递归的函数。
728
729
这里介绍一种使用初始化列表展开的黑魔法:
@@ -738,7 +736,7 @@ auto printf3(T value, Ts... args) {
738
736
}
739
737
```
740
741
-在这个代码中,额外使用了 C++11 中提供的初始化列表以及 Lambda 表达式的特性(下一节中将提到),而 std::initializer_list 也是 C++11 新引入的容器(以后会介绍到)。
+在这个代码中,额外使用了 C++11 中提供的初始化列表以及 Lambda 表达式的特性(下一节中将提到)。
742
743
通过初始化列表,`(lambda 表达式, value)...` 将会被展开。由于逗号表达式的出现,首先会执行前面的 lambda 表达式,完成参数的输出。
744
为了避免编译器警告,我们可以将 `std::initializer_list` 显式的转为 `void`。
0 commit comments