Skip to content

Commit

Permalink
Merge pull request Light-City#124 from freedomDR/master
Browse files Browse the repository at this point in the history
fix: update const doc
  • Loading branch information
Light-City committed Apr 10, 2022
2 parents 27f5769 + ca08a3e commit de3f272
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion basic_content/const/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void StringCopy(char *dst, const char *src);
void func(const A &a)
```
对于非内部数据类型的参数而言,象void func(A a) 这样声明的函数注定效率比较低。因为函数体内将产生A 类型的临时对象用于复制参数a,而临时对象的构造、复制、析构过程都将消耗时间。
对于非内部数据类型的参数而言,像void func(A a) 这样声明的函数注定效率比较低。因为函数体内将产生A 类型的临时对象用于复制参数a,而临时对象的构造、复制、析构过程都将消耗时间。
为了提高效率,可以将函数声明改为void func(A &a),因为“引用传递”仅借用一下参数的别名而已,不需要产生临
时对象。
Expand Down

0 comments on commit de3f272

Please sign in to comment.