#include <iostream>
template<typename Func, typename Arg>
void execute(Func fn, Arg x) {
fn(x);
}
int main() {
int n;
auto lambda = [&](int x) { n += x; };
n = 123;
execute(lambda, 321); // nの参照をスコープの外に持ち出す
std::cout << n << std::endl;
}
ほほー、できるんだー...