Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4de9eb4

Browse files
TinyWangchangkun
TinyWang
authored andcommitted
book: use curly brackets to initailize aggregate objects (changkun#112)
1 parent9dbdd53 commit4de9eb4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎book/en-us/02-usability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ auto arr = new auto(10); // arr as int *
426426
> In addition, `auto` cannot be used to derive array types:
427427
>
428428
> ```cpp
429-
> auto auto_arr2[10] = arr; // illegal, can't infer array type
429+
> auto auto_arr2[10] ={arr}; // illegal, can't infer array type
430430
>
431431
> 2.6.auto.cpp:30:19: error: 'auto_arr2' declared as array of 'auto'
432-
> auto auto_arr2[10] = arr;
432+
> auto auto_arr2[10] ={arr};
433433
> ```
434434
435435
### decltype

‎book/zh-cn/02-usability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ auto arr = new auto(10); // arr 被推导为 int *
361361
> 此外,`auto` 还不能用于推导数组类型:
362362
>
363363
> ```cpp
364-
> auto auto_arr2[10] = arr; // 错误, 无法推导数组元素类型
364+
> auto auto_arr2[10] ={arr}; // 错误, 无法推导数组元素类型
365365
>
366366
> 2.6.auto.cpp:30:19: error: 'auto_arr2' declared as array of 'auto'
367-
> auto auto_arr2[10] = arr;
367+
> auto auto_arr2[10] ={arr};
368368
> ```
369369
370370
### decltype

‎code/2/2.06.auto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main() {
3737
auto i =5;// type int
3838
auto j =6;// type int
3939
auto arr =newauto(10);// type int*
40-
// auto auto_arr2[10] = arr;
40+
// auto auto_arr2[10] ={arr};
4141
// std::cout << add(i, j) << std::endl;
4242
return0;
4343
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp