SourcePro C++ 13.0 |
SourcePro® C++ API Reference Guide |
Product Documentation: SourcePro C++ Documentation Home |
Maintains a collection of some type A, in which there may be many equivalent instances of A. More...
#include <rw/stdex/hashmset.h>
Public Types | |
typedef A | 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 Hash | hasher |
typedef impl_type::const_iterator | iterator |
typedef EQ | key_equal_type |
typedef Hash | key_hash_type |
typedef T | key_type |
typedef impl_type::pointer | pointer |
typedef impl_type::const_reference | reference |
typedef impl_type::size_type | size_type |
typedef T | value_type |
Related Functions | |
(Note that these are not member functions.) | |
template<class T , class Hash , class EQ , class A > | |
bool | operator!= (const rw_hashmultiset< T, Hash, EQ, A > &lhs, const rw_hashmultiset< T, Hash, EQ, A > &rhs) |
template<class T , class Hash , class EQ , class A > | |
bool | operator== (const rw_hashmultiset< T, Hash, EQ, A > &lhs, const rw_hashmultiset< T, Hash, EQ, A > &rhs) |
Class rw_hashmultiset<T,Hash,EQ,A> maintains a collection of T
, implemented as a hash table in which there may be many EQ
instances of 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_hashmultiset<T,Hash,EQ,A> provides for iterators that reference its elements. Operations that alter the contents of rw_hashmultiset<T,Hash,EQ,A> may invalidate other iterators that reference the container. Since the contents of rw_hashmultiset<T,Hash,EQ,A> 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
.
Equivalent elements within the collection are grouped together based on an equality object of type EQ
. EQ
must ensure this grouping via a function that takes two arguments convertible to type T
and returns a value of type bool
.
None
typedef A rw_hashmultiset< T, Hash, EQ, A >::allocator_type |
A type representing the allocator type for the container.
typedef impl_type::const_iterator rw_hashmultiset< 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_hashmultiset< 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_hashmultiset< 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_hashmultiset< T, Hash, EQ, A >::difference_type |
A signed integral type used to indicate the distance between two valid iterators on the same container.
typedef Hash rw_hashmultiset< T, Hash, EQ, A >::hasher |
A type representing the hash function.
typedef impl_type::const_iterator rw_hashmultiset< T, Hash, EQ, A >::iterator |
A type that provides a forward iterator over the elements in the container.
typedef EQ rw_hashmultiset< T, Hash, EQ, A >::key_equal_type |
A type representing the equality function.
typedef Hash rw_hashmultiset< T, Hash, EQ, A >::key_hash_type |
hasher
instead.A type representing the hash function.
typedef T rw_hashmultiset< T, Hash, EQ, A >::key_type |
A type representing the key of the container.
typedef impl_type::pointer rw_hashmultiset< T, Hash, EQ, A >::pointer |
A type that provides a pointer to an element in the container.
typedef impl_type::const_reference rw_hashmultiset< T, Hash, EQ, A >::reference |
A type that provides a reference to an element in the container.
typedef impl_type::size_type rw_hashmultiset< T, Hash, EQ, A >::size_type |
An unsigned integral type used for counting the number of elements in the container.
typedef T rw_hashmultiset< T, Hash, EQ, A >::value_type |
A type representing the container's data type.
rw_hashmultiset< T, Hash, EQ, A >::rw_hashmultiset | ( | InputIterator | first, |
InputIterator | last, | ||
size_type | sz = 64 , |
||
const hasher & | h = hasher() , |
||
const key_equal_type & | eq = key_equal_type() |
||
) |
Constructs an rw_hashmultiset<T,Hash,EQ,A> containing a copy of the elements in the range [first, last). The rw_hashmultiset instance has sz slots, uses h as its hash object, and eq as its equality comparator.
InputIterator
is an input iterator type where the iterator points to elements that are convertible to value_type objects.
|
inline |
Constructs an empty rw_hashmultiset<T,Hash,EQ,A> with sz slots, using h as the hash object, and eq as the equality comparator.
|
inline |
Constructs an rw_hashmultiset<T,Hash,EQ,A> that is a copy of mset. Each element from mset is copied into self.
|
inline |
Move constructor. The constructed hash table takes ownership of the data owned by mset.
|
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 slots in the hash table that self uses.
|
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 |
A synonym for erase(begin(),end()) .
|
inline |
Returns the number of items in self which are EQ
to key.
|
inline |
Returns true
if self is empty.
|
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 std::pair<iterator,iterator>(lower_bound(key), upper_bound(key))
. Upper and lower bound have special meaning for hash-based collections. See discussion elsewhere.
|
inline |
Removes all items in self which are EQ
to key, and returns the number of removed elements.
|
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 |
Removes each element in the range which begins with first and is bounded by bound. Returns an iterator referencing bound. If first does not reference an item in self (and if first and bound are not equal), the effect is undefined.
|
inline |
Returns the result of calculating size() / capacity().
|
inline |
Returns an iterator referencing some item EQ
to key if such a item is contained in self, else returns end().
|
inline |
Inserts val, returning a pair with an iterator referencing the new element and true
.
iterator rw_hashmultiset< T, Hash, EQ, A >::insert | ( | iterator | ignore, |
const_reference | value | ||
) |
Inserts val, returning 1
. Note that the first argument is provided only for conformance with the ANSI associative container specification, and is ignored by the method, since a hash table look up can be done in constant time.
|
inline |
Inserts val, returning a pair with an iterator referencing the new element and true
.
iterator rw_hashmultiset< T, Hash, EQ, A >::insert | ( | iterator | ignore, |
value_type && | value | ||
) |
Inserts val, returning 1
. Note that the first argument is provided only for conformance with the ANSI associative container specification, and is ignored by the method, since a hash table look up can be done in constant time.
|
inline |
For each element in the range [first, last), inserts a copy of the element into self. Returns the number of elements inserted.
InputIterator
is an input iterator type where the iterator points to elements that are convertible to value_type objects.
|
inline |
Returns the lower bound of key in self. This has a special meaning for hash-based collections. See discussion elsewhere.
|
inline |
Sets self to have the same capacity, Hash
and EQ
as rhs, removes all self's current contents, and replaces them with copies of the elements in rhs.
|
inline |
Move assignment. Self takes ownership of the data owned by rhs.
|
inline |
Resizes self's hash table to have sz slots; and re-hashes all self's elements into the new table. Can be very expensive if self holds many elements.
|
inline |
Returns the number of items currently held in self.
|
inline |
Swaps the data held by self with the data held by other, including the Hash
and EQ
objects. This method does not copy or destroy any of the items swapped; rather, it swaps the underlying hash tables.
|
inline |
Returns the upper bound of key in self. This has a special meaning for hash-based collections. See discussion elsewhere.
|
related |
Equivalent to !(lhs == rhs)
.
|
related |
Returns true
if lhs and rhs have the same number of elements, and for each distinct instance of T
in lhs, both lhs and rhs have the same count of instances.
Copyright © 2014 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.