deque - STL C++

deque<X, A>::at()

Declaration

reference deque<X,A>::at(size_type qIndex);

Description

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

Header Include

#include <deque>

Overloads

const_reference deque<X,A>::at(size_type qIndex) const;

Example

#include <iostream>
#include <deque>

int main()
{
	using namespace std;

	// Create a deque instance
	deque<int> qD;
	qD.push_back(3);
	qD.push_back(4);

	int& irIntRef = qD.at(0);
	const int& kirConstIntRef = qD.at(1);

	cout << "D[0] = " << irIntRef << endl;
	cout << "D[1] = " << kirConstIntRef << endl;

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

Output

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

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