vector - STL C++

vector<X, A>::rend()

Declaration

reverse_iterator vector<X,A>::rend();

Description

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

Header Include

#include <vector>

Overloads

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

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 rbegin() and rend()
	vector<char>::reverse_iterator qIter;
	for (qIter = qV.rbegin(); qIter != qV.rend(); ++qIter) {
		cout << *qIter;
	}
	cout << endl;

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

Output

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

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