Commit 2dae610
committed
docs(cpp11): add STL real-world case and exercise mapping for 16-generalized-unions
- add section 二 真实案例 — include std::variant _Variant_storage_ and
std::any _Storage_t examples, both cited from vendored msvc-stl/
- fill in 四 练习代码 — exercise descriptions, file links and
d2x checker command
- fix empty Code link in header table
Case selection notes:
Picked _Variant_storage_ over std::optional _Optional_destruct_base
because the variant recursive union demonstrates both key C++11
generalized-union capabilities — non-trivial members and manual
destructor management — while the optional pattern is effectively
a special case of variant. std::any adds a second typical use:
union as type-erased storage. Both are directly traceable in the
vendored msvc-stl/, consistent with how ch00 cites xutility.1 parent 307dc8a commit 2dae610
1 file changed
Lines changed: 62 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
130 | 178 | | |
131 | 179 | | |
132 | 180 | | |
| |||
170 | 218 | | |
171 | 219 | | |
172 | 220 | | |
173 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
174 | 224 | | |
175 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
176 | 233 | | |
177 | | - | |
| 234 | + | |
178 | 235 | | |
179 | 236 | | |
180 | 237 | | |
| |||
0 commit comments