Skip to content

Commit

Permalink
Update ch10.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Lihang99 committed May 16, 2021
1 parent d6cae72 commit 5fbf473
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion excersize/ch10.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int main()
解:
* (a) 应该加一条语句 `vec.resize(lst.size())` 。`copy`时必须保证目标目的序列至少要包含与输入序列一样多的元素。
* (b) reserve分配了足够的空间,但是算法可能改变容器中保存的元素的值,也可能在容器内移动元素,永远不会直接添加和删除元素(c++ priemr中文版第五版 P338)。所以此处应用resize
* (b) reserve分配了足够的空间,但是不会创建新元素。算法可能改变容器中保存的元素的值,也可能在容器内移动元素,永远不会直接添加和删除元素(c++ priemr中文版第五版 P338),所以此处应该改为resize(10)。
## 练习10.8
Expand Down

0 comments on commit 5fbf473

Please sign in to comment.