deque - STL C++

deque<X, A>::difference_type

Declaration

typedef (address-sized int) deque<X, A>::difference_type;

Description

This is a type definition of the data type difference_type for the deque class template. This is used to define the type that specifies the difference between the positions of two iterators.

Header Include

#include <deque>

Example

#include <iostream>
#include <deque>

int main()
{
	using namespace std;

	// Create a deque and add four elements to it
	deque<int> qDeque;
	qDeque.push_back(5);
	qDeque.push_back(101);
	qDeque.push_back(-4);
	qDeque.push_back(32);

	// Get the difference between the ends and output it
	deque<int>::difference_type qDiff = (qDeque.end() - qDeque.begin());
	cout << "The difference is " << qDiff << endl;

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

Output

deque<X, A>::difference_type Output
 

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