GNU g++  v5.2.1
GNU Standard C++
stl_stack.h File Reference

This is an internal header file, included by other library headers. More...

#include <bits/concept_check.h>
#include <debug/debug.h>
Include dependency graph for stl_stack.h:

Functions

namespace std _GLIBCXX_VISIBILITY (default)
 

Detailed Description

This is an internal header file, included by other library headers.

Do not attempt to use it directly. {stack}

Function Documentation

namespace std _GLIBCXX_VISIBILITY ( default  )

A standard container giving FILO behavior.

Template Parameters
_TpType of element.
_SequenceType of underlying sequence, defaults to deque<_Tp>.

Meets many of the requirements of a container, but does not define anything to do with iterators. Very few of the other standard container interfaces are defined.

This is not a true container, but an adaptor. It holds another container, and provides a wrapper interface to that container. The wrapper is what enforces strict first-in-last-out stack behavior.

The second template parameter defines the type of the underlying sequence/container. It defaults to std::deque, but it can be any type that supports back, push_back, and pop_front, such as std::list, std::vector, or an appropriate user-defined type.

Members not found in normal containers are container_type, which is a typedef for the second Sequence parameter, and push, pop, and top, which are standard stack/FILO operations.

Default constructor creates no elements.

Returns true if the stack is empty.

Returns the number of elements in the stack.

Returns a read/write reference to the data at the first element of the stack.

Returns a read-only (constant) reference to the data at the first element of the stack.

Add data to the top of the stack.

Parameters
__xData to be added.

This is a typical stack operation. The function creates an element at the top of the stack and assigns the given data to it. The time complexity of the operation depends on the underlying sequence.

Removes first element.

This is a typical stack operation. It shrinks the stack by one. The time complexity of the operation depends on the underlying sequence.

Note that no data is returned, and if the first element's data is needed, it should be retrieved before pop() is called.

Stack equality comparison.

Parameters
__xA stack.
__yA stack of the same type as __x.
Returns
True iff the size and elements of the stacks are equal.

This is an equivalence relation. Complexity and semantics depend on the underlying sequence type, but the expected rules are: this relation is linear in the size of the sequences, and stacks are considered equivalent if their sequences compare equal.

Stack ordering relation.

Parameters
__xA stack.
__yA stack of the same type as x.
Returns
True iff x is lexicographically less than __y.

This is an total ordering relation. Complexity and semantics depend on the underlying sequence type, but the expected rules are: this relation is linear in the size of the sequences, the elements must be comparable with <, and std::lexicographical_compare() is usually used to make the determination.

Based on operator==

Based on operator<

Based on operator<

Based on operator<

References __glibcxx_class_requires, __glibcxx_class_requires2, __glibcxx_requires_nonempty, std::__exception_ptr::operator!=(), std::__exception_ptr::operator==(), __gnu_debug::operator>(), __gnu_debug::operator>=(), and std::__exception_ptr::swap().

Here is the call graph for this function: