vector - STL C++

vector<X, A>::crend()

Declaration

const_reverse_iterator vector<X,A>::crend() const;

Description

This is the crend() function for the vector class template.

Header Include

#include <vector>

Example

#include <iostream>
#include <vector>

int main()
{
	using namespace std;

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

	// Output the entries, using a const reverse iterator, crbegin(), and crend()
	vector<char>::const_reverse_iterator qIter;
	cout << "V = ";
		for (qIter = qV.crbegin(); qIter != qV.crend(); ++qIter) {
			cout << *qIter;
		}
	cout << endl;

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

Output

vector<X, A>::crend() Output
 

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