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

Function main

code/3/3.1.cpp:34–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34int main() {
35 learn_lambda_func_1();
36 learn_lambda_func_2();
37
38 auto important = std::make_unique<int>(1);
39 auto add = [v1 = 1, v2 = std::move(important)](int x, int y) -> int {
40 return x+y+v1+(*v2);
41 };
42 std::cout << add(3,4) << std::endl;
43
44 // 泛型 lambda
45 auto generic = [](auto x, auto y) {
46 return x+y;
47 };
48
49 generic(1, 2);
50 generic(1.1, 2.2);
51 return 0;
52}

Callers

nothing calls this directly

Calls 3

learn_lambda_func_1Function · 0.85
learn_lambda_func_2Function · 0.85
addFunction · 0.50

Tested by

no test coverage detected