STL队列-FIFO

class template
<queue>

std::queue

template <class T, class Container = deque<T> > class queue;
FIFO queue
queues are a type of container adaptor, specifically designed to operate in a FIFO context (first-in first-out), where elements are inserted into one end of the container and extracted from the other.

queues are implemented as  containers adaptors, which are classes that use an encapsulated object of a specific container class as its  underlying container, providing a specific set of member functions to access its elements. Elements are  pushed into the  "back" of the specific container and  popped from its  "front".

The underlying container may be one of the standard container class template or some other specifically designed container class. This underlying container shall support at least the following operations:
  • front
  • back
  • push_back
  • pop_front

The standard container classes  deque and  list fulfill these requirements. By default, if no container class is specified for a particular  queue class instantiation, the standard container  deque is used.

Template parameters

T
Type of the elements.
Aliased as member type  queue::value_type.
Container
Type of the internal  underlying container object where the elements are stored.
Its  value_type shall be  T.
Aliased as member type  queue::container_type.

Member types

member type definition notes
value_typeThe first template parameter (T)Type of the elements
container_typeThe second template parameter (Container)Type of the underlying container
referencecontainer_type::referenceusually, value_type&
const_referencecontainer_type::const_referenceusually, const value_type&
size_typean unsigned integral typeusually, the same as size_t

Member functions


Non-member function overloads


Non-member class specializations


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值