返回解决成功最后一个元素所在的位置反转的映射的常量迭代器。
const_reverse_iterator crend( ) const;
返回值
解决成功最后一个元素的位置。是相反的 map Class 的常量反转双向迭代器(在前面unreversed map的第一个元素)的位置。
备注
正 map::end 使用 map,crend 用于取消的映射。
crend的返回值,就不能修改 map 对象。
crend 可用于测试对反向迭代器是否已到达其 map的末尾。
不应取消引用 crend 返回的值。
示例
// map_crend.cpp
// compile with: /EHsc
#include <map>
#include <iostream>
int main( )
{
using namespace std;
map <int, int> m1;
map <int, int> :: const_reverse_iterator m1_crIter;
typedef pair <int, int> Int_Pair;
m1.insert ( Int_Pair ( 1, 10 ) );
m1.insert ( Int_Pair ( 2, 20 ) );
m1.insert ( Int_Pair ( 3, 30 ) );
m1_crIter = m1.crend( );
m1_crIter--;
cout << "The last element of the reversed map m1 is "
<< m1_crIter -> first << "." << endl;
}
要求
标头: <map>
命名空间: std