unordered_multiset::begin
更新 : 2007 年 11 月
被制御シーケンスまたはバケットの先頭を指定します。
iterator begin();
const_iterator begin() const;
local_iterator begin(size_type nbucket);
const_local_iterator begin(size_type nbucket) const;
パラメータ
- nbucket
バケット番号。
解説
最初の 2 つのメンバ関数は、シーケンスの最初の要素 (または空のシーケンスの末尾の次の位置) を指し示す前方反復子を返します。最後の 2 つのメンバ関数は、バケット nbucket の最初の要素 (または空のバケットの末尾の次の位置) を指し示す前方反復子を返します。
使用例
// std_tr1__unordered_set__unordered_multiset_begin.cpp
// compile with: /EHsc
#include <unordered_set>
#include <iostream>
typedef std::tr1::unordered_multiset<char> Myset;
int main()
{
Myset c1;
c1.insert('a');
c1.insert('b');
c1.insert('c');
// display contents " [c] [b] [a]"
for (Myset::const_iterator it = c1.begin();
it != c1.end(); ++it)
std::cout << " [" << *it << "]";
std::cout << std::endl;
// inspect first two items " [c] [b]"
Myset::iterator it2 = c1.begin();
std::cout << " [" << *it2 << "]";
++it2;
std::cout << " [" << *it2 << "]";
std::cout << std::endl;
// inspect bucket containing 'a'
Myset::const_local_iterator lit = c1.begin(c1.bucket('a'));
std::cout << " [" << *lit << "]";
return (0);
}
[c] [b] [a]
[c] [b]
[a]
必要条件
ヘッダー : <unordered_set>
名前空間 : std::tr1