# std::unordered_set<Key,Hash,KeyEqual,Allocator>::begin(size_type), std::unordered_set<Key,Hash,KeyEqual,Allocator>::cbegin(size_type)

> C++ Atlas: `cppatlas.com/w/cpp/container/unordered_set/begin2` | Source: https://en.cppreference.com/w/cpp/container/unordered_set/begin2 | Domain: Containers | Standards: C++11

Returns an iterator to the first element of the bucket with index n.

## Official Specification Summary (cppreference)

```cpp
local_iterator begin( size_type n ); // (since C++11)
const_local_iterator begin( size_type n ) const; // (since C++11)
const_local_iterator cbegin( size_type n ) const; // (since C++11)
```

Returns an iterator to the first element of the bucket with index `n`.

### Parameters

- `n` - the index of the bucket to access

### Return value

Iterator to the first element.

### Complexity

Constant.

### See also

- [`end(size_type)`](https://en.cppreference.com/w/cpp/container/unordered_set/end2), [`cend(size_type)`](https://en.cppreference.com/w/cpp/container/unordered_set/end2): returns an iterator to the end of the specified bucket (public member function)

---
Attribution: content from https://en.cppreference.com/w/cpp/container/unordered_set/begin2 (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.