Difference between revisions of "cpp/container/stack"
From cppreference.com
(expand description) |
|||
Line 13: | Line 13: | ||
===Template parameters=== | ===Template parameters=== | ||
− | + | {{param list begin}} | |
− | The | + | {{param list item | T | The type of the stored elements.}} |
+ | {{param list item | Container | The type of the underlying container to use to store the elements. The container must satisfy the requirements of {{concept|SequenceContainer}}. Additionally, it must provide the following functions with the usual semantics: | ||
* {{tt|back()}} | * {{tt|back()}} | ||
Line 20: | Line 21: | ||
* {{tt|pop_back()}} | * {{tt|pop_back()}} | ||
− | The standard containers {{ | + | The standard containers {{c|std::vector}}, {{c|std::deque}} and {{c|std::list}} satisfy these requirements. |
+ | }}{{param list end}} | ||
===Member types=== | ===Member types=== |
Revision as of 07:09, 23 April 2013
Defined in header <stack>
|
||
template< class T, |
||
The std::stack
class is a container adapter that gives the programmer the functionality of a stack - specifically, a FILO (first-in, last-out) data structure.
The class template acts as a wrapper to the underlying container - only a specific set of functions is provided. The stack pushes and pops the element from the back of the underlying container, known as the top of the stack.
Contents |
Template parameters
T | - | The type of the stored elements. |
Container | - | The type of the underlying container to use to store the elements. The container must satisfy the requirements of Template:concept. Additionally, it must provide the following functions with the usual semantics:
The standard containers std::vector, std::deque and std::list satisfy these requirements. |