std::unordered_multiset::begin, std::unordered_multiset::cbegin
Da cppreference.com.
iterator begin() noexcept; |
||
const_iterator begin() const noexcept; |
||
const_iterator cbegin() const noexcept; |
||
Restituisce un iteratore al primo elemento del container.
Se il container è vuoto, l'iteratore restituito sarà uguale a end().
Parametri
(nessuno)
Valore restituito
Iteratore al primo elemento
Complessità
Costante Template:cpp/container/constant iterator note
Example
#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 cnt = words.count(*it);
std::cout << *it << ":\t" << cnt << '\n';
std::advance(it, cnt); // all cnt elements have equivalent keys
}
}
Possible output:
some: 1
words: 2
to: 1
count: 2
these: 1
Vedi anche
restituisce un iteratore fino alla fine Original: returns an iterator to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |