[#bsl-queue-0a5] = xref:bsl.adoc[bsl]::queue :relfileprefix: ../ :mrdocs: 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. == Synopsis Declared in `<bslstl_queue.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class VALUE, class CONTAINER = xref:bsl/deque-0c.adoc[deque<VALUE>]> class queue; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/queue-0a5/const_reference.adoc[`const_reference`] | This `typedef` is an alias to `CONTAINER::const_reference`. | xref:bsl/queue-0a5/container_type.adoc[`container_type`] | This `typedef` is an alias for the adapted container type. | xref:bsl/queue-0a5/reference.adoc[`reference`] | This `typedef` is an alias to `CONTAINER::reference`. | xref:bsl/queue-0a5/size_type.adoc[`size_type`] | This `typedef` is an alias to `CONTAINER::size_type`. | xref:bsl/queue-0a5/value_type.adoc[`value_type`] | This `typedef` is an alias to `CONTAINER::value_type`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/queue-0a5/2constructor-09f.adoc[`queue`] [.small]#[constructor]# | Constructors | xref:bsl/queue-0a5/operator_assign-04.adoc[`operator=`] | Assignment operators | xref:bsl/queue-0a5/back-0d76.adoc[`back`] | `back` overloads | xref:bsl/queue-0a5/emplace.adoc[`emplace`] | Push onto this queue a newly created `value_type` object constructed by forwarding `get_allocator()` (if required) and the specified (variable number of) `args` to the corresponding constructor of `value_type`. Return a reference providing modifiable access to the inserted element. | xref:bsl/queue-0a5/empty.adoc[`empty`] | Return `true` if this `queue` object contains no elements, and `false` otherwise. In effect, performs `return c.empty();`. | xref:bsl/queue-0a5/front-06.adoc[`front`] | `front` overloads | xref:bsl/queue-0a5/pop.adoc[`pop`] | Remove the front (the earliest pushed) element from this `queue` object. | xref:bsl/queue-0a5/push-0c.adoc[`push`] | `push` overloads | xref:bsl/queue-0a5/push_range.adoc[`push_range`] | Push onto the back of this queue the elements of the specified `range`. Note that `range` must meet the requirements of an input range and the values from `range` must have a type matching or convertible to (template parameter) `VALUE`. | xref:bsl/queue-0a5/size.adoc[`size`] | Return the number of elements in this queue. In effect, performs `return c.size();`. | xref:bsl/queue-0a5/swap.adoc[`swap`] | Efficiently exchange the value of this object with the value of the specified `other` object. In effect, performs `using bsl::swap; swap(c, other.c);`. | xref:bsl/queue-0a5/2conversion.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:bsl/queue-0a5/c.adoc[`c`] | Contains the elements of this queue. This member is `protected` and named `c` per the C++11 standard. |=== == Deduction Guides [cols="1,4"] |=== | Name| Description | xref:bsl/queue-05.adoc[`queue<TYPE>`] | Deduce the template parameter `VALUE` from the parameters supplied to the constructor of `queue`. | xref:bsl/queue-0aa.adoc[`queue<TYPE, deque<TYPE, ALLOCATOR>>`] | Deduce the template parameters `VALUE` and `CONTAINER` from the parameters supplied to the constructor of `queue`. This deduction guide does not participate unless the `ALLOCATOR` parameter meets the requirements for a standard allocator. | xref:bsl/queue-0ad.adoc[`queue<t_TYPE, deque<t_TYPE, t_ALLOCATOR>>`] | Deduce the template parameters `VALUE` and `ALLOCATOR` from the parameters supplied to the constructor of `queue`. This deduction guide does not participate unless the `t_ALLOCATOR` parameter meets the requirements for a standard allocator. | xref:bsl/queue-09.adoc[`queue<CONTAINER::value_type, CONTAINER>`] | Deduce the template parameters `VALUE` and `CONTAINER` from the parameters supplied to the constructor of `queue`. This deduction guide does not participate if the parameter meets the requirements for a standard allocator. | xref:bsl/queue-0a3.adoc[`queue<CONTAINER::value_type, CONTAINER>`] | Deduce the template parameters `VALUE` and `CONTAINER` from the parameters supplied to the constructor of `queue`. This deduction guide does not participate unless the supplied allocator is convertible to the underlying container's `allocator_type`. | xref:bsl/queue-0c.adoc[`queue<ranges::range_value_t<t_RANGE>>`] | Deduce the template parameter `VALUE` from the parameters supplied to the constructor of `queue`. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:bsl/operator_3way-036.adoc[bsl::operator<=>]` | Return the three‐way comparison of the specified queues; see the non‐member `operator<=>` in the `bsl` namespace. | `xref:bsl/operator_ge-0c.adoc[bsl::operator>=]` | Return whether the specified queues compare lexicographically; see the non‐member `operator>=` in the `bsl` namespace. | `xref:bsl/operator_le-05.adoc[bsl::operator<=]` | Return whether the specified queues compare lexicographically; see the non‐member `operator<=` in the `bsl` namespace. | `xref:bsl/operator_gt-0b7.adoc[bsl::operator>]` | Return whether the specified queues compare lexicographically; see the non‐member `operator>` in the `bsl` namespace. | `xref:bsl/operator_lt-0e1.adoc[bsl::operator<]` | Return whether the specified queues compare lexicographically; see the non‐member `operator<` in the `bsl` namespace. | `xref:bsl/operator_not_eq-08a.adoc[bsl::operator!=]` | Return whether the specified queues do not have the same value; see the non‐member `operator!=` in the `bsl` namespace. | `xref:bsl/operator_eq-09b.adoc[bsl::operator==]` | Return whether the specified queues have the same value; see the non‐member `operator==` in the `bsl` namespace. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/operator_not_eq-0900.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` objects do not have the same value, and `false` otherwise. Two `queue` objects `lhs` and `rhs` do not have the same value if they do not have the same number of elements, or some element in the ordered sequence of elements of `lhs` does not have the same value as the corresponding element in the ordered sequence of elements of `rhs`. This method requires that the (template parameter) type `VALUE` be `equality‐comparable` (see {Requirements on `VALUE`}). | xref:bsl/operator_lt-0ef.adoc[`operator<`] | Return `true` if the value of the specified `lhs` queue is lexicographically less than that of the specified `rhs` queue, and `false` otherwise. Given iterators `i` and `j` over the respective sequences `[lhs.begin() .. lhs.end())]` and `[rhs.begin() .. rhs.end())]`, the value of queue `lhs` is lexicographically less than that of queue `rhs` if `true == *i < *j` for the first pair of corresponding iterator positions where `*i < *j` and `*j < *i` are not both `false`. If no such corresponding iterator position exists, the value of `lhs` is lexicographically less than that of `rhs` if `lhs.size() < rhs.size()`. This method requires that `operator<`, inducing a total order, be defined for `value_type`. | xref:bsl/operator_le-09.adoc[`operator<=`] | Return `true` if the value of the specified `lhs` queue is lexicographically less than or equal to that of the specified `rhs` queue, and `false` otherwise. The value of queue `lhs` is lexicographically less than or equal to that of queue `rhs` if `rhs` is not lexicographically less than `lhs` (see `operator<`). This method requires that `operator<`, inducing a total order, be defined for `value_type`. Note that this operator returns `!(rhs < lhs)`. | xref:bsl/operator_3way-08d.adoc[`operator<=>`] | Return the three‐way comparison result of the specified `lhs` and `rhs` queues by comparing their underlying containers. | xref:bsl/operator_eq-0aef.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise. Two `queue` objects `lhs` and `rhs` have the same value if they have the same number of elements, and each element in the ordered sequence of elements of `lhs` has the same value as the corresponding element in the ordered sequence of elements of `rhs`. This method requires that the (template parameter) type `VALUE` be `equality‐comparable` (see {Requirements on `VALUE`}). | xref:bsl/operator_gt-09.adoc[`operator>`] | Return `true` if the value of the specified `lhs` queue is lexicographically greater than that of the specified `rhs` queue, and `false` otherwise. The value of queue `lhs` is lexicographically greater than that of queue `rhs` if `rhs` is lexicographically less than `lhs` (see `operator<`). This method requires that `operator<`, inducing a total order, be defined for `value_type`. Note that this operator returns `rhs < lhs`. | xref:bsl/operator_ge-07d.adoc[`operator>=`] | Return `true` if the value of the specified `lhs` queue is lexicographically greater than or equal to that of the specified `rhs` queue, and `false` otherwise. The value of queue `lhs` is lexicographically greater than or equal to that of queue `rhs` if `lhs` is not lexicographically less than `rhs` (see `operator<`). This method requires that `operator<`, inducing a total order, be defined for `value_type`. Note that this operator returns `!(lhs < rhs)`. | xref:bsl/swap-020.adoc[`swap`] | Swap the value of the specified `lhs` queue with the value of the specified `rhs` queue. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#