deque - STL C++

deque<X, A>::front()

Declaration

reference deque<X,A>::front();

Description

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

Header Include

#include <deque>

Overloads

const_reference deque<X,A>::front() const;

Example

#include <iostream>
#include <deque>

int main()
{
	using namespace std;

	// Create two deque instances
	deque<int> qD1;
	qD1.push_back(3);
	qD1.push_back(4);

	deque<int> qD2;
	qD2.push_back(9);
	qD2.push_back(7);

	// Get references to the first entries
	int& irIntRef = qD1.front();
	const int& kirConstIntRef = qD2.front();

	cout << "The first entry of D1 = " << irIntRef << endl;
	cout << "The first entry of D2 = " << kirConstIntRef << endl;

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

Output

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

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