vector::crbegin
傳回指向向量中最後一個項目的常數 reverse_iterator。
const_reverse_iterator crbegin( ) const;
傳回值
定址 vector 中最後一個項目的常數反向隨機存取迭代器。
備註
有 crbegin 的傳回值時,無法修改 vector 物件。
範例
// vector_crbegin.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main( )
{
vector <int> vec;
vector <int>::iterator pos;
vector <int>::const_reverse_iterator crpos;
vec.push_back(1);
vec.push_back(2);
pos = vec.begin();
cout << "The first element of vector is "
<< *pos << "." << endl;
crpos = vec.crbegin();
cout << "The first element of the reversed vector is "
<< *crpos << "." << endl;}
需求
標頭:<vector>
命名空間: std