Files
2025-10-25 03:02:53 +03:00

2.9 KiB
Raw Permalink Blame History

[unord.set.cnstr]

23 Containers library [containers]

23.5 Unordered associative containers [unord]

23.5.6 Class template unordered_set [unord.set]

23.5.6.2 Constructors [unord.set.cnstr]

🔗

constexpr unordered_set() : unordered_set(size_type(see below)) { } constexpr explicit unordered_set(size_type n, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& a = allocator_type());

1

#

Effects: Constructs an empty unordered_set using the specified hash function, key equality predicate, and allocator, and using at least n buckets.

For the default constructor, the number of buckets is implementation-defined.

max_load_factor() returns 1.0.

2

#

Complexity: Constant.

🔗

template<class InputIterator> constexpr unordered_set(InputIterator f, InputIterator l, size_type n = see below, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& a = allocator_type()); template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<value_type> R> constexpr unordered_multiset(from_range_t, R&& rg, size_type n = see below, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& a = allocator_type()); constexpr unordered_set(initializer_list<value_type> il, size_type n = see below, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& a = allocator_type());

3

#

Effects: Constructs an empty unordered_set using the specified hash function, key equality predicate, and allocator, and using at least n buckets.

If n is not provided, the number of buckets is implementation-defined.

Then inserts elements from the range [f, l), rg, or il, respectively.

max_load_factor() returns 1.0.

4

#

Complexity: Average case linear, worst case quadratic.