queue Flashcards
Element access
front( )
access the first element
Parameters
(none)
Return value
Reference to the first element.
Complexity
Constant
Element access
back( )
access the last element
Parameters
(none)
Return value
reference to the last element
Complexity
Constant
Capacity
empty( )
checks whether the underlying container is empty
Parameters
(none)
Return value
true if the underlying container is empty, false otherwise
Complexity
Constant
Capacity
size( )
returns the number of elements
Parameters
(none)
Return value
The number of elements in the container.
Complexity
Constant.
Modifiers
push( )
inserts element at the end Parameters value - the value of the element to push Return value (none)
Complexity
Equal to the complexity of Container::push_back.
Modifiers
emplace( )
constructs element in-place at the end
Parameters
args - arguments to forward to the constructor of the element
Return value
(none) (until C++17)
The value or reference, if any, returned by the above call to Container::emplace_back. (since C++17)
Complexity
Identical to the complexity of Container::emplace_back.
Modifiers
pop( )
removes the first element
Parameters
(none)
Return value (none)
Complexity
Equal to the complexity of Container::pop_front.
Modifiers
swap( )
swaps the contents Parameters other - container adaptor to exchange the contents with Return value (none)
Exceptions
noexcept specification:
noexcept(noexcept(swap(c, other.c)))
In the expression above, the identifier swap is looked up in the same manner as the one used by the C++17 std::is_nothrow_swappable trait.
(since C++11) (until C++17) noexcept specification: noexcept(std::is_nothrow_swappable_v) (since C++17) Complexity Same as underlying container (typically constant).