错误:'class std :: stack <>'没有名为'pop_back'的成员

Sur*_*ani 0 c++

void MazeSolver::solveMaze()
{
    stack<Cell> myStack;
    Cell current = myVector.getAt(0, 0);
    myStack.push_back(current);
    int x, y;
    while (myStack.size() != 0)
    {
        current = myStack.pop_back();
        x = current.x_coord;
        y = current.y_coord;
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到以下编译时错误:

/Users/snihalani/dev/c++rec/c++hw at 7:11PM

? main.cpp: In member function 'void hw1::MazeSolver::solveMaze()':

main.cpp:55:17: error: 'class std::stack<hw1::Cell>' has no member named 'push_back' main.cpp:59:31: error: 'class std::stack<hw1::Cell>' has no member named 'pop_back'

[1] + 18262 exit 1 g+ --std=c++11 main.cpp

在此先感谢您的帮助.

Jes*_*ood 5

更改push_backpushpop_backpop.有关更多信息,请使用好的参考.