次の方法で共有


hash_map::crend

[!メモ]

この API は、互換性のために残されています。代わりに unordered_map クラスです。

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

const_reverse_iterator crend( ) const; 

戻り値

逆順の hash_map Class (通常 hash_mapの最初の要素の前) に成功したする最後の要素の場所を指す定数逆順の双方向場所を反復子。

解説

crend は逆順の hash_map と hash_map::end が hash_mapで使用するように使用されます。

crend の戻り値で hash_map オブジェクトを変更することはできません。

反転反復子が hash_mapの最後に到達したかどうかをテストするためにcrend を使用できます。

crend によって返された値は逆参照しないでください。

Visual C++ .NET 2003では、<hash_map><hash_set> ヘッダー ファイルのメンバーはstdの名前空間に存在しなくなりましたが、ではなくstdextの名前空間に型。詳細については、「The stdext Namespace」を参照してください。

使用例

// hash_map_crend.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_map <int, int> hm1;

   hash_map <int, int> :: const_reverse_iterator hm1_crIter;
   typedef pair <int, int> Int_Pair;

   hm1.insert ( Int_Pair ( 3, 30 ) );

   hm1_crIter = hm1.crend( );
   hm1_crIter--;
   cout << "The last element of the reversed hash_map hm1 is "
        << hm1_crIter -> first << "." << endl;
}
  

必要条件

ヘッダー: <hash_map>

名前空間: のstdext

参照

関連項目

hash_map Class

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