vector_pro::rend¶
Return iterator to reverse beginning¶
Returns a iterator_pro pointing to the first element in the container and grows in a reverse way.
Parameters¶
none
Return value¶
A iterator_pro to the reverse end of the sequence.
Example¶
C++
// vector_pro::rbegin/rend
#include <iostream>
#include "vector_pro.h"
/**
* Output:
* myvector contains: 5 4 3 2 1
*/
int main ()
{
vector_pro<int> myvector (5, 0); // 5 default-constructed ints
int i=0;
iterator_pro<int> rit = myvector.rbegin();
for (; rit!= myvector.rend(); ++rit)
*rit = ++i;
std::cout << "myvector contains:";
for (auto it = myvector.begin(); it != myvector.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}
Complexity¶
Constant.