Skip to content

Commit ceaac86

Browse files
authored
Fix: 2 typos in variant section (#33)
fix int size typo, which in most platforms, int sizes 4 bytes; Also update the variant size
1 parent 1fc594f commit ceaac86

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

documents/vol2-modern-features/ch04-type-safety/03-variant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ struct UnaryExpr {
432432
```cpp
433433
std::cout << "sizeof(variant<int, double, string>): "
434434
<< sizeof(std::variant<int, double, std::string>) << "\n";
435-
// 典型输出:32(64 位平台上,string 占 32 字节,int double 8 字节)
435+
// 典型输出:40(64 位平台上,string 占 32 字节,int 占 4 字节, double 8 字节)
436436
std::cout << "sizeof(string): " << sizeof(std::string) << "\n";
437437
// 典型输出:32
438438
```

0 commit comments

Comments
 (0)