#include <string>
string data;
std::string data;
std::string
string
我最初发布了上面的前两项作为评论,但我发现了一个错误 pop() 功能。我想我也会把它们添加到这个答案中。
pop()
你没有更新 last 从a中弹出最后一项时正确 Queue 。
last
Queue
std::string pop() { if (!isEmpty()) { std::string temp = first->data; Node* tpointer = first; if ( first == last ) { first = last = NULL; } else { first = first->next; } delete tpointer; return temp; } return ""; }