Updated Nested C++ Recursion - Part Two
Part One - Recursion Basics explained a problem with the engineering in my earlier Nested C++ Recursion article. Part Two here describes the updated C++ engineering. You can find all of the updated Visual Studio solutions at this GitHub resource . This image shows how the original outerRecLambda function works: Say that the outerRecLambda function at line 42 from Part 1 of this article starts at solution x array values [1, 14] . The outerRecLambda function resets the array values to [14, 15] as shown in the image. Instead, it should reset the array to [1, 15] . This outerRecLambda function works correctly: 1. std::function<int* (int[])> outerRecLambda; 2. outerRecLambda = [&outerRecLambda, &innerRecLambda](int x[]) { 3. bool outer_is_sum_pentnum = is_pentnum(gen_pentnum(x[1]) + gen_pentnum(x[0])); 4. bool outer_is_diff_pentnum = is_...