#include <iostream>
#include <functional>
int main(){
int a = 10;
std::function<int(int)> functionPointer = [a](int a)-> int{ return a + a + 100 ; };
int returnValue = functionPointer(50);
std::cout<<returnValue<<endl;
}
Run Code Online (Sandbox Code Playgroud)
我原本期望10 + 50 + 100 = 160,但是输出是10 + 10 + 100 =120。我可以做些改变以获得160,同时保持变量名称不变吗?