다음을 통해 공유


unordered_set::begin

버킷 또는 제어 되는 시퀀스의 시작을 지정 합니다.

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

매개 변수

Parameter

설명

nbucket

버킷 수입니다.

설명

첫 번째 두 명의 멤버 함수 시퀀스의 (또는 빈 시퀀스의 끝 바로 뒤)의 첫 번째 요소를 가리키는 정방향 반복기를 반환합니다.양동이의 첫 번째 요소를 가리키는 정방향 반복기 마지막 두 명의 멤버 함수를 반환할 nbucket (또는 바로 뒤 끝 부분에서는 빈 통).

예제

// 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); 
} 
  
  
  
  

요구 사항

헤더: <unordered_set>

네임 스페이스: std

참고 항목

참조

<unordered_set>

unordered_set Class

unordered_set::end

기타 리소스

<unordered_set> 멤버