Awesome-Embedded-Learning-Studio / Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP
[内容勘误] 流与下标运算符章节 中出现超出教学范围的异常处理代码
@Charliechen114514 is already working on this.
Since Sep 18, 2026.
- Dominant language
- C++
- Stars
- 287
- Forks
- 45
- Avg merge
- 11h 57m
- Merged PRs (30d)
- 68
Description
相关页面或文件
https://awesome-embedded-learning-studio.github.io/Tutorial_AwesomeModernCPP/vol1-fund amentals/ch07/02-io-subscript,documents\vol1-fundamentals\ch07\02-io-subscript.md
问题类型
其他
当前内容
在 documents/vol1-fundamentals/ch07/02-io-subscript.md 第 337-344 行中,示例代码使用了try-catch块来捕获 std::out_of_range 异常:
try {
std::cout << "arr.at(10) = " << arr.at(10) << std::endl;
}
catch (const std::out_of_range& e) {
std::cout << "捕获异常: " << e.what() << std::endl;
}
问题说明
这段代码存在以下问题:
1.超出文章主题范围:本文重点是"流与下标运算符"(operator<<、operator>>、operator[]),异常处理(try-catch)是独立主题
2.缺少前置知识:文章的 prerequisites 只列了"算术与比较运算符",没有异常处理相关章节
3.教学顺序混乱:vol1-fundamentals 基础卷可能还未系统讲解异常机制,过早引入会让读者困惑
4.代码比重失衡:异常处理代码占据了示例的显著位置,分散了对核心概念(operator[] vs at())的注意力
建议修改
No response
补充材料
documents\vol1-fundamentals\ch07\02-io-subscript.md
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.