bsl::queue

FIFO queue adapter over a container of VALUE elements.

Synopsis

Declared in <bslstl_queue.h>

template<
    class VALUE,
    class CONTAINER = deque<VALUE>>
class queue;

Description

This class is a value-semantic class template, having a container of the parameterized CONTAINER type that holds elements of the parameterized VALUE type, to provide a first-in-first-out queue data structure. The container object held by a queue class object is referenced as c in the following function-level documentation.

Type Aliases

NameDescription
const_reference This typedef is an alias to CONTAINER::const_reference.
container_type This typedef is an alias for the adapted container type.
reference This typedef is an alias to CONTAINER::reference.
size_type This typedef is an alias to CONTAINER::size_type.
value_type This typedef is an alias to CONTAINER::value_type.

Member Functions

NameDescription
queue [constructor]Constructors
operator= Assignment operators
back back overloads
emplace Emplace a newly constructed element onto the back of this queue.
empty Return true if this queue object contains no elements, and false otherwise. In effect, performs return c.empty();.
front front overloads
pop Remove the front (the earliest pushed) element from this queue object.
push push overloads
push_range Push the elements of range onto the back of this queue.
size Return the number of elements in this queue. In effect, performs return c.size();.
swap Efficiently exchange the value of this object with other.
operator BloombergLP::bslmf::NestedTraitDeclaration<queue, UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator<container_type>::value> Declare that queue uses a bslma allocator when its container does.

Protected Data Members

NameDescription
c Contains the elements of this queue. This member is protected and named c per the C++11 standard.

Deduction Guides

NameDescription
queue<TYPE> Deduce the template parameter VALUE from the parameters supplied to the constructor of queue.
queue<TYPE, deque<TYPE, ALLOCATOR>> Deduce VALUE and CONTAINER from iterator-pair and allocator arguments.
queue<t_TYPE, deque<t_TYPE, t_ALLOCATOR>> Deduce VALUE and ALLOCATOR from range and allocator arguments.
queue<CONTAINER::value_type, CONTAINER> Deduce VALUE and CONTAINER from a container constructor argument.
queue<CONTAINER::value_type, CONTAINER> Deduce VALUE and CONTAINER from container and allocator arguments.
queue<ranges::range_value_t<t_RANGE>> Deduce the template parameter VALUE from the parameters supplied to the constructor of queue.

Friends

NameDescription
bsl::operator<=>Return the three-way comparison of the specified queues; see the non-member operator<=> in the bsl namespace.
bsl::operator>=Return whether the specified queues compare lexicographically; see the non-member operator>= in the bsl namespace.
bsl::operator<=Return whether the specified queues compare lexicographically; see the non-member operator<= in the bsl namespace.
bsl::operator>Return whether the specified queues compare lexicographically; see the non-member operator> in the bsl namespace.
bsl::operator<Return whether the specified queues compare lexicographically; see the non-member operator< in the bsl namespace.
bsl::operator!=Return whether the specified queues do not have the same value; see the non-member operator!= in the bsl namespace.
bsl::operator==Return whether the specified queues have the same value; see the non-member operator== in the bsl namespace.

Non-Member Functions

NameDescription
operator!=Return true if lhs and rhs do not have the same value.
operator<Return true if lhs is lexicographically less than rhs.
operator<=Return true if lhs is lexicographically less than or equal to rhs.
operator<=>Return the three-way comparison result of lhs and rhs.
operator==Return true if lhs and rhs have the same value.
operator>Return true if lhs is lexicographically greater than rhs.
operator>=Return true if lhs is lexicographically greater than or equal to rhs.
swapSwap the values of the specified lhs and rhs queues.