[unord.set.cnstr] (original) (raw)

22 Containers library [containers]

22.5 Unordered associative containers [unord]

22.5.6 Class template unordered_­set [unord.set]

22.5.6.2 Constructors [unord.set.cnstr]

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

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.

template<class InputIterator> 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()); 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());

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)for the first form, or from the range[il.begin(), il.end()) for the second form.

max_­load_­factor() returns 1.0.

Complexity:Average case linear, worst case quadratic.