I have something of the form:
struct Tree {
string rule;
list<Tree*> children;
}
I’m trying to print it out from within this for loop.
for(list<Tree*>::iterator it=(t->children).begin(); it != (t->children).end(); it++) {
// print out here
}
You can always turn recursion into iteration. Here’s with an auxiliary queue:
In C++11 this would of course be a
forloop: