备注
此 API 已过时。替代为 unordered_map 类。
返回最后一个元素成功解决的位置。hash_map 的 const 迭代器。
const_iterator cend( ) const;
返回值
成功完成最后的元素位置。hash_map 类的 const 双向迭代器。 如果 hash_map 为 null,则 hash_map::cend == hash_map::begin。
备注
cend 迭代器用于测试是否到达其 hash_map的末尾。
不应取消cend 返回的值。
在Visual C++ .NET 2003中,成员<hash_map> 和 <hash_set> 头文件不再在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