deque - STL C++

deque<X, A>::pop_front()

Declaration

void deque<X,A>::pop_front();

Description

This is the pop_front() function for the deque class template.

Header Include

#include <deque>

Example

#include <iostream>
#include <deque>

int main()
{
	using namespace std;

	// Create a deque instance
	deque<char> qD;
	qD.push_back('X');
	qD.push_back('o');
	qD.push_back('a');
	qD.push_back('X');
	qD.push_back('.');
	qD.push_back('n');
	qD.push_back('e');
	qD.push_back('t');

	// Output the deque before
	deque<char>::iterator qIter;
	cout << "Deque before = ";
	for (qIter = qD.begin(); qIter != qD.end(); ++qIter) {
		cout << *qIter;
	}
	cout << endl;

	cout << "Pop off the first four entries" << endl;
	qD.pop_front();
	qD.pop_front();
	qD.pop_front();
	qD.pop_front();

	// Output the deque after
	cout << "Deque after = ";
	for (qIter = qD.begin(); qIter != qD.end(); ++qIter) {
		cout << *qIter;
	}
	cout << endl;

	// Keep the window open
	cin.get();
	return 0;
}

Output

deque<X, A>::pop_front() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.