.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, \fBconst\fP _Alloc &__a)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (\fBconst\fP _Alloc &__a)" .br .ti -1c .RI "\fBstack\fP (\fBconst\fP _Sequence &__c)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (\fBconst\fP _Sequence &__c, \fBconst\fP _Alloc &__a)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (\fBconst\fP \fBstack\fP &__q, \fBconst\fP _Alloc &__a)" .br .ti -1c .RI "template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstack\fP (\fBstack\fP &&__q, \fBconst\fP _Alloc &__a)" .br .ti -1c .RI "template \fBvoid\fP \fBemplace\fP (\fB_Args\fP &&\&.\&.\&. \fB__args\fP)" .br .ti -1c .RI "_GLIBCXX_NODISCARD bool \fBempty\fP () \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBpop\fP ()" .br .RI "Removes first element\&. " .ti -1c .RI "\fBvoid\fP \fBpush\fP (\fBconst\fP 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 () \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBswap\fP (\fBstack\fP &\fB__s\fP) \fBnoexcept\fP(__is_nothrow_swappable< _Sequence >::value)" .br .ti -1c .RI "reference \fBtop\fP ()" .br .ti -1c .RI "const_reference \fBtop\fP () \fBconst\fP" .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 (\fBconst\fP \fBstack\fP< \fB_Tp1\fP, \fB_Seq1\fP > &, \fBconst\fP \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 (\fBconst\fP \fBstack\fP< \fB_Tp1\fP, \fB_Seq1\fP > &, \fBconst\fP \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\&. .PP Definition at line \fB99\fP of file \fBstl_stack\&.h\fP\&. .SH "Member Typedef Documentation" .PP .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBtypedef\fP _Sequence::const_reference \fBstd::stack\fP< _Tp, _Sequence >::const_reference" .PP Definition at line \fB136\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBtypedef\fP _Sequence \fBstd::stack\fP< _Tp, _Sequence >::container_type" .PP Definition at line \fB138\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBtypedef\fP _Sequence::reference \fBstd::stack\fP< _Tp, _Sequence >::reference" .PP Definition at line \fB135\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBtypedef\fP _Sequence::size_type \fBstd::stack\fP< _Tp, _Sequence >::size_type" .PP Definition at line \fB137\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBtypedef\fP _Sequence::value_type \fBstd::stack\fP< _Tp, _Sequence >::value_type" .PP Definition at line \fB134\fP of file \fBstl_stack\&.h\fP\&. .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\&. .PP Definition at line \fB156\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBstd::stack\fP< _Tp, _Sequence >::stack (\fBconst\fP _Sequence & __c)\fC [inline]\fP, \fC [explicit]\fP" .PP Definition at line \fB160\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBstd::stack\fP< _Tp, _Sequence >::stack (_Sequence && __c)\fC [inline]\fP, \fC [explicit]\fP" .PP Definition at line \fB164\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstd::stack\fP< _Tp, _Sequence >::stack (\fBconst\fP _Alloc & __a)\fC [inline]\fP, \fC [explicit]\fP" .PP Definition at line \fB169\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstd::stack\fP< _Tp, _Sequence >::stack (\fBconst\fP _Sequence & __c, \fBconst\fP _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB173\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstd::stack\fP< _Tp, _Sequence >::stack (_Sequence && __c, \fBconst\fP _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB177\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstd::stack\fP< _Tp, _Sequence >::stack (\fBconst\fP \fBstack\fP< _Tp, _Sequence > & __q, \fBconst\fP _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB181\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> template<\fBtypename\fP _Alloc , \fBtypename\fP _Requires = _Uses<_Alloc>> \fBstd::stack\fP< _Tp, _Sequence >::stack (\fBstack\fP< _Tp, _Sequence > && __q, \fBconst\fP _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB185\fP of file \fBstl_stack\&.h\fP\&. .SH "Member Function Documentation" .PP .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> template \fBvoid\fP \fBstd::stack\fP< _Tp, _Sequence >::emplace (\fB_Args\fP &&\&.\&.\&. __args)\fC [inline]\fP" .PP Definition at line \fB249\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> _GLIBCXX_NODISCARD bool \fBstd::stack\fP< _Tp, _Sequence >::empty () const\fC [inline]\fP" Returns true if the stack is empty\&. .PP Definition at line \fB193\fP of file \fBstl_stack\&.h\fP\&. .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\&. .PP Definition at line \fB266\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBvoid\fP \fBstd::stack\fP< _Tp, _Sequence >::push (\fBconst\fP 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\&. .PP Definition at line \fB233\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBvoid\fP \fBstd::stack\fP< _Tp, _Sequence >::push (value_type && __x)\fC [inline]\fP" .PP Definition at line \fB238\fP of file \fBstl_stack\&.h\fP\&. .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\&. .PP Definition at line \fB198\fP of file \fBstl_stack\&.h\fP\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> \fBvoid\fP \fBstd::stack\fP< _Tp, _Sequence >::swap (\fBstack\fP< _Tp, _Sequence > & __s)\fC [inline]\fP, \fC [noexcept]\fP" .PP Definition at line \fB274\fP of file \fBstl_stack\&.h\fP\&. .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\&. .PP Definition at line \fB206\fP of file \fBstl_stack\&.h\fP\&. .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\&. .PP Definition at line \fB217\fP of file \fBstl_stack\&.h\fP\&. .SH "Member Data Documentation" .PP .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Sequence = deque<_Tp>> _Sequence \fBstd::stack\fP< _Tp, _Sequence >::c\fC [protected]\fP" .PP Definition at line \fB142\fP of file \fBstl_stack\&.h\fP\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.