STD::QUEUE(3)
π NAME π
okay bestie, welcome to the Library Functions Manual, section 3 β this is where the C++ girlies live π
std::queue< _Tp, _Sequence > β a standard container giving FIFO behavior. first in, first out, no cutting the line, periodt π
πΈ SYNOPSIS πΈ
#include <queue>
β¨ Public Types β¨
typedef _Sequence::const_reference const_referencetypedef _Sequence container_typetypedef _Sequence::reference referencetypedef _Sequence::size_type size_typetypedef _Sequence::value_type value_type
β¨ Public Member Functions β¨
template<typename _Seq = _Sequence, typename _Requires = typename enable_if<is_default_constructible<_Seq>::value>::type> queue ()
β Default constructor creates no elements.
queue (_Sequence &&__c)
template<typename _Alloc, typename _Requires = _Uses<_Alloc>> queue (_Sequence &&__c, const _Alloc &__a)
template<typename _Alloc, typename _Requires = _Uses<_Alloc>> queue (const _Alloc &__a)
queue (const _Sequence &__c)
template<typename _Alloc, typename _Requires = _Uses<_Alloc>> queue (const _Sequence &__c, const _Alloc &__a)
template<typename _Alloc, typename _Requires = _Uses<_Alloc>> queue (const queue &__q, const _Alloc &__a)
template<typename _Alloc, typename _Requires = _Uses<_Alloc>> queue (queue &&__q, const _Alloc &__a)
reference back ()
const_reference back () const
template<typename... _Args> decltype(auto) emplace (_Args &&... __args)
bool empty () const
reference front ()
const_reference front () const
void pop ()
β Removes first element.
void push (const value_type &__x)
β Add data to the end of the queue.
void push (value_type &&__x)
size_type size () const
void swap (queue &__q) noexcept(__is_nothrow_swappable< _Sequence >::value)
β¨ Protected Attributes β¨
_Sequence cβcis the underlying container.
β¨ Friends β¨
template<typename _Tp1, typename _Seq1> bool operator< (const queue< _Tp1, _Seq1 > &, const queue< _Tp1, _Seq1 > &)
template<typename _Tp1, three_way_comparable _Seq1> compare_three_way_result_t< _Seq1 > operator<=> (const queue< _Tp1, _Seq1 > &, const queue< _Tp1, _Seq1 > &)
template<typename _Tp1, typename _Seq1> bool operator== (const queue< _Tp1, _Seq1 > &, const queue< _Tp1, _Seq1 > &)
π¦ Detailed Description π¦
template<typename _Tp, typename _Sequence = deque<_Tp>>
class std::queue< _Tp, _Sequence >
A standard container giving FIFO behavior. β¨
π Template Parameters π
_Tpβ Type of element._Sequenceβ Type of underlying sequence, defaults todeque<_Tp>.
so here's the tea β β this thing meets many of the requirements of a container, but it does not define anything to do with iterators. and like, very few of the other standard container interfaces are defined. she's minimal, she's mysterious, she's not gonna give you everything π
this is not a true container, bestie β it's an adaptor. it holds another container, and provides a wrapper interface to that container. the wrapper is what enforces strict first-in-first-out queue behavior. the drama? the wrapper. the rules? also the wrapper. π
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 front, back, push_back, and pop_front, such as std::list or an appropriate user-defined type. so flexible, so chic π
members not found in normal containers are container_type, which is a typedef for the second Sequence parameter, and push and pop, which are standard queue/FIFO operations. iconic behavior honestly π
π Constructor & Destructor Documentation π
template<typename _Tp, typename _Sequence = deque<_Tp>> template<typename _Seq = _Sequence, typename _Requires = typename enable_if<is_default_constructible<_Seq>::value>::type> std::queue< _Tp, _Sequence >::queue () [inline]
Default constructor creates no elements. empty girl era, no cap π«Ά
References c.
π Member Function Documentation π
template<typename _Tp, typename _Sequence = deque<_Tp>> reference std::queue< _Tp, _Sequence >::back () [inline], [nodiscard]
Returns a read/write reference to the data at the last element of the queue. so you can peek the back AND change it, main character energy π
References c.
template<typename _Tp, typename _Sequence = deque<_Tp>> const_reference std::queue< _Tp, _Sequence >::back () const [inline], [nodiscard]
Returns a read-only (constant) reference to the data at the last element of the queue. look, don't touch π
References c.
template<typename _Tp, typename _Sequence = deque<_Tp>> bool std::queue< _Tp, _Sequence >::empty () const [inline], [nodiscard]
Returns true if the queue is empty. vibe check: is she empty? π
References c.
template<typename _Tp, typename _Sequence = deque<_Tp>> reference std::queue< _Tp, _Sequence >::front () [inline], [nodiscard]
Returns a read/write reference to the data at the first element of the queue. the girl at the front of the line, and yes you can edit her β¨
References c.
template<typename _Tp, typename _Sequence = deque<_Tp>> const_reference std::queue< _Tp, _Sequence >::front () const [inline], [nodiscard]
Returns a read-only (constant) reference to the data at the first element of the queue. read her, don't rewrite her π
References c.
template<typename _Tp, typename _Sequence = deque<_Tp>> void std::queue< _Tp, _Sequence >::pop () [inline]
Removes first element. this is a typical queue operation β it shrinks the queue 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 beforepop()is called. so grabfront()first, bestie, or that data is GONE π
References c.
template<typename _Tp, typename _Sequence = deque<_Tp>> void std::queue< _Tp, _Sequence >::push (const value_type & __x) [inline]
Add data to the end of the queue. get in line, girl πΆββοΈ
Parameters
__xβ Data to be added.
this is a typical queue operation. the function creates an element at the end of the queue and assigns the given data to it. the time complexity of the operation depends on the underlying sequence. π¦
References c.
template<typename _Tp, typename _Sequence = deque<_Tp>> size_type std::queue< _Tp, _Sequence >::size () const [inline], [nodiscard]
Returns the number of elements in the queue. how many girlies are in the line? π
References c.
π Member Data Documentation π
template<typename _Tp, typename _Sequence = deque<_Tp>> _Sequence std::queue< _Tp, _Sequence >::c [protected]
c is the underlying container. the real one behind the scenes, the one carrying the whole operation π
Referenced by queue(), back(), back(), empty(), front(), front(), std::operator<(), std::operator==(), pop(), push(), and size().
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. no thoughts, just generated π
and that's the whole page, bestie!! π generated automatically by Doxygen for libstdc++ from the source code β libstdc++, std::queue...Sequence >(3), mwah, slay, go write some FIFO code πβ¨π¦
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms