|
| rw_hashset (size_type cap=64, const hasher &h=hasher(), const key_equal_type &eq=key_equal_type()) |
|
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 (const rw_hashset &other) |
|
| rw_hashset (rw_hashset &&other) |
|
| ~rw_hashset () |
|
iterator | begin () |
|
const_iterator | begin () const |
|
size_type | capacity () const |
|
const_iterator | cbegin () const |
|
const_iterator | cend () const |
|
void | clear () |
|
size_type | count (const_reference key) const |
|
bool | empty () const |
|
iterator | end () |
|
const_iterator | end () const |
|
std::pair< iterator, iterator > | equal_range (const_reference key) const |
|
size_type | erase (const_reference key) |
|
iterator | erase (iterator iter) |
|
iterator | erase (iterator first, iterator last) |
|
float | fill_ratio () const |
|
iterator | find (const_reference key) const |
|
std::pair< iterator, bool > | insert (const_reference val) |
|
iterator | insert (iterator hint, const_reference val) |
|
std::pair< iterator, bool > | insert (value_type &&val) |
|
iterator | insert (iterator hint, value_type &&val) |
|
template<typename InputIterator > |
size_type | insert (InputIterator first, InputIterator last) |
|
iterator | lower_bound (const_reference key) const |
|
rw_hashset & | operator= (const rw_hashset &rhs) |
|
rw_hashset & | operator= (rw_hashset &&rhs) |
|
void | resize (size_type cap) |
|
size_type | size () const |
|
void | swap (rw_hashset &other) |
|
iterator | upper_bound (const_reference key) const |
|
|
(Note that these are not member functions.)
|
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) |
|
template<class T, class Hash = RWTHash<T>, class EQ = std::equal_to<T>, class A = std::allocator<T>>
class rw_hashset< T, Hash, EQ, A >
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
.
- Note
- Any two elements that are equivalent must hash to the same value.
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
.
- Note
- Any two elements that are equivalent are disallowed for this container.
- Synopsis
#include <rw/stdex/hashset.h>
- Persistence
- None
template<class T , class Hash , class EQ , class A >
template<typename InputIterator >
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.
- Note
- If the value specified for cap is zero, the default number of buckets is used.
template<class T , class Hash , class EQ , class A >
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
.
template<class T , class Hash , class EQ , class A >
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.
template<class T , class Hash , class EQ , class A >
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
.
- Condition:
- This method is available only on platforms with rvalue reference support.
template<class T , class Hash , class EQ , class A >
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.
- Condition:
- This method is available only on platforms with rvalue reference support.
template<class T , class Hash , class EQ , class A >
template<typename InputIterator >
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.
- Note
- first and last must not be iterators into self.
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 |
|
) |
| |
|
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.