Udostępnij za pośrednictwem


unordered_set::begin

Określa początek kontrolowanej sekwencji lub Wiadro z farbą.

iterator begin();
const_iterator begin() const;
local_iterator begin(size_type nbucket);
const_local_iterator begin(size_type nbucket) const;

Parametry

Parametr

Opis

nbucket

Numer Wiadro.

Uwagi

Pierwszy funkcji dwóch elementów członkowskich powrócić do przodu sterująca wskazuje na pierwszy element sekwencji (lub po prostu poza koniec sekwencji puste).Funkcje składowe ostatnich dwóch powrócić do przodu sterująca wskazuje na pierwszy element Wiadro z farbą, nbucket (lub po prostu poza końcem puste Wiadro).

Przykład

// unordered_set_begin.cpp 
// compile using: cl.exe /EHsc /nologo /W4 /MTd 
#include <unordered_set> 
#include <iostream> 

using namespace std;

typedef unordered_set<char> MySet;

int main() 
{ 
    MySet c1; 

    c1.insert('a'); 
    c1.insert('b'); 
    c1.insert('c'); 

    // display contents using range-based for 
    for (auto it : c1) {
        cout << " [" << it << "]"; 
    }

    cout << endl; 

    // display contents using explicit for
    for (MySet::const_iterator it = c1.begin(); it != c1.end(); ++it) {
        cout << " [" << *it << "]"; 
    }

    cout << std::endl; 

    // display first two items
    MySet::iterator it2 = c1.begin(); 
    cout << " [" << *it2 << "]"; 
    ++it2; 
    cout << " [" << *it2 << "]"; 
    cout << endl; 

    // display bucket containing 'a' 
    MySet::const_local_iterator lit = c1.begin(c1.bucket('a')); 
    cout << " [" << *lit << "]"; 

    return (0); 
} 
  
  
  
  

Wymagania

Nagłówek: <unordered_set>

Przestrzeń nazw: std

Zobacz też

Informacje

<unordered_set>

unordered_set — Klasa

unordered_set::end

Inne zasoby

<unordered_set> Członkowie