cpp create lambda with recursion

Solutions on MaxInterview for cpp create lambda with recursion by the best coders in the world

showing results for - "cpp create lambda with recursion"
Gianluca
17 Oct 2019
1std::function<int(int,int)> sum;
2sum = [term,next,&sum](int a, int b)->int {
3if(a>b)
4    return 0;
5else
6    return term(a) + sum(next(a),b);
7};