Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Is there any push and pop operation for arrays in STL of C++?
Is there any push and pop operation for arrays in STL of C++?

There are vectors in STL, just like arrays. The only difference from an abstract perspective is that vectors can be expanded at any time. Use

vector vec; to define an integer vector

vec.push_back(13), add 13 to the end of the vector, and increase the size of vec by 1

vec.pop(); delete the last element, and decrease the size of vec by 1< /p>

The stack in STL only provides operations on the top of the stack.

stack stk;

stk.push_back(13), top increases by 1, points to Refers to assignment 13

stk.pop(), top minus 1