I'm a student working on STL containers which were not formally taught in class. The website I typically follow hasn't helped, and neither have my textbooks. I'm getting an assertion error with this "while" loop. Probably something obvious to someone who works with C++ STL...
There's an explanation for all the outcomes I tried at the bottom. If you have a good reference site you use for this type of thing PLEASE pass it on? Thanks!
while((!MStack.empty()) && (!FStack.empty()))
{
cout << " " << MStack.top();
LStack.push(MStack.top()); //push to left stack
//MStack.pop();
cout << " " << FStack.top();
RStack.push(FStack.top()); //PUSH to right stack
//FStack.pop();
cout << " " << MStack.top();
RStack.push(MStack.top()); //PUSH to right stack
//MStack.pop();
cout << " " << FStack.top();
LStack.push(FStack.top()); //PUSH to left stack
//FStack.pop();
}
//WHEN PUSH EDITED THE LOOP EXECUTES CORRECTLY AND THEN THE ASSERTION ERROR HAPPENS
//WHEN BOTH SECOND LINES ARE EDITED OUT, OR JUST THE POP LINE - NEVERENDING LOOP