共用方式為


hash_map::cend

注意事項注意事項

這個 API 已經過時。這個選項是 unordered_map Class

傳回處理成功最後一個項目位置 hash_map const 的 Iterator。

const_iterator cend( ) const;

傳回值

解決成功最後一個項目位置 hash_map Class的 const 雙向 Iterator。 如果 hash_map 是 null,則 hash_map::cend == hash_map::begin。

備註

cend 用來測試 Iterator 是否已到達 hash_map結尾。

不應該取值 cend 傳回的值。

在 Visual C++ .NET Pocket PC, <hash_map><hash_set> 標頭檔 (Header File) 的成員不在 std 命名空間,,而是移至 stdext 命名空間。 如需詳細資訊,請參閱 stdext 命名空間

範例

// hash_map_cend.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_iterator hm1_cIter;
   typedef pair <int, int> Int_Pair;

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

   hm1_cIter = hm1.cend( );
   hm1_cIter--;
   cout << "The value of last element of hm1 is " 
        << hm1_cIter -> second << "." << endl;
   }
  

需求

標題: <hash_map>

命名空間: stdext

請參閱

參考

hash_map Class

標準樣板程式庫