MCPcopy Create free account
hub / github.com/changkun/modern-cpp-tutorial / main

Function main

code/2/2.3.cpp:30–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30int main() {
31 auto i = 5;
32
33 int arr[10] = {0};
34 auto auto_arr = arr; // 正确,对整个类型进行推导
35 //auto auto_arr2[10] = arr; // 错误, 无法推导数组元素类型
36
37 auto x = 1;
38 auto y = 2;
39 decltype(x+y) z1;
40 //auto z2; // 错误, 无法推导
41
42
43 std::cout << add1<int, int, int>(1,1) << std::endl;
44 std::cout << add1<int, int>(1,1) << std::endl;
45 std::cout << add1<int, int>(1,1) << std::endl;
46
47
48 return 0;
49}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected