|
| | FlatHashSet () |
| |
| | FlatHashSet (bslma::Allocator *basicAllocator) |
| |
| | FlatHashSet (bsl::size_t capacity) |
| |
| | FlatHashSet (bsl::size_t capacity, bslma::Allocator *basicAllocator) |
| |
| | FlatHashSet (bsl::size_t capacity, const HASH &hash, bslma::Allocator *basicAllocator=0) |
| |
| | FlatHashSet (bsl::size_t capacity, const HASH &hash, const EQUAL &equal, bslma::Allocator *basicAllocator=0) |
| |
| template<class INPUT_ITERATOR > |
| | FlatHashSet (INPUT_ITERATOR first, INPUT_ITERATOR last, bslma::Allocator *basicAllocator=0) |
| |
| template<class INPUT_ITERATOR > |
| | FlatHashSet (INPUT_ITERATOR first, INPUT_ITERATOR last, bsl::size_t capacity, bslma::Allocator *basicAllocator=0) |
| |
| template<class INPUT_ITERATOR > |
| | FlatHashSet (INPUT_ITERATOR first, INPUT_ITERATOR last, bsl::size_t capacity, const HASH &hash, bslma::Allocator *basicAllocator=0) |
| |
| template<class INPUT_ITERATOR > |
| | FlatHashSet (INPUT_ITERATOR first, INPUT_ITERATOR last, bsl::size_t capacity, const HASH &hash, const EQUAL &equal, bslma::Allocator *basicAllocator=0) |
| |
| | FlatHashSet (const FlatHashSet &original, bslma::Allocator *basicAllocator=0) |
| |
| | FlatHashSet (bslmf::MovableRef< FlatHashSet > original) |
| |
| | FlatHashSet (bslmf::MovableRef< FlatHashSet > original, bslma::Allocator *basicAllocator) |
| |
| | ~FlatHashSet () |
| | Destroy this object and each of its elements.
|
| |
| FlatHashSet & | operator= (const FlatHashSet &rhs) |
| |
| FlatHashSet & | operator= (bslmf::MovableRef< FlatHashSet > rhs) |
| |
| void | clear () |
| |
| template<class... ARGS> |
| bsl::pair< iterator, bool > | emplace (ARGS &&... args) |
| |
| template<class... ARGS> |
| iterator | emplace_hint (const_iterator hint, ARGS &&... args) |
| |
| bsl::size_t | erase (const KEY &key) |
| |
| const_iterator | erase (const_iterator position) |
| |
| const_iterator | erase (const_iterator first, const_iterator last) |
| |
| template<class KEY_TYPE > |
| bsl::enable_if< bsl::is_convertible< KEY_TYPE, KEY >::value, bsl::pair< const_iterator, bool > >::type | insert (BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) value) |
| |
| template<class KEY_TYPE > |
| bsl::enable_if< bsl::is_convertible< KEY_TYPE, KEY >::value, const_iterator >::type | insert (const_iterator, BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) value) |
| |
| template<class INPUT_ITERATOR > |
| void | insert (INPUT_ITERATOR first, INPUT_ITERATOR last) |
| |
| void | rehash (bsl::size_t minimumCapacity) |
| |
| void | reserve (bsl::size_t numEntries) |
| |
| void | reset () |
| |
| void | swap (FlatHashSet &other) |
| |
| bsl::size_t | capacity () const |
| |
| bool | contains (const KEY &key) const |
| |
| bsl::size_t | count (const KEY &key) const |
| |
| bool | empty () const |
| |
| bsl::pair< const_iterator, const_iterator > | equal_range (const KEY &key) const |
| |
| const_iterator | find (const KEY &key) const |
| |
| HASH | hash_function () const |
| |
| EQUAL | key_eq () const |
| |
| float | load_factor () const |
| |
| float | max_load_factor () const |
| |
| bsl::size_t | size () const |
| | Return the number of elements in this set.
|
| |
| const_iterator | begin () const |
| |
| const_iterator | cbegin () const |
| |
| const_iterator | cend () const |
| |
| const_iterator | end () const |
| |
| bslma::Allocator * | allocator () const |
| | Return the allocator used by this flat hash set to supply memory.
|
| |
| bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
| |
| template<class... ARGS> |
| bsl::pair< typename FlatHashSet< KEY, HASH, EQUAL >::iterator, bool > | emplace (ARGS &&... args) |
| |
| template<class... ARGS> |
| FlatHashSet< KEY, HASH, EQUAL >::iterator | emplace_hint (typename FlatHashSet< KEY, HASH, EQUAL >::const_iterator, ARGS &&... args) |
| |
template<class KEY, class HASH, class EQUAL>
class bdlc::FlatHashSet< KEY, HASH, EQUAL >
This class template implements a value-semantic container type holding an unordered set of unique values of (template parameter) type KEY. The (template parameter) type HASH is a functor providing the hash value for KEY. The (template parameter) type EQUAL is a functor providing the equality function for two KEY values. See {Requirements on KEY, HASH, and EQUAL} for more information.
See bdlc_flathashset
template<class KEY , class HASH , class EQUAL >
Create an empty FlatHashSet object. Optionally specify a capacity indicating the minimum initial size of the underlying array of entries of this container. If capacity is not supplied or is 0, no memory is allocated. Optionally specify a hash functor used to generate the hash values associated with the elements in this container. If hash is not supplied, a default-constructed object of the (template parameter) type HASH is used. Optionally specify an equality functor equal used to determine whether two elements are equivalent. If equal 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 or is 0, the currently installed default allocator is used.
template<class KEY , class HASH , class EQUAL >
template<class INPUT_ITERATOR >
Create a FlatHashSet object initialized by insertion of the values from the input iterator range specified by first through last (including first, excluding last). Optionally specify a capacity indicating the minimum initial size of the underlying array of entries of this container. If capacity is not supplied or is 0, no memory is allocated. Optionally specify a hash functor used to generate hash values associated with the elements in this container. If hash is not supplied, a default-constructed object of the (template parameter) type HASH is used. Optionally specify an equality functor equal used to verify that two elements are equivalent. If equal 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 or is 0, the currently installed default allocator is used. 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 if a member of the input sequence is equivalent to an earlier member, the later member will not be inserted.
template<class KEY , class HASH , class EQUAL >
Create a FlatHashSet object having the same value, hasher, equality comparator, and allocator as the specified original object. The contents of original are moved (in constant time) to this object, original is left in a (valid) unspecified state, and no exceptions will be thrown.
template<class KEY , class HASH , class EQUAL >
Create a FlatHashSet object having the same value, hasher, and equality comparator as the specified original object, using the specified basicAllocator to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The allocator of original remains unchanged. If original and the newly created object have the same allocator then the contents of original are moved (in constant time) to this object, original is left in a (valid) unspecified state, and no exceptions will be thrown; otherwise original is unchanged (and an exception may be thrown).
template<class KEY , class HASH , class EQUAL >
template<class... ARGS>
Insert into this set a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) args 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.
template<class KEY , class HASH , class EQUAL >
template<class... ARGS>
Insert into this set a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) args 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. Note that hint is ignored (other than possibly asserting its validity in some build modes).
template<class KEY , class HASH , class EQUAL >
Remove from this set the element whose key is equal to the specified key, if it exists, and return 1; otherwise (there is no element having key in this set), return 0 with no other effect. This method invalidates all iterators and references to the removed element.
template<class KEY , class HASH , class EQUAL >
Remove from this set the elements starting at the specified first position up to, but not including, the specified last position, and return last. This method invalidates all iterators and references to the removed elements. The behavior is undefined unless first and last are valid iterators on this set, and the first position is at or before the last position in the iteration sequence provided by this container.
template<class KEY , class HASH , class EQUAL >
template<class KEY_TYPE >
Insert the specified value into this set if the value does not already exist in this set; otherwise, this method has no effect. Return a pair whose first member is a const_iterator referring to the (possibly newly inserted) element in this set whose value is equivalent to that of the element to be inserted, and whose second member is true if a new element was inserted, and false if an equivalent value was already present.
template<class KEY , class HASH , class EQUAL >
template<class INPUT_ITERATOR >
| void bdlc::FlatHashSet< KEY, HASH, EQUAL >::insert |
( |
INPUT_ITERATOR |
first, |
|
|
INPUT_ITERATOR |
last |
|
) |
| |
|
inline |
Insert into this set the value of each element in the input iterator range specified by first through last (including first, excluding last). 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 if a member of the input sequence is equivalent to an earlier member, the later member will not be inserted.
template<class KEY , class HASH , class EQUAL >
| bsl::ostream & bdlc::FlatHashSet< KEY, HASH, EQUAL >::print |
( |
bsl::ostream & |
stream, |
|
|
int |
level = 0, |
|
|
int |
spacesPerLevel = 4 |
|
) |
| const |
Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level, and return a reference to the modifiable stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect.
template<class KEY , class HASH , class EQUAL >
Change the capacity of this set to at least the specified minimumCapacity, and redistribute all the contained elements into a new sequence of entries according to their hash values. If 0 == minimumCapacity and 0 == size(), the set is returned to the default constructed state. After this call, load_factor() will be less than or equal to max_load_factor() and all iterators, pointers, and references to elements of this set are invalidated.
template<class KEY , class HASH , class EQUAL >
Change the capacity of this set to at least a capacity that can accommodate the specified numEntries (accounting for the load factor invariant), and redistribute all the contained elements into a new sequence of entries according to their hash values. If 0 == numEntries and 0 == size(), the set is returned to the default constructed state. After this call, load_factor() will be less than or equal to max_load_factor() and all iterators, pointers, and references to elements of this set are invalidated. Note that this method is effectively equivalent to:
void rehash(bsl::size_t minimumCapacity)
Definition bdlc_flathashset.h:1430
float max_load_factor() const
Definition bdlc_flathashset.h:1529