当前位置:网站首页>STL-stack

STL-stack

2022-08-10 22:30:00 dry rice white

Introduction to stack

stack is a stack container, which is a "first in, last out" container

stack is a simple decorative deque container to become another kind of container

Default construction of stack objects

stack is implemented by template class, the default construction form of stack object stacksta;

stack's push() and pop() methods

stack.push(elem); //add elements to the stack head

stack.pop(); // remove the first element from the top of the stack

Copy construction and assignment of stack objects

stack(const stack&stk); //copy constructor

stack &operator=(const stack &stk); //overloading the equals operator

Data access of stack

stack.top() //return the top element of the stack

size of stack

stack.empty() //determine whether the stack is empty

stack.size() //return the size of the stack

原网站

版权声明
本文为[dry rice white]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208102148593446.html