Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

cpp create lambda with recursion

std::function<int(int,int)> sum;
sum = [term,next,&sum](int a, int b)->int {
if(a>b)
    return 0;
else
    return term(a) + sum(next(a),b);
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cpp #create #lambda #recursion
ADD COMMENT
Topic
Name
4+9 =