public member type
<unordered_set>
std::unordered_multiset::cend container iterator (1)const_iterator cend() const noexcept;bucket iterator (2)
const_local_iterator cend ( size_type n ) const;
Return const_iterator to end
Returns a const_iterator pointing to the past-the-end element in the unordered_multiset container (1) or in one of its buckets (2).The const_iterator returned by cend does not point to any element, but to the position that follows the last element in the unordered_multiset container or in one of its buckets (i.e., their past-the-end position). Thus, the value returned shall not be dereferenced - it is generally used to describe the open-end of a range, such as [cbegin,cend).
Notice that an unordered_multiset object makes no guarantees on which order its elements follow. But, in any case, the range that goes from its cbegin to its cend covers all the elements in the container (or the bucket), until invalidated.
A const_iterator is an iterator that points to const content. This iterator can be increased and decreased (unless it is itself also const), but it cannot be used to modify the contents it points to.
Both const_iterator and const_local_iterator are member types. In the unordered_multiset class template, these are forward iterator types.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// unordered_multiset::cbegin/cend example
#include <iostream>
#include <string>
#include <unordered_set>
int main ()
{
std::unordered_multiset<std::string> myums =
{"father","mother","son","daughter","son","son"};
std::cout << "myums contains:";
for ( auto it = myums.begin(); it != myums.end(); ++it )
std::cout << " " << *it; // cannot modify *it
std::cout << std::endl;
std::cout << "myums's buckets contain:\n";
for ( unsigned i = 0; i < myums.bucket_count(); ++i) {
std::cout << "bucket #" << i << " contains:";
for ( auto local_it = myums.begin(i); local_it!= myums.end(i); ++local_it )
std::cout << " " << *local_it;
std::cout << std::endl;
}
return 0;
}
myums contains: father mother daughter son son son myset's buckets contain: bucket #0 contains: bucket #1 contains: father bucket #2 contains: mother bucket #3 contains: daughter son son son bucket #4 contains: bucket #5 contains: bucket #6 contains:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4