std::list<T,Allocator>::pop_back
Min standard notice:
Removes the last element of the container.
# Declarations
void pop_back();
# Return value
(none)
# Example
#include <list>
#include <iostream>
namespace stq {
template<typename T>
void println(auto, const T& xz)
{
std::cout << '[';
bool first{true};
for (auto const& x : xz)
std::cout << (first ? first = false, "" : ", ") << x;
std::cout << "]\n";
}
}
int main()
{
std::list<int> numbers{1, 2, 3};
stq::println("{}", numbers);
while (not numbers.empty())
{
numbers.pop_back();
stq::println("{}", numbers);
}
}