unordered_multiset::begin
指定控制序列或存储桶的开头。
iterator begin();
const_iterator begin() const;
local_iterator begin(size_type nbucket);
const_local_iterator begin(size_type nbucket) const;
参数
参数 |
说明 |
nbucket |
存储数字。 |
备注
前两点成员函数返回序列中的第一个元素的前向迭代器 (或受一个空序列。结束)。 最后两个成员函数返回指向在存储桶 nbucket 的第一个元素用于向前迭代器 (或受空的存储桶。结束)。
示例
// std_tr1__unordered_set__unordered_multiset_begin.cpp
// compile with: /EHsc
#include <unordered_set>
#include <iostream>
typedef std::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);
}
要求
标头: <unordered_set>
命名空间: std