public member type
<unordered_map>
std::unordered_multimap::end container iterator (1)iterator end() noexcept;const_iterator end() const noexcept;bucket iterator (2)
local_iterator end (size_type n);const_local_iterator end (size_type n) const;
Return iterator to end
Returns an iterator pointing to the past-the-end element in the unordered_multimap container (1) or in one of its buckets (2).The iterator returned by end does not point to any element, but to the position that follows the last element in the unordered_multimap container (its 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 [begin,end).
Notice that an unordered_multimap object makes no guarantees on how its elements with different keys are ordered. But, in any case, the range that goes from its begin to its end covers all the elements in the container (or the bucket), until invalidated.
All return types (iterator, const_iterator, local_iterator and const_local_iterator) are member types. In the unordered_multimap 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
26
27
28
// unordered_multimap::begin/end example
#include <iostream>
#include <unordered_map>
int main ()
{
std::unordered_multimap<std::string,std::string> myumm = {
{"apple","red"},
{"apple","green"},
{"orange","orange"},
{"strawberry","red"}
};
std::cout << "myumm contains:";
for ( auto it = myumm.begin(); it != myumm.end(); ++it )
std::cout << " " << it->first << ":" << it->second;
std::cout << std::endl;
std::cout << "myumm's buckets contain:\n";
for ( unsigned i = 0; i < myumm.bucket_count(); ++i) {
std::cout << "bucket #" << i << " contains:";
for ( auto local_it = myumm.begin(i); local_it!= myumm.end(i); ++local_it )
std::cout << " " << local_it->first << ":" << local_it->second;
std::cout << std::endl;
}
return 0;
}
myumm contains: apple:red apple:green orange:orange strawberry:red myumm's buckets contain: bucket #0 contains: bucket #1 contains: bucket #2 contains: apple:red apple:green bucket #3 contains: orange:orange bucket #4 contains: strawberry:red
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