备注
此 API 已过时。替代为 unordered_multimap 类。
返回最后一个元素成功解决的位置处于已撤消的 hash_multimap 的迭代器。
const_reverse_iterator rend( ) const;
reverse_iterator rend( );
返回值
最后一个元素成功解决的位置处于已撤消的 hash_multimap 的双向反向迭代器 (在前面 unreversed hash_multimap 的第一个元素) 的位置。
备注
结束时间 正使用 hash_multimap,rend 使用的反转 hash_multimap。
如果返回值 rend 为 const_reverse_iterator,则无法修改 hash_multimap 对象。 如果返回值 rend 为 reverse_iterator,则可以修改 hash_multimap 对象。
rend 可用于测试对进行反向迭代器是否到达其 hash_multimap 的末尾。
不应取消rend 返回的值。
在Visual C++ .NET 2003中,成员<hash_map> 和 <hash_set> 头文件不再在std命名空间,而是已经进入了stdext命名空间。 有关更多信息,请参见 stdext 命名空间。
示例
// 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_map>
**命名空间:**stdext