assert(S.top() == 7);

 S.pop();

 assert(S.top() == 8);

 S.pop();

 assert(S.empty());

}

Definition

Defined in the standard header stack, and in the nonstandard backward-compatibility header stack.h.

Template parameters
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>
Model of

Assignable, Default Constructible

Type requirements

• T is a model of Assignable.

• Sequence is a model of Back Insertion Sequence.

• Sequence::value_type is the same type as T.

• If operator== is used, then T is a model of Equality Comparable

• If operator< is used, then T is a model of LessThan Comparable.

Public base classes

None.

Members
Member Where defined Description
value_type stack See below.
size_type stack See below.
stack() Default Constructible The default constructor. Creates an empty stack.
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.
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату