BDE 4.14.0 Production release
|
#include <bslstl_unorderedset.h>
Public Types | |
typedef KEY | key_type |
typedef KEY | value_type |
typedef HASH | hasher |
typedef EQUAL | key_equal |
typedef ALLOCATOR | allocator_type |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef AllocatorTraits::size_type | size_type |
typedef AllocatorTraits::difference_type | difference_type |
typedef AllocatorTraits::pointer | pointer |
typedef AllocatorTraits::const_pointer | const_pointer |
typedef ::BloombergLP::bslstl::HashTableIterator< const value_type, difference_type > | iterator |
typedef ::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > | local_iterator |
typedef iterator | const_iterator |
typedef local_iterator | const_local_iterator |
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION_IF (unordered_set, ::BloombergLP::bslmf::IsBitwiseMoveable, ::BloombergLP::bslmf::IsBitwiseMoveable< HashTable >::value) | |
unordered_set () | |
unordered_set (size_type initialNumBuckets, const HASH &hashFunction=HASH(), const EQUAL &keyEqual=EQUAL(), const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
unordered_set (size_type initialNumBuckets, const HASH &hashFunction, const ALLOCATOR &basicAllocator) | |
unordered_set (size_type initialNumBuckets, const ALLOCATOR &basicAllocator) | |
unordered_set (const ALLOCATOR &basicAllocator) | |
unordered_set (const unordered_set &original) | |
unordered_set (BloombergLP::bslmf::MovableRef< unordered_set > original) | |
unordered_set (const unordered_set &original, const typename type_identity< ALLOCATOR >::type &basicAllocator) | |
unordered_set (BloombergLP::bslmf::MovableRef< unordered_set > original, const typename type_identity< ALLOCATOR >::type &basicAllocator) | |
template<class INPUT_ITERATOR > | |
unordered_set (INPUT_ITERATOR first, INPUT_ITERATOR last, size_type initialNumBuckets=0, const HASH &hashFunction=HASH(), const EQUAL &keyEqual=EQUAL(), const ALLOCATOR &basicAllocator=ALLOCATOR()) | |
template<class INPUT_ITERATOR > | |
unordered_set (INPUT_ITERATOR first, INPUT_ITERATOR last, size_type initialNumBuckets, const HASH &hashFunction, const ALLOCATOR &basicAllocator) | |
template<class INPUT_ITERATOR > | |
unordered_set (INPUT_ITERATOR first, INPUT_ITERATOR last, size_type initialNumBuckets, const ALLOCATOR &basicAllocator) | |
template<class INPUT_ITERATOR > | |
unordered_set (INPUT_ITERATOR first, INPUT_ITERATOR last, const ALLOCATOR &basicAllocator) | |
~unordered_set () | |
Destroy this object. | |
unordered_set & | operator= (const unordered_set &rhs) |
unordered_set &operator=(BloombergLP::bslmf::MovableRef< unordered_set > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator | begin () BSLS_KEYWORD_NOEXCEPT |
iterator | end () BSLS_KEYWORD_NOEXCEPT |
local_iterator | begin (size_type index) |
local_iterator | end (size_type index) |
pair< iterator, bool > | insert (const value_type &value) |
pair< iterator, bool > | insert (BloombergLP::bslmf::MovableRef< value_type > value) |
iterator | insert (const_iterator hint, const value_type &value) |
iterator | insert (const_iterator hint, BloombergLP::bslmf::MovableRef< value_type > value) |
template<class INPUT_ITERATOR > | |
void | insert (INPUT_ITERATOR first, INPUT_ITERATOR last) |
template<class... Args> | |
pair< iterator, bool > | emplace (Args &&... arguments) |
template<class... Args> | |
iterator | emplace_hint (const_iterator hint, Args &&... arguments) |
iterator | erase (const_iterator position) |
size_type | erase (const key_type &key) |
iterator | erase (const_iterator first, const_iterator last) |
template<class LOOKUP_KEY > | |
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, iterator >::type | find (const LOOKUP_KEY &key) |
iterator | find (const key_type &key) |
template<class LOOKUP_KEY > | |
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, pair< iterator, iterator > >::type | equal_range (const LOOKUP_KEY &key) |
pair< iterator, iterator > | equal_range (const key_type &key) |
void | max_load_factor (float newLoadFactor) |
void | rehash (size_type numBuckets) |
void | reserve (size_type numElements) |
ALLOCATOR | get_allocator () const BSLS_KEYWORD_NOEXCEPT |
const_iterator | begin () const BSLS_KEYWORD_NOEXCEPT |
const_iterator | end () const BSLS_KEYWORD_NOEXCEPT |
const_iterator | cbegin () const BSLS_KEYWORD_NOEXCEPT |
const_iterator | cend () const BSLS_KEYWORD_NOEXCEPT |
bool | contains (const key_type &key) const |
template<class LOOKUP_KEY > | |
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, bool >::type | contains (const LOOKUP_KEY &key) const |
bool | empty () const BSLS_KEYWORD_NOEXCEPT |
size_type | size () const BSLS_KEYWORD_NOEXCEPT |
Return the number of elements in this set. | |
size_type | max_size () const BSLS_KEYWORD_NOEXCEPT |
EQUAL | key_eq () const |
HASH | hash_function () const |
template<class LOOKUP_KEY > | |
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, const_iterator >::type | find (const LOOKUP_KEY &key) const |
const_iterator | find (const key_type &key) const |
template<class LOOKUP_KEY > | |
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, size_type >::type | count (const LOOKUP_KEY &key) const |
size_type | count (const key_type &key) const |
template<class LOOKUP_KEY > | |
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, pair< const_iterator, const_iterator > >::type | equal_range (const LOOKUP_KEY &key) const |
pair< const_iterator, const_iterator > | equal_range (const key_type &key) const |
size_type | bucket_count () const BSLS_KEYWORD_NOEXCEPT |
size_type | max_bucket_count () const BSLS_KEYWORD_NOEXCEPT |
size_type | bucket_size (size_type index) const |
size_type | bucket (const key_type &key) const |
const_local_iterator | begin (size_type index) const |
const_local_iterator | end (size_type index) const |
const_local_iterator | cbegin (size_type index) const |
const_local_iterator | cend (size_type index) const |
float | load_factor () const BSLS_KEYWORD_NOEXCEPT |
float | max_load_factor () const BSLS_KEYWORD_NOEXCEPT |
template<class... Args> | |
pair< typename unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::iterator, bool > | emplace (Args &&... arguments) |
Public Attributes | |
void swap(unordered_set &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void | clear () BSLS_KEYWORD_NOEXCEPT |
Friends | |
template<class KEY2 , class HASH2 , class EQUAL2 , class ALLOCATOR2 > | |
bool | operator== (const unordered_set< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &, const unordered_set< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &) |
This class template implements a value-semantic container type holding an unordered set of unique values (of template parameter type KEY
).
This class:
at
method)const
thread-safe For terminology see bsldoc_glossary .typedef ALLOCATOR bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::allocator_type |
typedef iterator bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::const_iterator |
typedef local_iterator bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::const_local_iterator |
typedef AllocatorTraits::const_pointer bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::const_pointer |
typedef const value_type& bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::const_reference |
typedef AllocatorTraits::difference_type bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::difference_type |
typedef HASH bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::hasher |
typedef ::BloombergLP::bslstl::HashTableIterator< const value_type, difference_type> bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::iterator |
typedef EQUAL bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::key_equal |
typedef KEY bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::key_type |
typedef ::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type> bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::local_iterator |
typedef AllocatorTraits::pointer bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::pointer |
typedef value_type& bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::reference |
typedef AllocatorTraits::size_type bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::size_type |
typedef KEY bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::value_type |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inlineexplicit |
Create an empty unordered set. Optionally specify an initialNumBuckets
indicating the initial size of the array of buckets of this container. If initialNumBuckets
is not supplied, a single bucket is used. Optionally specify a hashFunction
used to generate the hash values for the keys contained in this set. If hashFunction
is not supplied, a default-constructed object of the (template parameter) type HASH
is used. Optionally specify a key-equality functor keyEqual
used to verify that two key are equivalent. If keyEqual
is not supplied, a default-constructed object of the (template parameter) type EQUAL
is used. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR
is used. If the type ALLOCATOR
is bsl::allocator
and basicAllocator
is not supplied, the currently installed default allocator is used to supply memory. Note that a bslma::Allocator *
can be supplied for basicAllocator
if the type ALLOCATOR
is bsl::allocator
(the default).
|
inline |
Create an unordered set having the same value as the specified original
object. Use a copy of original.hash_function()
to generate hash values for the keys contained in this set. Use a copy of original.key_eq()
to verify that two keys are equivalent. Use the allocator returned by bsl::allocator_traits<ALLOCATOR>:: select_on_container_copy_construction(original.get_allocator())
to allocate memory. This method requires that the (template parameter) type KEY
be copy-insertable
into this set (see {Requirements on KEY
}).
|
inline |
Create an unordered set having the same value as the specified original
object by moving (in constant time) the contents of original
to the new set. Use a copy of original.hash_function()
to generate hash values for the keys contained in this set. Use a copy of original.key_eq()
to verify that two keys are equivalent. The allocator associated with original
is propagated for use in the newly-created set. original
is left in a valid but unspecified state.
|
inline |
Create an unordered set having the same value as the specified original
object that uses the specified basicAllocator
to supply memory. Use a copy of original.hash_function()
to generate hash values for the keys contained in this set. Use a copy of original.key_eq()
to verify that two keys are equivalent. This method requires that the (template parameter) type KEY
be copy-insertable
into this set (see {Requirements on KEY
}). Note that a bslma::Allocator *
can be supplied for basicAllocator
if the (template parameter) type ALLOCATOR
is bsl::allocator
(the default).
|
inline |
Create an unordered set having the same value as the specified original
object that uses the specified basicAllocator
to supply memory. The contents of original
are moved (in constant time) to the new set if basicAllocator == original.get_allocator()
, and are move-inserted (in linear time) using basicAllocator
otherwise. original
is left in a valid but unspecified state. Use a copy of original.hash_function()
to generate hash values for the keys contained in this set. Use a copy of original.key_eq()
to verify that two keys are equivalent. This method requires that the (template parameter) type KEY
be move-insertable
(see {Requirements on KEY
}). Note that a bslma::Allocator *
can be supplied for basicAllocator
if the (template parameter) type ALLOCATOR
is bsl::allocator
(the default).
|
inline |
Create an unordered set, and insert each value_type
object in the sequence starting at the specified first
element, and ending immediately before the specified last
element, ignoring those keys having a value equivalent to that which appears earlier in the sequence. Optionally specify an initialNumBuckets
indicating the initial size of the array of buckets of this container. If initialNumBuckets
is not supplied, a single bucket is used. Optionally specify a hashFunction
used to generate hash values for the keys contained in this set. If hashFunction
is not supplied, a default-constructed object of (template parameter) type HASH
is used. Optionally specify a key-equality functor keyEqual
used to verify that two key values are the same. If keyEqual
is not supplied, a default-constructed object of (template parameter) type EQUAL
is used. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR
is used. If the type ALLOCATOR
is bsl::allocator
and basicAllocator
is not supplied, the currently installed default allocator is used to supply memory. The (template parameter) type INPUT_ITERATOR
shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3] providing access to values of a type convertible to value_type
, and value_type
must be emplace-constructible
from *i
into this unordered set, where i
is a dereferenceable iterator in the range [first .. last)
(see {Requirements on KEY
}). The behavior is undefined unless first
and last
refer to a sequence of valid values where first
is at a position at or before last
. Note that a bslma::Allocator *
can be supplied for basicAllocator
if the type ALLOCATOR
is bsl::allocator
(the default).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Assign to this object the value, hash function, and equality comparator of the specified rhs
object, propagate to this object the allocator of rhs
if the ALLOCATOR
type has trait propagate_on_container_move_assignment
, and return a reference providing modifiable access to this object. The contents of rhs
are moved (in constant time) to this set if get_allocator() == rhs.get_allocator()
(after accounting for the aforementioned trait); otherwise, all elements in this set are either destroyed or move-assigned to and each additional element in rhs
is move-inserted into this set. rhs
is left in a valid but unspecified state, and if an exception is thrown, *this
is left in a valid but unspecified state. This method requires that the (template parameter) type KEY
be both move-assignable
and move-insertable
into this set (see {Requirements on KEY
}). Return an iterator providing modifiable access to the first value_type
object (in the sequence of value_type
objects) maintained by this set, or the end
iterator if this set is empty.
|
inline |
Return an iterator providing non-modifiable access to the first value_type
object in the sequence of value_type
objects maintained by this set, or the end
iterator if this set is empty.
|
inline |
Return a local iterator providing modifiable access to the first value_type
object in the sequence of value_type
objects of the bucket having the specified index
, in the array of buckets maintained by this set, or the end(index)
otherwise.
|
inline |
Return a local iterator providing non-modifiable access to the first value_type
object (in the sequence of value_type
objects) of the bucket having the specified index
in the array of buckets maintained by this set, or the end(index)
otherwise.
bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::BSLMF_NESTED_TRAIT_DECLARATION_IF | ( | unordered_set< KEY, HASH, EQUAL, ALLOCATOR > | , |
::BloombergLP::bslmf::IsBitwiseMoveable | , | ||
::BloombergLP::bslmf::IsBitwiseMoveable< HashTable >::value | |||
) |
|
inline |
Return the index of the bucket, in the array of buckets of this container, where a value equivalent to the specified key
would be inserted.
|
inline |
Return the number of buckets in the array of buckets maintained by this set.
|
inline |
Return the number of elements contained in the bucket at the specified index
in the array of buckets maintained by this container.
|
inline |
Return an iterator providing non-modifiable access to the first value_type
object in the sequence of value_type
objects maintained by this set, or the cend
iterator if this set is empty.
|
inline |
Return a local iterator providing non-modifiable access to the first value_type
object (in the sequence of value_type
objects) of the bucket having the specified index
in the array of buckets maintained by this set, or the cend(index)
otherwise.
|
inline |
Return an iterator providing non-modifiable access to the past-the-end element (in the sequence of value_type
objects) maintained by this set.
|
inline |
Return a local iterator providing non-modifiable access to the past-the-end element (in the sequence of value_type
objects) of the bucket having the specified index
in the array of buckets maintained by this set.
|
inline |
Return true
if this unordered set contains an element whose key is equivalent to the specified key
.
|
inline |
Return true
if this unordered set contains an element whose key is equivalent to the specified key
.
|
inline |
Return the number of value_type
objects within this unordered set that are equivalent to the specified key
. Note that since an unordered set maintains unique keys, the returned value will be either 0 or 1.
|
inline |
Return the number of value_type
objects within this unordered set that are equivalent to the specified key
. The behavior is undefined unless key
is equivalent to at most one element in this unordered set. Note that since an unordered set maintains unique keys, the returned value will be either 0 or 1.
pair< iterator, bool > bsl::unordered_set< KEY, HASH, EQUAL, ALLOCATOR >::emplace | ( | Args &&... | arguments | ) |
Insert into this unordered set a newly created value_type
object, constructed by forwarding get_allocator()
(if required) and the specified (variable number of) arguments
to the corresponding constructor of value_type
, if a key equivalent to such a value does not already exist in this set; otherwise, this method has no effect (other than possibly creating a temporary value_type
object). Return a pair whose first
member is an iterator referring to the (possibly newly created and inserted) object in this set whose value is equivalent to that of an object constructed from arguments
, and whose second
member is true
if a new value was inserted, and false
if an equivalent key was already present. This method requires that the (template parameter) type KEY
be emplace-constructible
into this set from arguments
(see {Requirements on KEY
}).
|
inline |
|
inline |
Insert into this unordered set a newly created value_type
object, constructed by forwarding get_allocator()
(if required) and the specified (variable number of) arguments
to the corresponding constructor of value_type
, if a key equivalent to such a value does not already exists in this set; otherwise, this method has no effect (other than possibly creating a temporary value_type
object). Return an iterator referring to the (possibly newly created and inserted) object in this set whose value is equivalent to that of an object constructed from arguments
. The average and worst case complexity of this operation is not affected by the specified hint
. This method requires that the (template parameter) type KEY
be emplace-constructible
into this set from arguments
(see {Requirements on KEY
}). The behavior is undefined unless hint
is an iterator in the range [begin() .. end()]
(both endpoints included). Note that hint
is ignored (other than possibly asserting its validity in some build modes).
|
inline |
Return true
if this set contains no elements, and false
otherwise.
|
inline |
Return an iterator providing modifiable access to the past-the-end element in the sequence of value_type
objects maintained by this unordered set.
|
inline |
Return an iterator providing non-modifiable access to the past-the-end element in the sequence of value_type
objects maintained by this set.
|
inline |
Return a local iterator providing modifiable access to the past-the-end element in the sequence of value_type
objects of the bucket having the specified index
s, in the array of buckets maintained by this set.
|
inline |
Return a local iterator providing non-modifiable access to the past-the-end element (in the sequence of value_type
objects) of the bucket having the specified index
in the array of buckets maintained by this set.
|
inline |
Return a pair of iterators providing modifiable access to the sequence of value_type
objects in this unordered set that are equivalent to the specified key
, where the first iterator is positioned at the start of the sequence, and the second is positioned one past the end of the sequence. If this unordered set contains no value_type
objects equivalent to key
, then the two returned iterators will have the same value. Note that since an unordered set maintains unique keys, the range will contain at most one element.
|
inline |
Return a pair of iterators providing non-modifiable access to the sequence of value_type
objects in this unordered set that are equivalent to the specified key
, where the first iterator is positioned at the start of the sequence and the second iterator is positioned one past the end of the sequence. If this unordered set contains no value_type
objects equivalent to key
, then the two returned iterators will have the same value. Note that since an unordered set maintains unique keys, the range will contain at most one element.
|
inline |
Return a pair of iterators providing modifiable access to the sequence of value_type
objects in this unordered set that are equivalent to the specified key
, where the first iterator is positioned at the start of the sequence, and the second is positioned one past the end of the sequence. If this unordered set contains no value_type
objects equivalent to key
, then the two returned iterators will have the same value. The behavior is undefined unless key
is equivalent to at most one element in this unordered set. Note that since an unordered set maintains unique keys, the range will contain at most one element.
|
inline |
Return a pair of iterators providing non-modifiable access to the sequence of value_type
objects in this unordered set that are equivalent to the specified key
, where the first iterator is positioned at the start of the sequence and the second iterator is positioned one past the end of the sequence. If this unordered set contains no value_type
objects equivalent to key
, then the two returned iterators will have the same value. The behavior is undefined unless key
is equivalent to at most one element in this unordered set. Note that since an unordered set maintains unique keys, the range will contain at most one element.
|
inline |
Remove from this set the value_type
object that is equivalent to the specified key
, if such an entry exists, and return 1; otherwise, if there is no value_type
object that is equivalent to key
, return 0 with no other effect. This method invalidates only iterators and references to the removed element and previously saved values of the end()
iterator, and preserves the relative order of the elements not removed.
|
inline |
Remove from this set the value_type
objects starting at the specified first
position up to, but including the specified last
position, and return last
. This method invalidates only iterators and references to the removed element and previously saved values of the end()
iterator, and preserves the relative order of the elements not removed. The behavior is undefined unless first
and last
either refer to elements in this set or are the end
iterator, and the first
position is at or before the last
position in the sequence provided by this container.
|
inline |
Remove from this unordered set the value_type
object at the specified position
, and return an iterator referring to the element immediately following the removed element, or to the past-the-end position if the removed element was the last element in the sequence of elements maintained by this set. This method invalidates only iterators and references to the removed element and previously saved values of the end()
iterator, and preserves the relative order of the elements not removed. The behavior is undefined unless position
refers to a value_type
object in this unordered set.
|
inline |
Return an iterator providing modifiable access to the value_type
object in this unordered set that is equivalent to the specified key
, if such an entry exists, and the past-the-end (end
) iterator otherwise.
|
inline |
Return an iterator providing non-modifiable access to the value_type
object in this unordered set that is equivalent to the specified key
, if such an entry exists, and the past-the-end (end
) iterator otherwise.
|
inline |
Return an iterator providing modifiable access to the value_type
object in this unordered set that is equivalent to the specified key
, if such an entry exists, and the past-the-end (end
) iterator otherwise. The behavior is undefined unless key
is equivalent to at most one element in this unordered set.
|
inline |
Return an iterator providing non-modifiable access to the value_type
object in this unordered set that is equivalent to the specified key
, if such an entry exists, and the past-the-end (end
) iterator otherwise. The behavior is undefined unless key
is equivalent to at most one element in this unordered set.
|
inline |
Return (a copy of) the allocator used for memory allocation by this unordered set.
|
inline |
Return (a copy of) the hash unary functor used by this set to generate a hash value (of type size_t
) for a key_type
object.
|
inline |
Insert the specified value
into this set if a key equivalent to value
does not already exist in this set; otherwise, if a key equivalent to value
already exists in this set, this method has no effect. value
is left in a valid but unspecified state. Return a pair whose first
member is an iterator referring to the (possibly newly inserted) value_type
object in this set that is equivalent to value
, and whose second
member is true
if a new value was inserted, and false
if the key was already present. This method requires that the (template parameter) type KEY
be move-insertable
into this set (see {Requirements on KEY
}).
|
inline |
Insert the specified value
into this set if a key equivalent to value
does not already exist in this set; otherwise, if a key equivalent to value
already exists in this set, this method has no effect. Return a pair whose first
member is an iterator referring to the (possibly newly inserted) value_type
object in this set that is equivalent to value
, and whose second
member is true
if a new value was inserted, and false
if the key was already present. This method requires that the (template parameter) type KEY
be copy-insertable
(see {Requirements on KEY
}).
|
inline |
Insert the specified value
into this set if a key equivalent to value
does not already exist in this set; otherwise, if a key equivalent to value
already exists in this set, this method has no effect. value
is left in a valid but unspecified state. Return an iterator referring to the (possibly newly inserted) value_type
object in this set that is equivalent to value
. The average and worst case complexity of this operation is not affected by the specified hint
. This method requires that the (template parameter) type KEY
be move-insertable
(see {Requirements on KEY
}) into this set. The behavior is undefined unless hint
is an iterator in the range [begin() .. end()]
(both endpoints included). Note that hint
is ignored (other than possibly asserting its validity in some build modes).
|
inline |
Insert the specified value
into this set if a key equivalent to value
does not already exist in this set; otherwise, if a key equivalent to value
already exists in this set, this method has no effect. Return an iterator referring to the (possibly newly inserted) value_type
object in this set that is equivalent to value
. The average and worst case complexity of this operation is not affected by the specified hint
. This method requires that the (template parameter) type KEY
be copy-constructible
into this set (see {Requirements on KEY
}). The behavior is undefined unless hint
is an iterator in the range [begin() .. end()]
(both endpoints included). Note that hint
is ignored (other than possibly asserting its validity in some build modes).
|
inline |
Insert into this set the value of each value_type
object in the range starting at the specified first
iterator and ending immediately before the specified last
iterator, if a key equivalent to the object is not already contained in this set. The (template parameter) type INPUT_ITERATOR
shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3] providing access to values of a type convertible to value_type
, and value_type
must be emplace-constructible
from *i
into this set, where i
is a dereferenceable iterator in the range [first .. last)
(see {Requirements on KEY
}). The behavior is undefined unless first
and last
refer to a sequence of valid values where first
is at a position at or before last
.
|
inline |
Return (a copy of) the key-equality binary functor that returns true
if the value of two key_type
objects are equivalent, and false
otherwise.
|
inline |
Return the current ratio between the size
of this container and the number of buckets. The load_factor is a measure of how full the container is, and a higher load factor leads to an increased number of collisions, thus resulting in a loss performance.
|
inline |
Return a theoretical upper bound on the largest number of buckets that this container could possibly manage. Note that there is no guarantee that the set can successfully grow to the returned size, or even close to that size without running out of resources.
|
inline |
Return the maximum load factor allowed for this container. If an insert operation would cause load_factor to exceed the max_load_factor
, that same insert operation will increase the number of buckets and rehash the elements of the container into those buckets the (see rehash).
|
inline |
Set the maximum load factor of this container to the specified newLoadFactor
.
|
inline |
Return a theoretical upper bound on the largest number of elements that this set could possibly hold. Note that there is no guarantee that the set can successfully grow to the returned size, or even close to that size without running out of resources.
|
inline |
Assign to this object the value, hash function, and equality comparator of the specified rhs
object, propagate to this object the allocator of rhs
if the ALLOCATOR
type has trait propagate_on_container_copy_assignment
, and return a reference providing modifiable access to this object. If an exception is thrown, *this
is left in a valid but unspecified state. This method requires that the (template parameter) type KEY
be copy-assignable
and 'copy-insertable" into this set (see {Requirements on KEY
}).
|
inline |
Change the size of the array of buckets maintained by this container to the specified numBuckets
, and redistribute all the contained elements into the new sequence of buckets, according to their hash values. Note that this operation has no effect if rehashing the elements into numBuckets
would cause this set to exceed its max_load_factor
.
|
inline |
Increase the number of buckets of this set to a quantity such that the ratio between the specified numElements
and this quantity does not exceed max_load_factor
. Note that this guarantees that, after the reserve, elements can be inserted to grow the container to size() == numElements
without rehashing. Also note that memory allocations may still occur when growing the container to size() == numElements
. Also note that this operation has no effect if numElements <= size()
.
|
inline |
|
friend |
|
inline |
Exchange the value, hasher, key-equality functor, and max_load_factor
of this object with those of the specified other
object; also exchange the allocator of this object with that of other
if the (template parameter) type ALLOCATOR
has the propagate_on_container_swap
trait, and do not modify either allocator otherwise. This method provides the no-throw exception-safety guarantee if and only if both the (template parameter) types HASH
and EQUAL
provide no-throw swap operations; if an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1]
complexity. The behavior is undefined unless either this object was created with the same allocator as other
or ALLOCATOR
has the propagate_on_container_swap
trait. Remove all entries from this unordered set. Note that the set is empty after this call, but allocated memory may be retained for future use.