This is an internal header file, included by other library headers. More...
Functions | |
namespace std | _GLIBCXX_VISIBILITY (default) |
This is an internal header file, included by other library headers.
Do not attempt to use it directly. {queue}
namespace std _GLIBCXX_VISIBILITY | ( | default | ) |
A standard container giving FIFO behavior.
_Tp | Type of element. |
_Sequence | Type of underlying sequence, defaults to deque<_Tp>. |
Meets many of the requirements of a container, but does not define anything to do with iterators. Very few of the other standard container interfaces are defined.
This is not a true container, but 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 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.
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.
'c' is the underlying container. Maintainers wondering why this isn't uglified as per style guidelines should note that this name is specified in the standard, [23.2.3.1]. (Why? Presumably for the same reason that it's protected instead of private: to allow derivation. But none of the other containers allow for derivation. Odd.)
Default constructor creates no elements.
Returns true if the queue is empty.
Returns the number of elements in the queue.
Returns a read/write reference to the data at the first element of the queue.
Returns a read-only (constant) reference to the data at the first element of the queue.
Returns a read/write reference to the data at the last element of the queue.
Returns a read-only (constant) reference to the data at the last element of the queue.
Add data to the end of the queue.
__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.
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 before pop() is called.
Queue equality comparison.
__x | A queue. |
__y | A queue of the same type as __x. |
This is an equivalence relation. Complexity and semantics depend on the underlying sequence type, but the expected rules are: this relation is linear in the size of the sequences, and queues are considered equivalent if their sequences compare equal.
Queue ordering relation.
__x | A queue. |
__y | A queue of the same type as x. |
This is an total ordering relation. Complexity and semantics depend on the underlying sequence type, but the expected rules are: this relation is linear in the size of the sequences, the elements must be comparable with <
, and std::lexicographical_compare() is usually used to make the determination.
Based on operator==
Based on operator<
Based on operator<
Based on operator<
A standard container automatically sorting its contents.
_Tp | Type of element. |
_Sequence | Type of underlying sequence, defaults to vector<_Tp>. |
_Compare | Comparison function object type, defaults to less<_Sequence::value_type>. |
This is not a true container, but an adaptor. It holds another container, and provides a wrapper interface to that container. The wrapper is what enforces priority-based sorting and queue behavior. Very few of the standard container/sequence interface requirements are met (e.g., iterators).
The second template parameter defines the type of the underlying sequence/container. It defaults to std::vector, but it can be any type that supports front()
, push_back
, pop_back
, and random-access iterators, such as std::deque or an appropriate user-defined type.
The third template parameter supplies the means of making priority comparisons. It defaults to less<value_type>
but can be anything defining a strict weak ordering.
Members not found in normal containers are container_type
, which is a typedef for the second Sequence parameter, and push
, pop
, and top
, which are standard queue operations.
Default constructor creates no elements.
Builds a queue from a range.
__first | An input iterator. |
__last | An input iterator. |
__x | A comparison functor describing a strict weak ordering. |
__s | An initial sequence with which to start. |
Begins by copying __s, inserting a copy of the elements from [first,last) into the copy of __s, then ordering the copy according to __x.
For more information on function objects, see the documentation on functor base classes.
Returns true if the queue is empty.
Returns the number of elements in the queue.
Returns a read-only (constant) reference to the data at the first element of the queue.
Add data to the queue.
__x | Data to be added. |
This is a typical queue operation. The time complexity of the operation depends on the underlying sequence.
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 before pop() is called.
References __glibcxx_class_requires, __glibcxx_class_requires2, __glibcxx_class_requires4, __glibcxx_requires_nonempty, __glibcxx_requires_valid_range, std::__exception_ptr::operator!=(), std::__exception_ptr::operator==(), __gnu_debug::operator>(), __gnu_debug::operator>=(), and std::__exception_ptr::swap().