multimap::crend
反転 multimap 内の最後の要素の次の場所を指す定数反復子を返します。
const_reverse_iterator crend( ) const;
戻り値
逆順の multimap クラス (通常 multimapの最初の要素の前に記述した成功) 内の最後の要素の次の場所を指す定数反転双方向の場所を反復子。
解説
crend、反転した multimap と multimap::end が multimapと併用するために使用されます。
crend の戻り値で multimap オブジェクトを変更することはできません。
反転反復子が multimapの最後に到達したかどうかをテストするためにcrend を使用できます。
crend によって返された値は逆参照しないでください。
使用例
// multimap_crend.cpp
// compile with: /EHsc
#include <map>
#include <iostream>
int main( )
{
using namespace std;
multimap <int, int> m1;
multimap <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 multimap m1 is "
<< m1_crIter -> first << "." << endl;
}
必要条件
ヘッダー: <map>
名前空間: std