.TH "std::stack< _Tp, _Sequence >" 3cxx "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::stack< _Tp, _Sequence > \- A standard container giving FILO behavior\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Types" .in +1c .ti -1c .RI "\fBtypedef\fP _Sequence::const_reference \fBconst_reference\fP" .br .ti -1c .RI "\fBtypedef\fP _Sequence \fBcontainer_type\fP" .br .ti -1c .RI "\fBtypedef\fP _Sequence::reference \fBreference\fP" .br .ti -1c .RI "\fBtypedef\fP _Sequence::size_type \fBsize_type\fP" .br .ti -1c .RI "\fBtypedef\fP _Sequence::value_type \fBvalue_type\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "template<\fBtypename\fP \fB_Seq\fP = _Sequence, \fBtypename\fP _Requires = typename enable_if::value>::type> \fBstack\fP ()" .br .RI "Default constructor creates no elements\&. " .ti -1c .RI "\fBstack\fP (_Sequence &&__c)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (_Sequence &&__c, const _Alloc &__a)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (const _Alloc &__a)" .br .ti -1c .RI "\fBstack\fP (const _Sequence &__c)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (const _Sequence &__c, const _Alloc &__a)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (const \fBstack\fP &__q, const _Alloc &__a)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (\fBstack\fP &&__q, const _Alloc &__a)" .br .ti -1c .RI "template \fBdecltype\fP(\fBauto\fP) \fBemplace\fP (\fB_Args\fP &&\&.\&.\&. \fB__args\fP)" .br .ti -1c .RI "bool \fBempty\fP () const" .br .ti -1c .RI "\fBvoid\fP \fBpop\fP ()" .br .RI "Removes first element\&. " .ti -1c .RI "\fBvoid\fP \fBpush\fP (const value_type &__x)" .br .RI "Add data to the top of the stack\&. " .ti -1c .RI "\fBvoid\fP \fBpush\fP (value_type &&__x)" .br .ti -1c .RI "size_type \fBsize\fP () const" .br .ti -1c .RI "\fBvoid\fP \fBswap\fP (\fBstack\fP &\fB__s\fP) noexcept(\fB__is_nothrow_swappable\fP< _Sequence >::value)" .br .ti -1c .RI "reference \fBtop\fP ()" .br .ti -1c .RI "const_reference \fBtop\fP () const" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "_Sequence \fBc\fP" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "template<\fBtypename\fP \fB_Tp1\fP , \fBtypename\fP \fB_Seq1\fP > bool \fBoperator<\fP (const \fBstack\fP< \fB_Tp1\fP, \fB_Seq1\fP > &, const \fBstack\fP< \fB_Tp1\fP, \fB_Seq1\fP > &)" .br .ti -1c .RI "template<\fBtypename\fP \fB_Tp1\fP , \fBtypename\fP \fB_Seq1\fP > bool \fBoperator==\fP (const \fBstack\fP< \fB_Tp1\fP, \fB_Seq1\fP > &, const \fBstack\fP< \fB_Tp1\fP, \fB_Seq1\fP > &)" .br .in -1c .SH "Detailed Description" .PP .SS "template<\fBtypename\fP _Tp, \fBtypename\fP _Sequence = deque<_Tp>> .br class std::stack< _Tp, _Sequence >"A standard container giving FILO behavior\&. .PP \fBTemplate Parameters\fP .RS 4 \fI_Tp\fP Type of element\&. .br \fI_Sequence\fP Type of underlying sequence, defaults to deque<_Tp>\&. .RE .PP Meets many of the requirements of a \fCcontainer\fP, but does not define anything to do with iterators\&. Very few of the other standard container interfaces are defined\&. .PP This is not a true container, but an \fIadaptor\fP\&. It holds another container, and provides a wrapper interface to that container\&. The wrapper is what enforces strict first-in-last-out stack behavior\&. .PP 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 \fCback\fP, \fCpush_back\fP, and \fCpop_back\fP, such as std::list, std::vector, or an appropriate user-defined type\&. .PP Members not found in \fInormal\fP containers are \fCcontainer_type\fP, which is a typedef for the second Sequence parameter, and \fCpush\fP, \fCpop\fP, and \fCtop\fP, which are standard stack/FILO operations\&. .SH "Constructor & Destructor Documentation" .PP .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> template<\fBtypename\fP \fB_Seq\fP = _Sequence, \fBtypename\fP _Requires = typename enable_if::value>::type> \fBstd::stack\fP< _Tp, _Sequence >::stack ()\fC [inline]\fP" .PP Default constructor creates no elements\&. .SH "Member Function Documentation" .PP .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> bool \fBstd::stack\fP< _Tp, _Sequence >::empty () const\fC [inline]\fP" Returns true if the stack is empty\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBvoid\fP \fBstd::stack\fP< _Tp, _Sequence >::pop ()\fC [inline]\fP" .PP 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\&. .PP Note that no data is returned, and if the first element's data is needed, it should be retrieved before pop() is called\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBvoid\fP \fBstd::stack\fP< _Tp, _Sequence >::push (const value_type & __x)\fC [inline]\fP" .PP Add data to the top of the stack\&. .PP \fBParameters\fP .RS 4 \fI__x\fP Data to be added\&. .RE .PP 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\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> size_type \fBstd::stack\fP< _Tp, _Sequence >::size () const\fC [inline]\fP" Returns the number of elements in the stack\&. .br .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> reference \fBstd::stack\fP< _Tp, _Sequence >::top ()\fC [inline]\fP" Returns a read/write reference to the data at the first element of the stack\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> const_reference \fBstd::stack\fP< _Tp, _Sequence >::top () const\fC [inline]\fP" Returns a read-only (constant) reference to the data at the first element of the stack\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.