hash_multiset::end

说明说明

此 API 已过时。另一种方法是 unordered_multiset Class

返回解决成功最后一个元素的位置。hash_multiset 的迭代器。

const_iterator end( ) const; 
iterator end( );

返回值

解决成功最后一个元素的位置。hash_multiset 的一双向迭代器。如果 hash_multiset 为空,然后 hash_multiset::end == hash_multiset::begin。

备注

结束时间 用于测试迭代器是否已到达其 hash_multiset 的末尾。不应取消引用 结束时间 返回的值。

在 Visual C++ .NET 2003 中,<hash_map><hash_set> 标头文件的成员中不再标准,命名空间,而是将 stdext 命名空间。有关更多信息,请参见 stdext 命名空间

示例

// hash_multiset_end.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_multiset <int> hms1;
   hash_multiset <int> :: iterator hms1_Iter;
   hash_multiset <int> :: const_iterator hms1_cIter;
   
   hms1.insert( 1 );
   hms1.insert( 2 );
   hms1.insert( 3 );

   hms1_Iter = hms1.end( );
   hms1_Iter--;
   cout << "The last element of hms1 is " << *hms1_Iter << endl;

   hms1.erase( hms1_Iter );

   // The following 3 lines would err because the iterator is const
   // hms1_cIter = hms1.end( );
   // hms1_cIter--;
   // hms1.erase( hms1_cIter );

   hms1_cIter = hms1.end( );
   hms1_cIter--;
   cout << "The last element of hms1 is now " << *hms1_cIter << endl;
}
  

要求

标头: <hash_set>

命名空间: stdext

请参见

参考

hash_multiset Class

标准模板库