docs: address community issue feedback (#5 #338 #142 #246 #136 #303)

- const README: rewrite the space-saving claim per issue #5 follow-ups
  (constant-expression const vs #define immediates; which const qualify
  as constant expressions)
- const README: fix the class-section diagnosis per issue #338 (overload
  resolution picks the const overload; the restriction only surfaces
  once that overload is removed)
- sizeof README: virtual-inheritance result is compiler-dependent
  (GCC merges vbptr+vfptr -> 16, MSVC keeps them separate -> 32) #246
- static README: new section on internal linkage / access restriction
  with anonymous-namespace comparison #142
- 10-day practice: full problem list table + fixed day links #136
- new design_pattern/singleton/singleton_default.hpp: reusable
  thread-safe CRTP singleton template, compile+concurrency tested #303
This commit is contained in:
light-city
2026-10-13 19:23:54 +08:00
parent cfc9af1fcb
commit dfe1c933b3
159 changed files with 20461 additions and 182 deletions

View File

@@ -1,41 +1,62 @@
# 10日c++实战狂练
> 本文档由 [C++那些事网站](https://light-city.github.io/stories_things/practical-exercises/10-day-cpp-crash-course/) 同步生成,网站版本含多语言与更新排版。
- [x] [day1](day1)
# C++ 十日速成练习
- [x] [day1](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day1)
基本c++语法
- [x] [day2](day2)
- [x] [day2](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day2)
递归、结构体、枚举、静态变量等
- [x] [day3](day3)
- [x] [day3](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day3)
函数
- [x] [day4](day4)
- [x] [day4](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day4)
函数深入
- [x] [day5](day5)
- [x] [day5](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day5)
继承多态
- [x] [day6](day6)
- [x] [day6](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day6)
虚函数、抽象类
- [x] [day7](day7)
- [x] [day7](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day7)
运算符重载
- [x] [day8](day8)
- [x] [day8](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day8)
模板与STL
- [x] [day9](day9)
- [x] [day9](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day9)
异常
- [x] [day10](day10)
- [x] [day10](https://github.com/Light-City/CPlusPlusThings/tree/master/practical_exercises/10_day_practice/day10)
文件与流
文件与流
## 每日题目说明(回应 [issue #136](https://github.com/Light-City/CPlusPlusThings/issues/136))
题目即每天的**文件名 + 文件内注释**,这里给出汇总清单,练习时先看题目名,自己写一遍,再对照仓库实现:
| Day | 主题 | 题目(对应仓库文件) |
| --- | --- | --- |
| 1 | 基本语法 | 注释对齐(annotate)、打印输出(print)、闰年判断(runnian)、union 初探(union) |
| 2 | 递归/结构体/枚举 | 汉诺塔(hanoi)、幂运算(pow)、递归基础(rec1)、简单计算器(compute)、枚举应用(enum) |
| 3 | 函数 | 函数重载、默认参数、值/引用/指针传参对比 |
| 4 | 函数深入 | 函数指针、回调、可变参数、内联函数 |
| 5 | 类与对象 | 构造/析构(ctor_dtor)、继承访问控制(inherit_access)、运算符重载(rule)、组合关系(rela)、虚函数初探(virtual) |
| 6 | 继承多态 | 虚函数、抽象类、纯虚函数、多态综合案例 |
| 7 | 运算符重载 | 算术/关系/下标/圆括号重载、强制转换运算符 |
| 8 | 模板与 STL | 类模板(class_template)、函数模板(func)、STL 容器入门(stl) |
| 9 | 异常 | try/catch、自定义异常、异常安全 |
| 10 | 文件与流 | 文件读写、流的格式化 |
> 建议:每道题先自己从零写,写不出来再看实现;写完了对比差距,收获最大(参考 [issue #180](https://github.com/Light-City/CPlusPlusThings/issues/180) 的讨论)。