hash_multiset::begin
![]() |
---|
這個 API 已經過時。這個選項是 unordered_multiset Class。 |
傳回定址。hash_multiset 的第一個項目的 Iterator。
const_iterator begin( ) const;
iterator begin( );
傳回值
解決雙向的 Iterator 為空白 hash_multiset 的 hash_multiset 的第一個項目或位置。
備註
如果的傳回值指派給 const_iteratorbegin ,無法修改 hash_multiset 物件的項目。如果傳回值 begin 指派給 iterator,可以修改 hash_multiset 物件的項目。
在 Visual C++ .NET Pocket PC, <hash_map> 和 <hash_set> 標頭檔 (Header File) 的成員不在 std 命名空間,,而是移至 stdext 命名空間。如需詳細資訊,請參閱 stdext 命名空間。
範例
// hash_multiset_begin.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.begin( );
cout << "The first element of hms1 is " << *hms1_Iter << endl;
hms1_Iter = hms1.begin( );
hms1.erase( hms1_Iter );
// The following 2 lines would err because the iterator is const
// hms1_cIter = hms1.begin( );
// hms1.erase( hms1_cIter );
hms1_cIter = hms1.begin( );
cout << "The first element of hms1 is now " << *hms1_cIter << endl;
}
需求
標題: <hash_set>
命名空間: stdext