# std::unordered_set<Key,Hash,KeyEqual,Allocator>::max_load_factor

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

Manages the maximum load factor (number of elements per bucket). The container automatically increases the number of buckets if the load factor exceeds this threshold.

## Official Specification Summary (cppreference)

```cpp
float max_load_factor() const; // (1) (since C++11)
void max_load_factor( float ml ); // (2) (since C++11)
```

Manages the maximum load factor (number of elements per bucket). The container automatically increases the number of buckets if the load factor exceeds this threshold.

1) Returns current maximum load factor.

2) Sets the maximum load factor to `ml`.

### Parameters

- `ml` - new maximum load factor setting

### Return value

1) Current maximum load factor.

2) (none)

### Complexity

Constant.

### See also

- [`load_factor`](https://en.cppreference.com/w/cpp/container/unordered_set/load_factor): returns average number of elements per bucket (public member function)

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