Skip to content

Commit e0d18ad

Browse files
committed
update: 为每个练习提供一个名字
Signed-off-by: YdrMaster <[email protected]>
1 parent 5d10695 commit e0d18ad

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

exercises/08_trivial/main.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#include "../exercise.h"
22

3-
// READ: Trivial type <https://learn.microsoft.com/en-us/cpp/cpp/trivial-standard-layout-and-pod-types?view=msvc-170>
3+
// READ: Trivial type <https://learn.microsoft.com/zh-cn/cpp/cpp/trivial-standard-layout-and-pod-types?view=msvc-170>
4+
45
struct FibonacciCache {
56
unsigned long long cache[16];
67
int cached;
78
};
89

910
// TODO: 实现正确的缓存优化斐波那契计算
1011
static unsigned long long fibonacci(FibonacciCache &cache, int i) {
11-
for (;; ++cached) {
12+
for (; false; ++cached) {
1213
cache[cached] = cache[cached - 1] + cache[cached - 2];
1314
}
1415
return cache.cache[i];

exercises/xmake.lua

+30
Original file line numberDiff line numberDiff line change
@@ -4,93 +4,123 @@ set_warnings("all")
44
set_kind("binary")
55
set_languages("cxx17")
66

7+
-- 格式化输出
78
target("exercise00")
89
add_files("00_hello_world/main.cpp")
910

11+
-- 变量与运算符
1012
target("exercise01")
1113
add_files("01_variable&add/main.cpp")
1214

15+
-- 函数、声明和定义
1316
target("exercise02")
1417
add_files("02_function/main.cpp")
1518

19+
-- 形参实参
1620
target("exercise03")
1721
add_files("03_argument&parameter/main.cpp")
1822

23+
-- static 关键字
1924
target("exercise04")
2025
add_files("04_static/main.cpp")
2126

27+
-- constexpr 编译时常量和运算
2228
target("exercise05")
2329
add_files("05_constexpr/main.cpp")
2430

31+
-- 循环
2532
target("exercise06")
2633
add_files("06_loop/main.cpp")
2734

35+
-- 枚举/联合体
2836
target("exercise07")
2937
add_files("07_enum&union/main.cpp")
3038

39+
-- “普通”类型
3140
target("exercise08")
3241
add_files("08_trivial/main.cpp")
3342

43+
-- 方法
3444
target("exercise09")
3545
add_files("09_method/main.cpp")
3646

47+
-- const 修饰方法
3748
target("exercise10")
3849
add_files("10_method_const/main.cpp")
3950

51+
--
4052
target("exercise11")
4153
add_files("11_class/main.cpp")
4254

55+
-- 析构器
4356
target("exercise12")
4457
add_files("12_class_destruct/main.cpp")
4558

59+
-- 复制构造函数
4660
target("exercise13")
4761
add_files("13_class_clone/main.cpp")
4862

63+
-- 移动语义
4964
target("exercise14")
5065
add_files("14_class_move/main.cpp")
5166

67+
-- 派生
5268
target("exercise15")
5369
add_files("15_class_derive/main.cpp")
5470

71+
-- 虚函数
5572
target("exercise16")
5673
add_files("16_class_virtual/main.cpp")
5774

75+
-- 虚析构函数
5876
target("exercise17")
5977
add_files("17_class_virtual_destruct/main.cpp")
6078

79+
-- 函数模板
6180
target("exercise18")
6281
add_files("18_function_template/main.cpp")
6382

83+
-- 习题:用于编译器的运行时类型
6484
target("exercise19")
6585
add_files("19_runtime_datatype/main.cpp")
6686

87+
-- 类模板
6788
target("exercise20")
6889
add_files("20_class_template/main.cpp")
6990

91+
-- 模板非类型实参
7092
target("exercise21")
7193
add_files("21_template_const/main.cpp")
7294

95+
-- std::array
7396
target("exercise22")
7497
add_files("22_std_array/main.cpp")
7598

99+
-- std::vector
76100
target("exercise23")
77101
add_files("23_std_vector/main.cpp")
78102

103+
-- std::vector<bool>
79104
target("exercise24")
80105
add_files("24_std_vector_bool/main.cpp")
81106

107+
-- 习题:步长计算
82108
target("exercise25")
83109
add_files("25_strides/main.cpp")
84110

111+
-- std::string
85112
target("exercise26")
86113
add_files("26_std_string/main.cpp")
87114

115+
-- std::map
88116
target("exercise27")
89117
add_files("27_std_map/main.cpp")
90118

119+
-- std::transform
91120
target("exercise28")
92121
add_files("28_std_transform/main.cpp")
93122

123+
-- std::accumulate
94124
target("exercise29")
95125
add_files("29_std_accumulate/main.cpp")
96126

0 commit comments

Comments
 (0)