std::unordered_multiset<Key,Hash,KeyEqual,Allocator>:: end, std::unordered_multiset<Key,Hash,KeyEqual,Allocator>:: cend
From cppreference.net
<
cpp
|
container
|
unordered multiset
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::unordered_multiset
| Member types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Deduction guides (C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
iterator end
(
)
noexcept
;
|
(1) |
(自 C++11 起)
(自 C++26 起为 constexpr) |
|
const_iterator end
(
)
const
noexcept
;
|
(2) |
(自 C++11 起)
(自 C++26 起为 constexpr) |
|
const_iterator cend
(
)
const
noexcept
;
|
(3) |
(自 C++11 起)
(自 C++26 起为 constexpr) |
返回指向 * this 最后一个元素之后位置的迭代器。
返回的迭代器仅作为哨兵使用。不保证其具有 可解引用性 。
目录 |
返回值
指向最后一个元素之后的迭代器。
复杂度
常量。
注释
由于
iterator
和
const_iterator
都是常量迭代器(实际上可能是同一类型),无法通过这些成员函数返回的迭代器修改容器中的元素。
示例
运行此代码
#include <iostream> #include <iterator> #include <string> #include <unordered_set> int main() { const std::unordered_multiset<std::string> words = { "some", "words", "to", "count", "count", "these", "words" }; for (auto it = words.begin(); it != words.end(); ) { auto count = words.count(*it); std::cout << *it << ":\t" << count << '\n'; std::advance(it, count); // all count elements have equivalent keys } }
可能的输出:
some: 1 words: 2 to: 1 count: 2 these: 1
参见
|
返回指向起始位置的迭代器
(公开成员函数) |
|
|
(C++11)
(C++14)
|
返回指向容器或数组末尾的迭代器
(函数模板) |