Below is the pseudo code of the first order logic back chaining algorithm from Artificial Intelligence: A Modern Approach.
The problem is that the functions are defined as generators and I don't quite understand how to convert generators into single return functions. If this were a one-and-done function, a vector would be obvious. However, these are recursive calls so I'm having trouble wrapping my head around it. The c++ generate functionality doesn't seem useful. Bach chaining is not a complete algorithm and I wouldn't know how much space I would need to allocate.
How does one convert generator functions to single-return functions?
Picture taken form Russell, Stuart; Norvig, Peter. Artificial Intelligence: A Modern Approach (Page 338). Pearson Education. Kindle Edition.