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;
}
}
I am getting the following compile time error:
/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
Thanks in advance for the help.
Change push_back
to push
and pop_back
to pop
. For more information, use a good reference .
std::stack<>
has a member function named pop
, and another named push
. The stack can only do operations on the back, it is just push
and pop
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.