SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
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>
Inherited by rw_internal_hashmultiset< T, Hash, EQ, A >.
Public Types | |
typedef T | value_type |
typedef impl_type::const_reference | reference |
typedef impl_type::const_reference | const_reference |
typedef impl_type::size_type | size_type |
typedef impl_type::difference_type | difference_type |
typedef impl_type::const_iterator | iterator |
typedef impl_type::const_iterator | const_iterator |
typedef Hash | key_hash_type |
typedef EQ | key_equal_type |
Public Member Functions | |
rw_hashmultiset (const value_type *first, const value_type *bound, size_type sz=1024, const Hash &h=Hash(), const EQ &eq=EQ()) | |
rw_hashmultiset (const_iterator first, const_iterator bound, size_type sz=1024, const Hash &h=Hash(), const EQ &eq=EQ()) | |
rw_hashmultiset (size_type sz=1024, const Hash &h=Hash(), const EQ &eq=EQ()) | |
rw_hashmultiset (const rw_hashmultiset< T, Hash, EQ, A > &mset) | |
rw_hashmultiset (rw_hashmultiset< T, Hash, EQ, A > &&mset) | |
~rw_hashmultiset () | |
rw_hashmultiset< T, Hash, EQ, A > & | operator= (const rw_hashmultiset< T, Hash, EQ, A > &rhs) |
rw_hashmultiset< T, Hash, EQ, A > & | operator= (rw_hashmultiset< T, Hash, EQ, A > &&rhs) |
bool | operator== (const rw_hashmultiset< T, Hash, EQ, A > &rhs) const |
iterator | begin () const |
iterator | end () const |
bool | empty () const |
size_type | size () const |
size_type | count (const_reference key) const |
iterator | find (const_reference key) const |
iterator | lower_bound (const_reference key) const |
iterator | upper_bound (const_reference key) const |
std::pair< iterator, iterator > | equal_range (const_reference key) const |
size_type | capacity () const |
float | fill_ratio () const |
void | resize (size_type sz) |
void | swap (rw_hashmultiset< T, Hash, EQ, A > &other) |
std::pair< iterator, bool > | insert (const_reference val) |
iterator | insert (iterator ignore, const_reference value) |
std::pair< iterator, bool > | insert (value_type &&val) |
iterator | insert (iterator ignore, value_type &&value) |
size_type | insert (const value_type *first, const value_type *bound) |
size_type | insert (const_iterator first, const_iterator bound) |
size_type | erase (const_reference key) |
iterator | erase (iterator iter) |
iterator | erase (iterator first, iterator bound) |
void | clear () |
Class rw_hashmultiset<T,H,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_hashmap<K,T,H,EQ,A> provides for iterators that reference its elements. Operations that alter the contents of rw_hashmap<K,T,H,EQ,A> may invalidate other iterators that reference the container. Since the contents of rw_hashmap<K,T,H,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().
#include <rw/stdex/hashmset.h> rw_hashmultiset<T,H,EQ,A=std::allocator<T> >;
None
typedef impl_type::const_iterator rw_hashmultiset< T, Hash, EQ, A >::const_iterator |
The typedef for the const iterator.
typedef impl_type::const_reference rw_hashmultiset< T, Hash, EQ, A >::const_reference |
Typedef for a const reference to a value in this container.
typedef impl_type::difference_type rw_hashmultiset< T, Hash, EQ, A >::difference_type |
Typedef for the type of difference between iterators.
typedef impl_type::const_iterator rw_hashmultiset< T, Hash, EQ, A >::iterator |
The typedef for the non-const iterator.
typedef EQ rw_hashmultiset< T, Hash, EQ, A >::key_equal_type |
A typedef for the equality object.
typedef Hash rw_hashmultiset< T, Hash, EQ, A >::key_hash_type |
A typedef for the hash object.
typedef impl_type::const_reference rw_hashmultiset< T, Hash, EQ, A >::reference |
Typedef for a non-const reference to a value in this container.
typedef impl_type::size_type rw_hashmultiset< T, Hash, EQ, A >::size_type |
Typedef for the type used to index into this container.
typedef T rw_hashmultiset< T, Hash, EQ, A >::value_type |
A typedef for the type of value in this container.
rw_hashmultiset< T, Hash, EQ, A >::rw_hashmultiset | ( | const value_type * | first, | |
const value_type * | bound, | |||
size_type | sz = 1024 , |
|||
const Hash & | h = Hash() , |
|||
const EQ & | eq = EQ() | |||
) |
Constructs an rw_hashmultiset<T,H,EQ,A> with sz slots, using h as the hash object, eq as the equals object, and containing a copy of each item referenced by the range including first and bounded by bound.
rw_hashmultiset< T, Hash, EQ, A >::rw_hashmultiset | ( | const_iterator | first, | |
const_iterator | bound, | |||
size_type | sz = 1024 , |
|||
const Hash & | h = Hash() , |
|||
const EQ & | eq = EQ() | |||
) |
Constructs an rw_hashmultiset<T,H,EQ,A> with sz slots, using h as the hash object, eq as the equality comparator, and containing a copy of each item referenced by the range starting with first and bounded by bound.
rw_hashmultiset< T, Hash, EQ, A >::rw_hashmultiset | ( | size_type | sz = 1024 , |
|
const Hash & | h = Hash() , |
|||
const EQ & | eq = EQ() | |||
) | [inline] |
Constructs an empty rw_hashmultiset<T,H,EQ,A> with sz slots, using h as the hash object, and eq as the equality comparator.
rw_hashmultiset< T, Hash, EQ, A >::rw_hashmultiset | ( | const rw_hashmultiset< T, Hash, EQ, A > & | mset | ) | [inline] |
Constructs an rw_hashmultiset<T,H,EQ,A> that is a copy of mset. Each element from mset is copied into self.
rw_hashmultiset< T, Hash, EQ, A >::rw_hashmultiset | ( | rw_hashmultiset< T, Hash, EQ, A > && | mset | ) | [inline] |
Move constructor. The constructed hash table takes ownership of the data owned by mset.
rw_hashmultiset< T, Hash, EQ, A >::~rw_hashmultiset | ( | ) | [inline] |
The destructor releases the memory used by the container's implementation.
iterator rw_hashmultiset< T, Hash, EQ, A >::begin | ( | ) | const [inline] |
The iterator returned references the first item in self. If self is empty, the iterator is equal to end(). Note that because items are stored in pseudo-random order, this iterator might reference any item that has been stored in self.
size_type rw_hashmultiset< T, Hash, EQ, A >::capacity | ( | ) | const [inline] |
Returns the number of slots in the hash table that self uses.
void rw_hashmultiset< T, Hash, EQ, A >::clear | ( | ) | [inline] |
A synonym for erase(begin(),end()) .
size_type rw_hashmultiset< T, Hash, EQ, A >::count | ( | const_reference | key | ) | const [inline] |
Returns the number of items in self which are EQ
to key.
bool rw_hashmultiset< T, Hash, EQ, A >::empty | ( | ) | const [inline] |
Returns true
if self is empty.
iterator rw_hashmultiset< T, Hash, EQ, A >::end | ( | ) | const [inline] |
The iterator returned marks the location "off the end" of self. It cannot be dereferenced.
std::pair<iterator,iterator> rw_hashmultiset< T, Hash, EQ, A >::equal_range | ( | const_reference | key | ) | const [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.
iterator rw_hashmultiset< T, Hash, EQ, A >::erase | ( | iterator | first, | |
iterator | bound | |||
) | [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.
iterator rw_hashmultiset< T, Hash, EQ, A >::erase | ( | iterator | iter | ) | [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.
size_type rw_hashmultiset< T, Hash, EQ, A >::erase | ( | const_reference | key | ) | [inline] |
Removes all items in self which are EQ
to key, and returns the number of removed elements.
float rw_hashmultiset< T, Hash, EQ, A >::fill_ratio | ( | ) | const [inline] |
Returns the result of calculating size() / capacity().
iterator rw_hashmultiset< T, Hash, EQ, A >::find | ( | const_reference | key | ) | const [inline] |
Returns an iterator referencing some item EQ
to key if such a item is contained in self, else returns end().
size_type rw_hashmultiset< T, Hash, EQ, A >::insert | ( | const_iterator | first, | |
const_iterator | bound | |||
) | [inline] |
For each element in the range beginning with first and bounded by bound, the element is copied into self. Returns the number of elements inserted.
size_type rw_hashmultiset< T, Hash, EQ, A >::insert | ( | const value_type * | first, | |
const value_type * | bound | |||
) | [inline] |
For each element in the range beginning with first and bounded by bound, the element is copied into self. Returns the number of elements inserted.
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.
std::pair<iterator,bool> rw_hashmultiset< T, Hash, EQ, A >::insert | ( | value_type && | val | ) | [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.
std::pair<iterator,bool> rw_hashmultiset< T, Hash, EQ, A >::insert | ( | const_reference | val | ) | [inline] |
Inserts val, returning a pair with an iterator referencing the new element and true
.
iterator rw_hashmultiset< T, Hash, EQ, A >::lower_bound | ( | const_reference | key | ) | const [inline] |
Returns the lower bound of key in self. This has a special meaning for hash-based collections. See discussion elsewhere.
rw_hashmultiset<T,Hash,EQ,A>& rw_hashmultiset< T, Hash, EQ, A >::operator= | ( | rw_hashmultiset< T, Hash, EQ, A > && | rhs | ) | [inline] |
Move assignment. Self takes ownership of the data owned by rhs.
rw_hashmultiset<T,Hash,EQ,A>& rw_hashmultiset< T, Hash, EQ, A >::operator= | ( | const rw_hashmultiset< T, Hash, EQ, A > & | rhs | ) | [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.
bool rw_hashmultiset< T, Hash, EQ, A >::operator== | ( | const rw_hashmultiset< T, Hash, EQ, A > & | rhs | ) | const [inline] |
Returns true
if self and rhs have the same number of elements, and for each distinct instance of T
in self, both self and rhs have the same count of instances.
void rw_hashmultiset< T, Hash, EQ, A >::resize | ( | size_type | sz | ) | [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.
size_type rw_hashmultiset< T, Hash, EQ, A >::size | ( | ) | const [inline] |
Returns the number of items currently held in self.
void rw_hashmultiset< T, Hash, EQ, A >::swap | ( | rw_hashmultiset< T, Hash, EQ, A > & | other | ) | [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.
iterator rw_hashmultiset< T, Hash, EQ, A >::upper_bound | ( | const_reference | key | ) | const [inline] |
Returns the upper bound of key in self. This has a special meaning for hash-based collections. See discussion elsewhere.
© Copyright 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.
Contact Rogue Wave about documentation or support issues.