std::deque pop_back() method
- since C++98
// Non const version only
void pop_back();
Removes the first element of the container.
Calling pop_front
on an empty container results in undefined behavior
- since C++11
- until C++11
Iterators and references to the erased element are invalidated.
The past-the-end iterator is also invalidated.
Other references and iterators are not affected.
Iterators and references to the erased element are invalidated.
It is unspecified whether the past-the-end iterator is invalidated.
Other references and iterators are not affected.
Parameters
(none)
Return value
(none)
Complexity
Constant - O(1).
Exceptions
(none)
Example
#include <deque>
#include <iostream>
int main()
{
std::deque<char> chars{'A', 'B', 'C', 'D'};
for (; !chars.empty(); chars.pop_front())
{
std::cout << "chars.front(): '" << chars.front() << "'\n";
}
}
chars.front(): 'A'
chars.front(): 'B'
chars.front(): 'C'
chars.front(): 'D'
Hover to see the original license.