逆順のマップの最初の要素を指す定数反復子を返します。
const_reverse_iterator crbegin( ) const;
戻り値
逆順の map Class の最初の要素に対応したり、通常の map最後の要素では、指す定数の順序の双方向反復子。
解説
crbegin は逆順の map と map::begin が mapで使用するように使用されます。
crbeginの戻り値を使用して、map のオブジェクトは変更できません
map によって逆方向の反復処理にcrbegin を使用できます。
使用例
// 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