2 ms·
> even C++ to some extent C++ can also infer return types, the following is a valid C++14 function definition auto foo() { auto curry = [](auto x)
by nly 11y ago
> even C++ to some extent
C++ can also infer return types, the following is a valid C++14 function definition
auto foo() {
auto curry = [](auto x) {
return [=](auto y) { return x + y; };
};
auto add42 = curry(42);
return add42(58);
}
which incidentally gets compiled to this:
0000000000000000 <foo()>:
0: mov $0x64,%eax
5: retq