共用方式為


hash_multimap::rbegin

注意事項注意事項

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

傳回位址的 Iterator 以相反的 hash_multimap 的第一個項目。

const_reverse_iterator rbegin( ) const; 
reverse_iterator rbegin( );

傳回值

解決反向雙向 Iterator 的解決已還原的 hash_multimap 的第一個項目或還沒有 unreversed hash_multimap 的最後一個項目。

備註

啟動 搭配 hash_multimap,rbegin 搭配反轉 hash_multimap。

如果傳回值 rbegin 指派給 const_reverse_iterator,則無法修改 hash_multimap 物件。 如果傳回值 rbegin 指派給 reverse_iterator,則可以修改 hash_multimap 物件。

rbegin 可以用來傳遞 hash_multimap 向後逐一查看。

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

範例

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

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

   hash_multimap <int, int> :: iterator hm1_Iter;
   hash_multimap <int, int> :: reverse_iterator hm1_rIter;
   hash_multimap <int, int> :: const_reverse_iterator hm1_crIter;
   typedef pair <int, int> Int_Pair;

   hm1.insert ( Int_Pair ( 1, 10 ) );
   hm1.insert ( Int_Pair ( 2, 20 ) );
   hm1.insert ( Int_Pair ( 3, 30 ) );

   hm1_rIter = hm1.rbegin( );
   cout << "The first element of the reversed hash_multimap hm1 is "
        << hm1_rIter -> first << "." << endl;

   // begin can be used to start an iteration 
   // through a hash_multimap in a forward order
   cout << "The hash_multimap is: ";
   for ( hm1_Iter = hm1.begin( ) ; hm1_Iter != hm1.end( ); hm1_Iter++)
      cout << hm1_Iter -> first << " ";
      cout << "." << endl;

   // rbegin can be used to start an iteration 
   // through a hash_multimap in a reverse order
   cout << "The reversed hash_multimap is: ";
   for ( hm1_rIter = hm1.rbegin( ) ; hm1_rIter != hm1.rend( ); hm1_rIter++)
      cout << hm1_rIter -> first << " ";
      cout << "." << endl;

   // A hash_multimap element can be erased by dereferencing its key 
   hm1_rIter = hm1.rbegin( );
   hm1.erase ( hm1_rIter -> first );

   hm1_rIter = hm1.rbegin( );
   cout << "After the erasure, the first element"
        << "\n in the reversed hash_multimap is "
        << hm1_rIter -> first << "." << endl;
}
  
  
  
  

需求

標題: <hash_map>

命名空間: stdext

請參閱

參考

hash_multimap Class

標準樣板程式庫