hash_map::end (STL/CLR)
指定受控序列的末尾。
iterator end();
备注
成员函数返回序列仅控制。结束点的双向迭代器。 使用该控制获取指定序列的结尾的迭代器;,如果控制更改序列的长度,其状态不会发生更改。
示例
// cliext_hash_map_end.cpp
// compile with: /clr
#include <cliext/hash_map>
typedef cliext::hash_map<wchar_t, int> Myhash_map;
int main()
{
Myhash_map c1;
c1.insert(Myhash_map::make_value(L'a', 1));
c1.insert(Myhash_map::make_value(L'b', 2));
c1.insert(Myhash_map::make_value(L'c', 3));
// display contents " [a 1] [b 2] [c 3]"
for each (Myhash_map::value_type elem in c1)
System::Console::Write(" [{0} {1}]", elem->first, elem->second);
System::Console::WriteLine();
// inspect last two items
Myhash_map::iterator it = c1.end();
--it;
--it;
System::Console::WriteLine("*-- --end() = [{0} {1}]",
it->first, it->second);
++it;
System::Console::WriteLine("*--end() = [{0} {1}]",
it->first, it->second);
return (0);
}
要求
页眉: <cliext/hash_map>
命名空间: cliext