.TH "std::stack< _Tp, _Sequence >" 3cxx "Sun Jan 8 2023" "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 "typedef _Sequence::const_reference \fBconst_reference\fP" .br .ti -1c .RI "typedef _Sequence \fBcontainer_type\fP" .br .ti -1c .RI "typedef _Sequence::reference \fBreference\fP" .br .ti -1c .RI "typedef _Sequence::size_type \fBsize_type\fP" .br .ti -1c .RI "typedef _Sequence::value_type \fBvalue_type\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "template::value>::type> \fBstack\fP ()" .br .RI "Default constructor creates no elements\&. " .ti -1c .RI "\fBstack\fP (_Sequence &&__c)" .br .ti -1c .RI "template> \fBstack\fP (_Sequence &&__c, const _Alloc &__a)" .br .ti -1c .RI "template> \fBstack\fP (const _Alloc &__a)" .br .ti -1c .RI "\fBstack\fP (const _Sequence &__c)" .br .ti -1c .RI "template> \fBstack\fP (const _Sequence &__c, const _Alloc &__a)" .br .ti -1c .RI "template> \fBstack\fP (const \fBstack\fP &__q, const _Alloc &__a)" .br .ti -1c .RI "template> \fBstack\fP (\fBstack\fP &&__q, const _Alloc &__a)" .br .ti -1c .RI "template decltype(auto) \fBemplace\fP (_Args &&\&.\&.\&. __args)" .br .ti -1c .RI "bool \fBempty\fP () const" .br .ti -1c .RI "void \fBpop\fP ()" .br .RI "Removes first element\&. " .ti -1c .RI "void \fBpush\fP (const value_type &__x)" .br .RI "Add data to the top of the stack\&. " .ti -1c .RI "void \fBpush\fP (value_type &&__x)" .br .ti -1c .RI "size_type \fBsize\fP () const" .br .ti -1c .RI "void \fBswap\fP (\fBstack\fP &__s) noexcept(__is_nothrow_swappable< _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 bool \fBoperator<\fP (const \fBstack\fP< _Tp1, _Seq1 > &, const \fBstack\fP< _Tp1, _Seq1 > &)" .br .ti -1c .RI "template bool \fBoperator==\fP (const \fBstack\fP< _Tp1, _Seq1 > &, const \fBstack\fP< _Tp1, _Seq1 > &)" .br .in -1c .SH "Detailed Description" .PP .SS "template> .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 \fBstack\fP\&. .SH "Member Typedef Documentation" .PP .SS "template> typedef _Sequence::const_reference \fBstd::stack\fP< _Tp, _Sequence >::const_reference" .PP Definition at line \fB142\fP of file \fBstack\fP\&. .SS "template> typedef _Sequence \fBstd::stack\fP< _Tp, _Sequence >::container_type" .PP Definition at line \fB144\fP of file \fBstack\fP\&. .SS "template> typedef _Sequence::reference \fBstd::stack\fP< _Tp, _Sequence >::reference" .PP Definition at line \fB141\fP of file \fBstack\fP\&. .SS "template> typedef _Sequence::size_type \fBstd::stack\fP< _Tp, _Sequence >::size_type" .PP Definition at line \fB143\fP of file \fBstack\fP\&. .SS "template> typedef _Sequence::value_type \fBstd::stack\fP< _Tp, _Sequence >::value_type" .PP Definition at line \fB140\fP of file \fBstack\fP\&. .SH "Constructor & Destructor Documentation" .PP .SS "template> template::value>::type> \fBstd::stack\fP< _Tp, _Sequence >::stack ()\fC [inline]\fP" .PP Default constructor creates no elements\&. .PP Definition at line \fB162\fP of file \fBstack\fP\&. .SS "template> \fBstd::stack\fP< _Tp, _Sequence >::stack (const _Sequence & __c)\fC [inline]\fP, \fC [explicit]\fP" .PP Definition at line \fB166\fP of file \fBstack\fP\&. .SS "template> \fBstd::stack\fP< _Tp, _Sequence >::stack (_Sequence && __c)\fC [inline]\fP, \fC [explicit]\fP" .PP Definition at line \fB170\fP of file \fBstack\fP\&. .SS "template> template> \fBstd::stack\fP< _Tp, _Sequence >::stack (const _Alloc & __a)\fC [inline]\fP, \fC [explicit]\fP" .PP Definition at line \fB185\fP of file \fBstack\fP\&. .SS "template> template> \fBstd::stack\fP< _Tp, _Sequence >::stack (const _Sequence & __c, const _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB189\fP of file \fBstack\fP\&. .SS "template> template> \fBstd::stack\fP< _Tp, _Sequence >::stack (_Sequence && __c, const _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB193\fP of file \fBstack\fP\&. .SS "template> template> \fBstd::stack\fP< _Tp, _Sequence >::stack (const \fBstack\fP< _Tp, _Sequence > & __q, const _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB197\fP of file \fBstack\fP\&. .SS "template> template> \fBstd::stack\fP< _Tp, _Sequence >::stack (\fBstack\fP< _Tp, _Sequence > && __q, const _Alloc & __a)\fC [inline]\fP" .PP Definition at line \fB201\fP of file \fBstack\fP\&. .SH "Member Function Documentation" .PP .SS "template> template decltype(auto) \fBstd::stack\fP< _Tp, _Sequence >::emplace (_Args &&\&.\&.\&. __args)\fC [inline]\fP" .PP Definition at line \fB271\fP of file \fBstack\fP\&. .SS "template> bool \fBstd::stack\fP< _Tp, _Sequence >::empty () const\fC [inline]\fP" Returns true if the stack is empty\&. .PP Definition at line \fB217\fP of file \fBstack\fP\&. .SS "template> void \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 \fB293\fP of file \fBstack\fP\&. .SS "template> void \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\&. .PP Definition at line \fB260\fP of file \fBstack\fP\&. .SS "template> void \fBstd::stack\fP< _Tp, _Sequence >::push (value_type && __x)\fC [inline]\fP" .PP Definition at line \fB265\fP of file \fBstack\fP\&. .SS "template> size_type \fBstd::stack\fP< _Tp, _Sequence >::size () const\fC [inline]\fP" Returns the number of elements in the stack\&. .br .PP Definition at line \fB223\fP of file \fBstack\fP\&. .SS "template> void \fBstd::stack\fP< _Tp, _Sequence >::swap (\fBstack\fP< _Tp, _Sequence > & __s)\fC [inline]\fP, \fC [noexcept]\fP" .PP Definition at line \fB301\fP of file \fBstack\fP\&. .SS "template> 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 \fB232\fP of file \fBstack\fP\&. .SS "template> 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 \fB244\fP of file \fBstack\fP\&. .SH "Member Data Documentation" .PP .SS "template> _Sequence \fBstd::stack\fP< _Tp, _Sequence >::c\fC [protected]\fP" .PP Definition at line \fB148\fP of file \fBstack\fP\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.