SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Maintains a collection of some type T
, in which there cannot be more than one occurrence of some given instance of T
.
More...
#include <rw/stdex/hashset.h>
Public Types | |
typedef impl_type::allocator_type | allocator_type |
typedef impl_type::const_iterator | const_iterator |
typedef impl_type::const_pointer | const_pointer |
typedef impl_type::const_reference | const_reference |
typedef impl_type::difference_type | difference_type |
typedef impl_type::hasher | hasher |
typedef impl_type::const_iterator | iterator |
typedef impl_type::key_equal | key_equal_type |
typedef impl_type::hasher | key_hash_type |
typedef impl_type::key_type | key_type |
typedef impl_type::pointer | pointer |
typedef impl_type::reference | reference |
typedef impl_type::size_type | size_type |
typedef impl_type::value_type | value_type |
Public Member Functions | |
rw_hashset (const rw_hashset &other) | |
template<typename InputIterator > | |
rw_hashset (InputIterator first, InputIterator last, size_type cap=64, const hasher &h=hasher(), const key_equal_type &eq=key_equal_type()) | |
rw_hashset (rw_hashset &&other) | |
rw_hashset (size_type cap=64, const hasher &h=hasher(), const key_equal_type &eq=key_equal_type()) | |
~rw_hashset (void) | |
iterator | begin (void) |
const_iterator | begin (void) const |
size_type | capacity (void) const |
const_iterator | cbegin (void) const |
const_iterator | cend (void) const |
void | clear (void) |
size_type | count (const value_type &key) const |
bool | empty (void) const |
iterator | end (void) |
const_iterator | end (void) const |
std::pair< iterator, iterator > | equal_range (const value_type &key) const |
size_type | erase (const value_type &key) |
iterator | erase (iterator first, iterator last) |
iterator | erase (iterator iter) |
float | fill_ratio (void) const |
iterator | find (const value_type &key) const |
std::pair< iterator, bool > | insert (const value_type &val) |
template<typename InputIterator > | |
size_type | insert (InputIterator first, InputIterator last) |
iterator | insert (iterator hint, const value_type &val) |
iterator | insert (iterator hint, value_type &&val) |
std::pair< iterator, bool > | insert (value_type &&val) |
iterator | lower_bound (const value_type &key) const |
rw_hashset & | operator= (const rw_hashset &rhs) |
rw_hashset & | operator= (rw_hashset &&rhs) |
void | resize (size_type cap) |
size_type | size (void) const |
void | swap (rw_hashset &other) |
iterator | upper_bound (const value_type &key) const |
Related Symbols | |
(Note that these are not member symbols.) | |
template<class T , class Hash , class EQ , class A > | |
bool | operator!= (const rw_hashset< T, Hash, EQ, A > &lhs, const rw_hashset< T, Hash, EQ, A > &rhs) |
template<class T , class Hash , class EQ , class A > | |
bool | operator== (const rw_hashset< T, Hash, EQ, A > &lhs, const rw_hashset< T, Hash, EQ, A > &rhs) |
Class rw_hashset maintains a collection of T
, implemented as a hash table in which there may not be more than one instance of any given T
. Since this is a value-based collection, objects are copied into and out of the collection. As with all classes that meet the ANSI associative container specification, rw_hashset provides for iterators that reference its elements. Since the contents of rw_hashset are in pseudo-random order, the only iterator ranges that will usually make sense are the results of calling equal_range(), and the entire range from begin() to end().
Hash
must provide a const
function that takes a single argument convertible to type T
and returns a value of type size_t
.
Element equality is determined by an equality function of type EQ
, which takes two arguments convertible to type T
and returns a value of type bool
.
typedef impl_type::allocator_type rw_hashset< T, Hash, EQ, A >::allocator_type |
A type representing the allocator type for the container.
typedef impl_type::const_iterator rw_hashset< T, Hash, EQ, A >::const_iterator |
A type that provides a const
forward iterator over the elements in the container.
typedef impl_type::const_pointer rw_hashset< T, Hash, EQ, A >::const_pointer |
A type that provides a const
pointer to an element in the container.
typedef impl_type::const_reference rw_hashset< T, Hash, EQ, A >::const_reference |
A type that provides a const
reference to an element in the container.
typedef impl_type::difference_type rw_hashset< T, Hash, EQ, A >::difference_type |
A signed integral type used to indicate the distance between two valid iterators on the same container.
typedef impl_type::hasher rw_hashset< T, Hash, EQ, A >::hasher |
A type representing the hash function.
typedef impl_type::const_iterator rw_hashset< T, Hash, EQ, A >::iterator |
A type that provides a forward iterator over the elements in the container.
typedef impl_type::key_equal rw_hashset< T, Hash, EQ, A >::key_equal_type |
A type representing the equality function.
typedef impl_type::hasher rw_hashset< T, Hash, EQ, A >::key_hash_type |
A type representing the hash function.
typedef impl_type::key_type rw_hashset< T, Hash, EQ, A >::key_type |
A type representing the type of keys used in the container.
typedef impl_type::pointer rw_hashset< T, Hash, EQ, A >::pointer |
A type that provides a pointer to an element in the container.
typedef impl_type::reference rw_hashset< T, Hash, EQ, A >::reference |
A type that provides a reference to an element in the container.
typedef impl_type::size_type rw_hashset< T, Hash, EQ, A >::size_type |
An unsigned integral type used for counting the number of elements in the container.
typedef impl_type::value_type rw_hashset< T, Hash, EQ, A >::value_type |
A type representing the value stored in the container.
|
inline |
Constructs an empty rw_hashset with cap buckets, using h as the hash function object, and eq as the equality function object.
|
inline |
Constructs an rw_hashset containing a copy of the elements in the range [first, last). The rw_hashset instance has cap buckets, uses h as its hash function object, and eq as the equality function object.
InputIterator
is an input iterator type that points to elements that are convertible to value_type objects.
|
inline |
Constructs an rw_hashset that is a copy of other. Each element from other is copied into self.
|
inline |
Move constructor. The constructed rw_hashset takes ownership of the data owned by other.
|
inline |
The destructor releases the memory used by the container's implementation.
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns the number of buckets in the container.
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Removes all items in the container.
|
inline |
Returns the number of items in self that compare equal to key according to the associated equality function object.
|
inline |
Returns true
if there are no items in the container.
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns the bounds of the subrange representing all values in the container that compare equal to key according to the associated equality function object. If no items in the container compare equal to key, returns end() for both iterators.
|
inline |
Removes the item in the container that compares equal to key according to the equality function object. Returns 1 if the item was found and removed, 0 otherwise.
|
inline |
Removes each element in the range [first, last). Returns an iterator referencing last. If first does not reference an item in self (and if first and last are not equal), the behavior is undefined.
|
inline |
Removes the element referenced by iter and returns an iterator referencing the next element. If iter does not reference an item in self, the result is undefined.
|
inline |
Returns the ratio of the number of items in the container to the number of buckets.
|
inline |
Returns the first item in self that compares equal to key according to the associated equality function object. If no items in the container compare equal to key, returns end().
|
inline |
Inserts a copy of val into the container. If an element in the container is equivalent to val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
|
inline |
For each value in the range [first, last), inserts a copy of the value into self. If an element in the container is equivalent to the value, the value is not inserted. Returns the number of elements inserted.
InputIterator
is an input iterator type that points to elements that are convertible to value_type objects.
|
inline |
Inserts a copy of val into the container. If an element in the container is equivalent to val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
The parameter hint is ignored.
|
inline |
Inserts val into the container. If an element in the container is equivalent to val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
The parameter hint is ignored.
|
inline |
Inserts val into the container. If an element in the container is equivalent to val, an iterator to the existing element in the collection is returned with an associated status of false
. Otherwise, the value val is inserted into the collection and an iterator to the new item is returned, along with the status true
.
|
inline |
Equivalent to equal_range(key).first
.
|
inline |
Replaces the contents of self with copies of the contents of rhs. The capacity, hash function object and equality function object are replaced by the respective objects from rhs.
|
inline |
Replaces the contents of self with the contents moved from rhs. The capacity, hash function object and equality function objects are moved from the respective objects in rhs.
|
inline |
Sets the number of buckets to cap. Each item in the container is rehashed according to the new number of buckets.
|
inline |
Returns the number of items in the container.
|
inline |
Exchanges the contents of self with other, including the Hash
and EQ
objects. This method does not copy or destroy any of the items exchanged but exchanges the underlying hash tables.
|
inline |
Equivalent to equal_range(key).second
.
|
related |
Equivalent to !(lhs == rhs)
.
|
related |
Returns true
if lhs and rhs have the same number of elements, and for each item in lhs, there is an item in rhs which compares equal according to the equality function object.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |