65,211
社区成员
发帖
与我相关
我的任务
分享struct VMStack
{
PTNode * curr;
VMStack * pre;
bool next()
{
if(curr->sibling != NULL)
{
curr = curr->sibling;
return true;
}
else return false;
}
};
void push(VMStack &stack)
{
VMStack * temp = new VMStack();
temp->pre = &stack;
temp->curr = stack.curr;
stack = *temp;
}
void pull(VMStack &stack)
{
VMStack * temp = &stack;
stack = *stack.pre;
//delete temp;
}
void push(VMStack * stack)
{
VMStack * temp = new VMStack();
temp->pre = stack;
temp->curr = stack->curr;
stack = temp;
}
void pull(VMStack * stack)
{
VMStack * temp = stack;
stack = stack->pre;
delete temp;
}