次の方法で共有


multimap::crend

逆順の multimap に最後の要素の次の場所を指す定数反復子を返します。

const_reverse_iterator crend( ) const;

戻り値

逆順の multimap Class (通常 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

参照

関連項目

multimap Class

標準テンプレート ライブラリ