map::crbegin

返回解决常数的迭代器是相反的映射的第一个元素。

const_reverse_iterator crbegin( ) const;

返回值

解决const反转双向的迭代器解决在取消的 map Class 的第一个元素或什么是在unreversed map的最后一个元素。

备注

map::begin 使用 map,crbegin 用于取消的 map。

crbegin的返回值,就不能修改 map 对象

crbegin 可用于通过 map 向后重复。

示例

// map_crbegin.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.crbegin( );
   cout << "The first element of the reversed map m1 is "
        << m1_crIter -> first << "." << endl;
}
  

要求

标头: <map>

命名空间: std

请参见

参考

map Class

标准模板库