本文為機器翻譯文章。如需檢視英文版，請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上，即可在快顯視窗顯示英文原文。 譯文 原文

hash_multimap::rend

Visual Studio 2015

語法

```
const_reverse_iterator rend( ) const;
reverse_iterator rend( );
```

備註

rend 可用來測試是否反向 Iterator 是否已到達其 hash_multimap 結尾。

範例

```// hash_multimap_rend.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.rend( );
hm1_rIter--;
cout << "The last 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.rend( );
hm1.erase ( hm1_rIter -> first );

hm1_rIter = hm1.rend( );
hm1_rIter--;
cout << "After the erasure, the last element "
<< "in the reversed hash_multimap is "
<< hm1_rIter -> first << "." << endl;
}
```
```          反轉 hash_multimap hm1 的最後一個元素為 1。
hash_multimap 如下:1 2 3。

```