assert(S.top() == 7);
S.pop();
assert(S.top() == 8);
S.pop();
assert(S.empty());
}
Defined in the standard header stack, and in the nonstandard backward-compatibility header stack.h.
| Parameter | Description | Default |
|---|---|---|
T | The type of object stored in the stack. | |
Sequence | The type of the underlying container used to implement the stack. | deque<T> |
Assignable, Default Constructible
• If
• If
None.
| Member | Where defined | Description |
|---|---|---|
value_type | stack | See below. |
size_type | stack | See below. |
stack() | Default Constructible | The default constructor. Creates an empty |
stack(const stack&) | Assignable | The copy constructor. |
stack& operator=(const stack&) | Assignable | The assignment operator. |
bool empty() const | stack | See below. |
size_type size() const | stack | See below. |
value_type& top() | stack | See below. |
const value_type& top() const | stack | See below. |
void push(const value_type&) | stack | See below. |
void pop() [3] | stack | See below. |
Вы читаете Standard Template Library Programmer's Guide
